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:
http://<hue-bridge>/api/<user-name>/resourcelinks
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
If anyone has any thoughts for improvement here, I am all ears!
.