Monday, December 5, 2016

Home Automation (5): integrate Philips Hue


Lighting my House: at the end I have decided to adopt Philips Hue.
It has not been an easy decision. Hue is not cheap.
Another decision point has been the choice of the protocol for communication with the light’s bulbs.
I think toady, in Home and Building Automation, there are two possible and reasonable choices:
  • Zigbee (ZLL)
  • ZWave
ZWave is for example the protocol used by Fibaro System. It seems to me a little more open than Hue.
Zigbee Light Link (ZLL) is a protocol based on Zigbee.
As far as I have seen:
  1. ZLL is becoming more and more common;
  2. ZLL devices are cheaper than ZWave;
  3. In addition, Hue seems to me easier to set-up and integrate.
But Philips has worked with ZLL in such a way that other devices (for example lights from Ikea) don’t integrate. The protocol permits this.
Anyway, at the end I have decided to go with Philips Hue, thinking that it was the easier and most effective choice.

I have bought in an Apple Store one Hub and two white lamps and following the instructions available on Internet I have set-up the Hub and lamps, using an App on my iPhone.
I have to say that is has been really easy. In 15 minutes the Hub and two lamps were directly controlled by my iPhone.
The only annoying thing is that the Hub can be connected only with an Ethernet cable.
 At the heart of Hue there is an Hub, that is really a device to convert between the HTTP protocol and ZLL used by lamps.
 After the configuration, the next step has been consulting the documentation of the
 Hue has a nice and enough complete API, with which you can:
  • read the state of a bulb (on, off)
  • read the current brightness set
  • more information
This is an example of the URL that you have to call (GET) to read the status of a light

http://<IP>/api/<username>/lights/3

, where username comes from the initial configuration, and this is the answer that you get

Using this API it has been really easy to integrate the Hue System in my HomeAuto System, based on a RPI 3 Gateway on which 
NodeRED is running.
With NodeRED you can easily setup a flow with a Node calling HTTP REST API, and parse the JSON payload returned.
In this image, my flows reading the state of a total of four lights (in two rooms)
NewImage
I’ll come back with more details in a following blog’s post.

No comments:

Post a Comment