3

Does anybody know how Philips implemented "scenes" in their hue api? With an app you can select an image and move every bulb to a color pixel and change the intensity. All lamps can have different colors and brightness levels and everything is saved as a "scene". However, when retreiving "scene" information; you only get an array of which lights are used in a scene, no detailed info is given. Since you can schedule the scenes, philips must have stored this information on the hub. The API does not even describe the "scenes". I have seen 3rd party apps that do create scenes, so it's not entirely secret...

dlamblin
  • 43,965
  • 20
  • 101
  • 140
Tom Shaeffer
  • 31
  • 1
  • 3

3 Answers3

4

I realise this is an old post, but I couldn't find an answer to this anywhere so I had a play around and figured it out myself. Hopefully useful to someone.

I don't have enough reputation to post the code snippets, but you can see the instructions in this post on Google+

https://plus.google.com/111036301775898522222/posts/iMt2hVdJvYo


First you address

</code>http://BRIDGE IP/api/APP ID/scenes/SCENENAME</code>

I think the scene name cannot contain spaces. PUT the lights you want in the scene in the body like so

{"lights":["3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],"name":"SCENENAME"}

Then you specify the condition for each bulb in the scene using PUT at

<code>http://BRIDGE IP/api/APP ID/scenes/SCENENAME/lights/BULBNUMBER/state</code>

I found you could specify values in whichever format you want, no need to include all values. My body looked like this

{"on":true,"bri":254,"xy":[0.1631,0.0206]}

Then once values are set for each bulb in the scene you activate it at

</code>http://BRIDGE IP/api/APP ID/groups/0/action</code>

with the body

{"scene":"SCENENAME"}
Devin
  • 7,690
  • 6
  • 39
  • 54
miknik
  • 41
  • 1
2

There are 2 things:

Most apps that use scenes just store the scenes in the app and when you apply a scene it will just send commands for each lamp in the scene sequentially to the bridge.

There's also a new scenes api in the bridge, but as far as I know that's not documented yet. It allows you to store a limited number of scenes on the lamps themselves and after that you can switch to such a scene by sending just a single command to the bridge which will then broadcast it to all the lamps.

This last option requires a firmware update, which not all your app users might have installed yet, so it's probably easier to just use the first option for now.

Christiaan
  • 2,637
  • 21
  • 26
0

Since I didn't find any examples of how to activate scenes, I'm adding this here on how to activate a scene in the Hue API v2.

To run a (already existing) scene in the Hue API v2, you first need to run the GET command to get all scenes.

https://<bridge_ip>/clip/v2/resource/scene

Look after the rid- id to be able to activate the scene you desire with a PUT request (https://<bridge_ip>/clip/v2/resource/scene/<rid>), with the following body:

{"recall":{"action": "active"}} 
kendee
  • 1