Does the Hue binding support animations (to signal an intrusion alarm)?

I have some user defined animations stored on my bridge and I’m wondering if there are any plans allowing the OpenHab 2 Hue binding to trigger these animations?

Background:

We use OpenHab to initiate an indoor / outdoor alarm if certain sensors are triggered. The outdoor alarm is provided by a siren and a flash. But the indoor alarm is provided by multiple Philips Hue lamps playing an “alarm” animation. That’s the reason why I need to trigger an animation within an OpenHab rule.

Since these animations are fully maintained by the bridge, the playback is very smooth and all affected lamps are perfectly synchronized. Maybe someone from the Philips Hue binding (@dominicdesu :slight_smile: ) might have further information or hints for us?

Thanks in advance for any help!

Here you can see how such an “alarm” animation looks like:

If i get it right, this should be possible with the http binding. I’m using something similar, unfortunately not triggered directly from openhab but from a bash script instead:

curl -X PUT -d '{"alert":"lselect"}' http://192.168.178.63/api/openHABRuntime/groups/0/action

192.168.178.63 is the IP of my Hue Bridge, openHABRuntime is the secret I configured in my openhab.cfg for the hue bridge. That way I just use this secret and didnt have to register an additional one for this script.

That looks promising, I think it should be possible to start an animation by simply initiating the correct http request on the associated bridge.

Your example looks as it triggers the breathe feature instead of an animation (which are stored on the bridge). Do you know the URL to trigger animations as well?

BTW: You can upload user-defined animations to the hue bridge by using various tools. These animations can span multiple lamps and are autonomously played by the bridge (no other client app involved except starting).

One of these apps for animation editing is iConnectHue …

I am using the linux command line as well as a workaround in openHAB1 to switch on the light with a custom transitionTime:
val String hueApiCallOn = "curl@@-X@@PUT@@-d@@{\"on\": true, \"bri\": 254, \"transitiontime\": %d}@@http://hueIp/api/secret/lights/%d/state" ... executeCommandLine(String::format(hueApiCallOn, 12000, BEDROOM_LIGHT))

Nevertheless it surely makes sense to be able to trigger scenes from openHAB with a simple Switch. I would love to have a look into this when I find some time. (Maybe last week of April)

1 Like

To recall a scene you need something like this:
/api/<username>/groups/<id>/action
with body: {"scene": "AB34EF5"}

And consider this:

Note: Use group 0 to recall a scene for all
lights (which are part of the scene), or use another group
if you want to recall the scene for a specific group of lights. E.g.
Using group 2 would recall the scene for all lights that are in group 2
AND are part of the specified scene.

Details are on the hue API page (need to register to access)

Are the animations saved on the hub?

are you putting this curl command inside sendCommand in rules ?
and what does {“alert”:“lselect”} signify in hue api ? i know {scene: XXXX} but whats “alert” and where can i see the alerts available on my first gen hue bridge ?

Playing around with the Hue API and some custom OpenHAB rules, I managed to get both ‘colorloop’ and ‘alert’ effects working. Here is a sample from one of my security rules:

			// 'Color Loop' Office Lights
			val String hueApiCallOn = "curl@@-X@@PUT@@-d@@{\"on\": true, \"bri\": 254, \"hue\": 65535, \"sat\": 254, \"effect\": \"colorloop\", \"transitiontime\": %d}@@http://hueIp/api/secret/groups/%d/action"
			// 'Alert' Office Lights
			//val String hueApiCallOn = "curl@@-X@@PUT@@-d@@{\"on\": true, \"bri\": 254, \"hue\": 65535, \"sat\": 254, \"alert\": \"lselect\", \"transitiontime\": %d}@@http://hueIp/api/secret/groups/%d/action"			
			
            // '100' is the transition time, '6' is the group ID
			executeCommandLine(String::format(hueApiCallOn, 100, 6))

By controlling the ‘group’ rather than the individual bulbs, they stay almost perfectly in sync!

.

Nice work. The hue binding supports alert and color loop by design. Too bad it does not yet support groups.

I hate reviving old threads, but I’m curious as to how to upload animations to the bridge. I see iConnectHue listed, but it doesn’t seem to be available for Android. Any Android users out there who’ve found something you like?