https://github.com/szh/onairlightmacos
Mac OS <> Raspberry Pi on air light
https://github.com/szh/onairlightmacos
macos raspberry-pi
Last synced: about 2 months ago
JSON representation
Mac OS <> Raspberry Pi on air light
- Host: GitHub
- URL: https://github.com/szh/onairlightmacos
- Owner: szh
- License: mit
- Created: 2024-08-01T19:56:43.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-01T19:56:52.000Z (almost 2 years ago)
- Last Synced: 2026-03-25T06:53:31.480Z (3 months ago)
- Topics: macos, raspberry-pi
- Language: Go
- Homepage:
- Size: 53.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
szh/OnAirLightMacOs
=======================
This is a fork of [TravisTX/OnAirLightMacOS](https://github.com/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.
Build
-----
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.
Server
------
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.
```bash
scp bin/server/* pi@onairserver.local:/home/pi
```
Then edit your `/etc/rc.local` file to run the server at boot, by adding this line before `exit 0`:
```bash
(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`.
Client
------
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.
Troubleshooting
---------------
To test the connection from your Mac to the Pi, you can manually query the Pi's HTTP server, replacing the IP and port:
```bash
# 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
```
Todo Items
-----------
- Add a timeout after which point the server resets the status if it hasn't received a request.
- Build using GitHub Actions.