Hey guys,
i always wanted to use Siri directly to switch my devices and i just found a simple and easy way which i want to share.
“Hey Siri turn off all lamps in the bedroom”
Warning: This project needs Node.js version 0.12 or above. As the official pimatic websites states “Node.js 0.11/0.12 isn’t supported by all plugins yet.” so either you choose the hard way and install some kind of node version manager or you choose the easy way and use another raspberry pi.
So lets get started with a clean raspbian installation WITHOUT pimatic on it.
First you need to install Node.js 0.12 and other dependencies:
$ sudo apt-get install g++
$ sudo apt-get install libavahi-compat-libdnssd-dev
$ mkdir node.js
$ cd node.js
$ wget http://node-arm.herokuapp.com/node_latest_armhf.deb
$ sudo dpkg -i node_latest_armhf.deb
$ cd ..
Now you can go on installing the github project Homebridge.
$ git clone https://github.com/nfarina/homebridge.git
$ cd homebridge
$ npm install
After that you need to create a config.json. In this file you add the pimatic API commands to your devices. There is also a config-sample.json which you can copy and then edit:
$ sudo cp config-sample.json config.json
$ sudo nano config.json
There are many different devices supported by Homebridge and maybe someday we get a full pimatic integration. I do not have the skill for this but i can call pimatic API urls pretty good
Here is a short example of my config:
{
"bridge": {
"name": "Raspberrypi Bridge",
"username": "CC:22:3D:E3:CE:30",
"port": 51826,
"pin": "031-45-154"
},
"description": "MeinFile",
"platforms": [],
"accessories": [
{
"accessory": "Http",
"name": "Uhr",
"on_url": "http://name:pw@ip:port/api/device/uhr/buttonPressed?buttonId=qlockon",
"off_url": "http://name:pw@ip:port/api/device/uhr/buttonPressed?buttonId=qlockoff",
"brightness_url": "http://n:pw@ip:port/api/device/uhr/buttonPressed?buttonId=qlockon",
"http_method": "GET"
},
{
"accessory": "Http",
"name": "Deckenlampe",
"on_url": "http://name:password@ipaddress:port/api/device/Schalter2/turnOn",
"off_url": "http://name:password@ipaddress:port/api/device/Schalter2/turnOff",
"brightness_url": "name:password@ipaddress:port/api/device/Schalter2/toggle",
"http_method": "GET"
}
]
}
Everything’s ready so run npm run start
. Now choose a HomeKit App and add the bridge “Raspberrypi Bridge” with the code “031-45-154”. Voila!
If you use Eve it should now look like this:
For autostart Homebridge at reboot i used this tutorial on domoticz.com
DRAWBACKS:
There are many limitations as I just figured out how to get Homebridge working with the http accessories. So be creative and use the pimatic API for crazy ideas.
I also got no dimmers, so the brightness_url is just a place holder.
I first had problems connection to the bridge with the app “Insteon+” so i switched to Eve.
Second raspberrypi running all day