Philips Hue Labs

Philips Hue Labs ‘Formula’ via Rules - particularly for my Hot Tub Scene. For those not familiar Hue Labs provides ‘sneak peaks’ at new ways to setup indoor/outdoor lighting scenes and generate a ‘formula’, which is seemingly entirely handled by the bridge itself. When triple tapping a certain Z-Wave switch up/down, I wanted openHAB to toggle the desired Hue Labs Formula on/off along with a bunch of other logic. So after some research and experimentation this blog post steered me in the right direction:

A key bit includes sending the status to a particular endpoint within the Hue Bridge, based on the User and Sensor ID. ID’s can discovered as described below. The variables and should be replaced with the values appropriate for your environment (find the ‘user-name’ in openHAB 3.x under Settings > Things > [Hue Bridge ID] ). Then visit:


And then create a new DSL in openHAB. Initially I got this working as a one off script, but found it easier/cleaner to just add it into the individual custom ON/OFF Rules so I could modify the status bit via PUT request like so:

var returnvalue = HTTP.sendHttpPutRequest("http http://<hue-bridge>/api/<user-name>/sensors/<sensor-id>/state", "application/json", '{"status": 1}');

Ideally I would want this as a switch and/or widget to control many scenes - which I will make happen, all in due time :slight_smile:

If anyone has any thoughts for improvement here, I am all ears!


1 Like

Thanks for the tutorial! Looks like a good find.

Did you mean to post the link to the blog post?

The HTTP binding aught to be able to handle this without the rule.

1 Like

@rlkoshak - Cheers! I cleaned up the writeup a bit and added some deep links. Will experiment with the HTTP binding soon - thanks for the tip here!

Another cool feature with the Hue Labs Scene integration - as the scenes bulb color changes run entirely off of the Hue bridge, each light automatically returns to the previous colors before the Labs scene started whenever the Labs ‘Formula’ is turned off. Nifty!

I’ve made some good progress with @rlkoshak’s suggestion to leverage the HTTP binding, but still fighting with the JSONPATH response parsing. Will post the details here on how to set this up whenever I get this entirely sorted. In the mean-time, if any happens to beat me to it - please share!

When all else fails you can use the JavaScript transform to parse the JSON into an Object and pull out the needed info that way.

1 Like