The Space API endpoint for the Amman Valley MakerSpace, switched on and off with a big sign that is also a switch.
- You can see a description of how to setup the MyHackerspace app.
- You can fork this repository to set up a Raspberry Pi based HackerSpace status for your own space.
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:
- Head over to f-droid.org.
- Download the F-Droid app and install it.
- Search in it for MyHackerspace: "hacker"
- Install the app. (Direct Download - not recommended)
- In Preferences (three dots at the top right), choose
Amman Valley MakerSpace
or add the current Hackerspace API ashttps://raw.githubusercontent.com/AmmanVMS/space.api/main/api.json
. - If you want the widget:
- Long-click on the background of your Android Phone
- Choose
Widgets
- Choose
MyHackerspace
- Choose the
Amman Valley MakerSpace
- Choose to display the text and the transparent background.
- You will see a button but soon it will have refreshed.
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.
- Fork this repository.
- Edit api.json to represent your own space.
You can replace theworkshop-closed.jpg
andworkshop-oepn.jpg
images or just leave them out for the start. There is loads to customize. have a look at the documentation. - Follow the Server Installation described below.
- Decide if you would like to setup GitHub Pages to serve the endpoint: Fork → Settings → GitHub Pages → choose branch → save. The endpoint should be avaliable under https://your_fork.github.io/space.api/app.json That might be faster than the raw representation which caches for a long time.
- Check and include the raw-git/GitHub Pages URL to the
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.
- Install git.
- Create SSH-Key.
ssh-keygen
- Add the
~/.ssh/id_rsa.pub
as deploy key to the repo or add it to the GitHub account. - Clone the repo
git clone [email protected]:AmmanVMS/space.api cd space.api git config --local user.email "pi@raspi" git config --local user.name "pi"
- Add a minutely check with
crontab -e
:* * * * * /home/pi/space.api/check_status.job
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