The Space API endpoint for the Amman Valley MakerSpace, switched on and off with a big sign that is also a switch.
If the button is on or off, the scripts will upload the current status. Since the scripts run each minute once, see crontab and GitHub refreshes the page every 5 minutes, it can take up to 6 minutes until an update arrives on the website.
To install the app MyHackerspace:
Amman Valley MakerSpace
or add the current Hackerspace API as https://raw.githubusercontent.com/AmmanVMS/space.api/main/api.json
.Widgets
MyHackerspace
Amman Valley MakerSpace
The status image for the space can be found here:
Please copy the whole URL if you like to embed it:
https://spaceapistatusimage.hosted.quelltext.eu/status?url=https%3A%2F%2Fraw.githubusercontent.com%2FAmmanVMS%2Fspace.api%2Fmain%2Fapi.json
If you would like to have a small badge displaying the status of the space, you can use this one:
Please copy the whole URL:
https://spaceapistatusimage.hosted.quelltext.eu/status?url=https%3A%2F%2Fraw.githubusercontent.com%2FAmmanVMS%2Fspace.api%2Fmain%2Fapi.json&open=https%3A%2F%2Fimg.shields.io%2Fbadge%2FMakerSpace-open-lightgreen&closed=https%3A%2F%2Fimg.shields.io%2Fbadge%2FMakerSpace-closed-red
The badge and the image were both created with the SpaceAPIStatusImage generator.
You can set up your own Raspberry Pi to report the Hackerspace setup. This should walk you through how to do it.
workshop-closed.jpg
and workshop-oepn.jpg
images or just leave them out for the start.
There is loads to customize. have a look at the documentation.api.json
file for your repository’s api.json file. (Example)The Raspberry Pi will update the status JSON automatically and push the current status to GitHub. GitHub serves as a reliable server for the data.
ssh-keygen
~/.ssh/id_rsa.pub
as deploy key to the repo or add it to the GitHub account. git clone git@github.com:AmmanVMS/space.api
cd space.api
git config --local user.email "pi@raspi"
git config --local user.name "pi"
crontab -e
:
```
Done. Now, the Raspberry Pi checks the status every minute and uploads it to GitHub. You can check if it works by reading the created log file.
See Using Switch with Raspberry Pi – Python. You can also adjust the scripts.
You can edit the script to change whether a pressed switch means open or closed.
In our case, we also have an LED attached to the swicth so you know if it connects.
Pins: black(5V) free red(GND) free free yellow(GPIO)
To check the status, run the
./status.py