Using Siri to turn on lights in your home, home automation with Home Assistant and Homebridge and LimitlessLED

This post has become outdated and the information is rather scant and badly addressed.

Due to the amount of hits this thread has gotten, i’ve written a multipart post on setting up a Pi3 to be a headless pi-hole, home-assistant, homebridge, siri and alexa interfaced system.

Click here for the first part – Setting up a Raspberry-Pi with pi-hole, Home-Assistant, Homebridge, Siri and Alexa, Part 1, setting up a headless, monitorless Pi

So my RaspberryPi has been working away as a Pi-Hole for a few weeks now, and I decided to see what else I could use it for whilst it’s sitting idle.  I’ve always liked the idea of home automation, but always found it a touch expensive, now prices are coming down I thought I’d dip my toes in the water.

Please be aware, this blog post isn’t a full howto, it’s more of a reminder to me of how i did it, so there may be parts missing.

I fitted LED strips behind my TV many years ago to create some backlight to make movie watching easier on the eyes, so I decided to have a go at playing with these.  I replaced the old remote IR controlled 5050 LED controller with a LimitlessLED/Milight wifi controller, and bought a wifi bridge.  It’s very easy to setup, the controller uses the same AC/DC transformer that the previous controller used and the wifi bridge just needs a usb connection, so I plugged it straight into the Pi’s spare usb port.  I initially made them talk by using the Milight app for my iPhone and then had a think where to go from there.  Piece of cake.

Next I installed Home Assistant on the Pi, it’s got a Pi image so job’s a gooden. I SSH’d into my Pi, and firstly updated the PI that’s already running Rasbian:

sudo apt-get update
sudo apt-get upgrade

Next install HA, this takes approx 2 hours!
wget -Nnv https://raw.githubusercontent.com/home-assistant/fabric-home-assistant/master/hass_rpi_installer.sh && bash hass_rpi_installer.sh

Add the user hass to access the GPIO pins:
sudo adduser hass gpio

Now you can access the control panel via your browser and your pi ip address, in my case:
http://192.168.0.24:8123/states

Woohoo!! Although there isn’t a great deal here right now. Time to get editing the config file, in my case I’m now adding a password to protect the HA system and adding the config for the LimitlessLED wifi bridge. Be aware the yaml code that HA and HB is written in is very text layour sensitive, if it’s not set to how it likes it wont work.


limitlessled
light:
platform: limitlessled
bridges:
- host: 192.168.0.25
version: 5
port: 8899
groups:
- number: 1
type: rgbw
name: Lounge

So now the LimitlessLED can be controlled via the HA browser page.

Next to add Siri integration via Homebridge. So to install HB, we need to install Node and Avahi:
install homebridge
sudo npm install -g --unsafe-perm homebridge hap-nodejs node-gyp
cd /usr/lib/node_modules/homebridge/
sudo npm install --unsafe-perm bignum
cd /usr/lib/node_modules/hap-nodejs/node_modules/mdns

Install HB:

install homeassistant plugin for homebridge
sudo npm install -g homebridge-homeassistant

Edit the HB config file to talk to HA:
nano /home/pi/.homebridge/config.json
Add the text:


{
"bridge": {
"name": "Homebridge",
"username": "CC:22:3D:E3:CE:30",
"port": 51826,
"pin": "031-45-154"
},

"platforms": [{
"platform": "HomeAssistant",
"name": "HomeAssistant",
"host": "http://192.168.0.24:8123",
"password": "matthew1",
"supported_types": ["light"]
}]

}

Start HB by simply typing homebridge

Now goto Home on your iPhone and setup the house, you should be able to search and find the LED contoller and add that. Now telling Siri to turn it on/off will work!

Now setup HB to start on restart via systemd for Raspbian:
sudo mkdir //etc/default
sudo nano //etc/default/homebridge

Text for the file:

# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /var/homebridge

# If you uncomment the following line, homebridge will log more
# You can display this via systemd's journalctl: journalctl -f -u homebridge
# DEBUG=*

sudo nano //etc/systemd/system/homebridge.service
[Unit]
Description=Node.js HomeKit Server
After=syslog.target network-online.target

[Service]
Type=simple
User=homebridge
EnvironmentFile=/etc/default/homebridge
ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS
Restart=on-failure
RestartSec=10
KillMode=process

[Install]
WantedBy=multi-user.target


sudo chmod 0777 //var/homebridge/
sudo cp //home/pi/.homebridge/config.json //var/homebridge/
sudo chmod 0777 //var/homebridge/config.json
sudo useradd --system homebridge


sudo systemctl daemon-reload
sudo systemctl enable homebridge
sudo systemctl start homebridge

Check status of HB and HA:
systemctl status homebridge
systemctl status homeassistant

I installed a DHT temp and humidity sensor to the gpio pins so i could get an output to my phone or ask siri, so here’s how i installed it:

git clone https://github.com/adafruit/Adafruit_Python_DHT.git
cd Adafruit_Python_DHT/
sudo python setup.py install
sudo ~/Adafruit_Python_DHT/examples/AdafruitDHT.py 22 4

I downloaded extra icons from:
https://materialdesignicons.com/
 

Here’s how my current HA page looks:

I’ll upload my config files later for backup too.

Leave a Reply