Wednesday, November 25, 2015

OpenHAB and Zigbee Philips Hue

Now that openHAB and Z-Wave are working, it's time to get Zigbee setup so I can use the cheaper light bulbs. As of this post, the GE and Cree Zigbee bulbs are $15 at your local Home Depot or on Amazon in comparison to $30 for the Z-Wave ones. I have tested the Cree bulbs and they have a nice even glow compared to GE. The GE bulbs look cool since they have a clear dome but deathly to look at when on.

My co-worker originally bought the bulbs but realized replacing the wall switches was the way to go, so now I have them, ;).  Since I didn't go the Wink route, I had to figure out the best way to get Zigbee support. Zigbee seems a bit harder as I couldn't find a nice USB solution like Z-Wave. There are some USB solutions like the Ti Zigbee development board which is supported by openHAB2, which isn't ready for prime time.

After many hours researching I decided on the Philips Hue Hub. It's not the best solution as far as flexibility but it works with openHAB without root, using the native REST API and works locally without a cloud service. You can join it to the cloud if you want for remote access, but openHAB takes are of that for me and doesn't rely on someone else's server but my own. Plus it supports scenes and the new version of the hardware is Apple Homekit certified (if you are into that). It seems that the new hardware version just came out so it was a bit hard to find but of all places, Best Buy had it in stock. Most places sell it with a kit with a few RGB bulbs vs standalone.  I didn't want to spend that much and honestly, using the cheaper Cree bulbs is a great start. Eventually, I would like to try the color bulbs. Maybe Philips can send me some to review...


Getting the Hue hub working is a snap. Just load the binding, set the config file and pair it. What I ended up doing is loading the Hue app and getting the bulbs working first. Then setup openHAB.

sudo apt-get install openhab-addon-bindings-hue

Here is my config file minus the API secret. Probably a good idea to set your own than use the default. I believe it has to be ten or more characters in length.

openhab.cfg
 
############################### Philips Hue Binding ###################################
#
# IP address of Hue Bridge (optional, default is auto-discovery)
hue:ip=192.168.0.200

# Default secret key for the pairing of the Philips Hue Bridge.
# It has to be between 10-40 (alphanumeric) characters
# This may be changed by the user for security reasons.
hue:secret=openHABRuntime

# Polling interval in msec to retrieve Philips bulb status.
# Other apps can change Hue status or a physical switch can turn on / off lamp status.
# If this happens the status of hue lamps within OpenHAB won't reflect the real status.
# Currently (September 2014) there is no push technology available, so the only option is
# to poll Philips bulbs to retrieve status and update items accordingly to reflect changes.
# Polling is enabled if refresh is specified, by commenting out "hue:refresh=10000" statement.
# Be aware that polling will consume resources, so a small refresh interval will increase cpu load.
hue:refresh=5000 
 

 I setup my bulbs in a lamp in the livingroom that has a upper and a lower directional lamp. Here is the items config.

livingroom.items
 
 Switch  huet_living_lamp_1      "Livingroom Lamp Upper"         (Livingroom)    {hue="2"}
 Switch  huet_living_lamp_2      "Livingroom Lamp Lower"         (Livingroom)    {hue="1"}
 Dimmer  hue_living_lamp_1       "Livingroom Lamp Upper"         (Livingroom)    {hue="2;brightness;10"}
 Dimmer  hue_living_lamp_2       "Livingroom Lamp Lower"         (Livingroom)    {hue="1;brightness;10"}
 
 

Finally add them to the sitemap. Of course this is just a basic setup, you can do so much more since you can dim them. I would like to set one up in the bedroom and do a sort of sunrise mode to help me wake up for work.

default.sitemap
 
 Switch  item=huet_living_lamp_1
 Slider  item=hue_living_lamp_1  visibility=[huet_living_lamp_1==ON]
 Switch  item=huet_living_lamp_2
 Slider  item=hue_living_lamp_2  visibility=[huet_living_lamp_2==ON] 
 

Since I am in an apartment using connected bulbs, it made more sense than replacing the wall switches and affecting the electrical. The other option is getting a Z-Wave switch that goes inline with the wall switch. A lot less noticeable, too, but more invasive and I didn't want the manager to have any reason to blame us, you know how that goes. For now I opted to get the Philips dimmer remote.  It has magnets in it so you can attach it to the wall or just have it laying around.




So between that and the openHAB app I think we are covered. Of course part of home automation is automation so the idea would be for the lights to be automated based on the time of day and if we are coming home. This means plenty of more posts to come!

I hope this helps anyone wanting to get started on openHAB. This should be enough of a basis to build out your own custom system. Up next will be proximity detection...


1 comment:

  1. If you get any of the large Ge lamps from home depot, they are on clearance as of this past week and this one. $6 and for damp locations. I found your post while researching a dimming issue with them. The original A16 style lamps dim fine. But openhab does not dim the large ones, and throws an error. Anyway... If you also ever figure out how to get that remote to be interface with openhab, please post what you find.

    ReplyDelete