A HomeBridge-focused RGB light, controlled over HTTP
You will need:
- A Raspberry Pi (2B or newer, I used a Pi Zero W)
- A Unicorn pHAT
- [optional] USB WiFi dongle for older hardware
- Make sure node.js is installed on your Pi (v11.9.0 was used in testing)
- Clone this repo to some directory (e.g.
/home/pi/pilight
) on the Pi:
git clone https://github.com/Matchstic/PiLight.git
- Install node modules:
npm install
- Update
pilight.service
so that it points to the right directory for theExecStart
parameter. - Setup the service file:
sudo cp ./pilight.service /lib/systemd/system/
sudo systemctl enable pilight.service
sudo systemctl start pilight.service
- Light service is now running
The endpoints exposed by this project should be consumed by HomeBridge, using the homebridge-better-http-rgb plugin.
On your device running HomeBridge:
- Install the plugin:
npm install -g homebridge-better-http-rgb
- Update accessory config with this:
"accessories": [
{
"accessory": "HTTP-RGB",
"name": "Mood Light",
"service": "Light",
"switch": {
"status": "http://<light-ip>:3000/power/status",
"powerOn": "http://<light-ip>:3000/power/on",
"powerOff": "http://<light-ip>:3000/power/off"
},
"brightness": {
"status": "http://<light-ip>:3000/brightness",
"url": "http://<light-ip>:3000/brightness/%s"
},
"color": {
"status": "http://<light-ip>:3000/color",
"url": "http://<light-ip>:3000/color/%s",
"brightness": true
}
}
]
- Restart HomeBridge
- The light should now appear in the Home app