This is a fork of TravisTX/OnAirLightMacOS which uses a Raspberry Pi Zero W and an RGB LED (or two single color LEDs) instead of a Hue light. It causes a light to turn red when any microphone or camera is active on a Mac.
Run ./build.sh
to compile both parts - the client which runs on Mac OS, and the server which runs on a Raspberry Pi Zero W. This should also work with other Raspberry Pi models - just edit the server/build.sh
script to build for the correct ARM version.
To install the server on your Raspberry Pi Zero W, SSH or SCP into your Pi and copy the files in bin/server/
to /home/pi/
or some other directory.
scp bin/server/* [email protected]:/home/pi
Then edit your /etc/rc.local
file to run the server at boot, by adding this line before exit 0
:
(cd /home/pi; sudo ./server > server.log &)
Important: Make sure to edit the app.env
file to set the correct GPIO pin numbers and disable test mode!
Now restart your Pi with the command sudo reboot
.
To install the client on your Mac, cd
into the macos/src
directory. Edit the app.env
file to set the correct IP address of the Raspberry Pi Zero W (you can use a hostname instead if you want). Then run ./install.sh
which will build the client, copy it to a subdirectory of your home directory, and then install it as a launchd service so it runs when you log in.
To test the connection from your Mac to the Pi, you can manually query the Pi's HTTP server, replacing the IP and port:
# Turn on busy light
curl -X PUT -d "true" http://192.168.86.56:8080/setstate
# Turn off busy light
curl -X PUT -d "false" http://192.168.86.56:8080/setstate
- Add a timeout after which point the server resets the status if it hasn't received a request.
- Build using GitHub Actions.