Matchstic / pilight

A HomeBridge-focused RGB light, controlled over HTTP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PiLight

A HomeBridge-focused RGB light, controlled over HTTP

Hardware

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

Setup

  1. Make sure node.js is installed on your Pi (v11.9.0 was used in testing)
  2. Clone this repo to some directory (e.g. /home/pi/pilight) on the Pi:

git clone https://github.com/Matchstic/PiLight.git

  1. Install node modules:

npm install

  1. Update pilight.service so that it points to the right directory for the ExecStart parameter.
  2. Setup the service file:
sudo cp ./pilight.service /lib/systemd/system/
sudo systemctl enable pilight.service
sudo systemctl start pilight.service
  1. Light service is now running

HomeBridge

The endpoints exposed by this project should be consumed by HomeBridge, using the homebridge-better-http-rgb plugin.

On your device running HomeBridge:

  1. Install the plugin:

npm install -g homebridge-better-http-rgb

  1. 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
        }
    }
]
  1. Restart HomeBridge
  2. The light should now appear in the Home app

About

A HomeBridge-focused RGB light, controlled over HTTP

License:MIT License


Languages

Language:JavaScript 100.0%