HUE question

Maybe I’m missing something here. Given HUE can and does store scenes in their cloud, that are configured through their app, is it not possible to recall these via their API and activate them via SmartThings?
All I’ve found is an app to set some basic colors.
Harmony has no notion of HUE’s scenes either.
I want to configure a virtual switch (or the like) for each HUE scene to use for Harmony and SmartThings actions/activities.

1 Like

First of all, the Hue API is local only, so it can not invoke anything on the Hue cloud. With that said, there is some reference to Hue scenes in the local config on the bridge, but I don’t see all the state info required to apply them. Guessing this is just some placeholder info for the widgets.

The Hue API has expanded over the last 6 months or so, so maybe it’s worth having another look at it to see if scenes can be called locally.

Because its a PITA to create a scene (or edit one) in a SmartApp, I run them from shell scripts on a server. There they are just simple text files that are easy to call and edit. I even have several applied to a single switch based on repeated on events (tap on once get scene 1, tap on again get scene 2, etc.)

After a fresh look at the current Hue API, it seems that the getting, creation, modification, and recall of scenes is all possible now.

The creation/modification of scenes is only passed the list of lights (which is what I see in the hubs config), when the scene is created/modified, the individual light state values are polled and stored somewhere mysterious, but they are recallable from within the Groups API.

It would be nice to see the official SmartThings integration expanded to support this (along with groups, effects, and transitionTimes) as some of the scene IDs for ones created in the Hue app can be pretty cryptic… but I wouldn’t count on it anytime soon as they have much bigger fish to fry.

But, in a nutshell, this is doable now with just SmartThings if you want to get your hands dirty.

Yea, I’m trying like hell to avoid building your super HAM bridge or the like!
So I think there’s some cloud config now in HUE.
They have a web portal now:
https://my.meethue.com/en-us/my-scenes
It contained all my hues and a few scenes that I made for them. The scenes and individual lights can also be controlled from there, as well as scene sharing between any devices that have the hue app installed under your account.
You cannot edit the scenes from the portal however.
As an experiment I renamed a few scenes in the web portal, went to the android app, app still had the same names.
Went back to the app the next day, the scenes in the android matched the ones in the web portal.

In order for this to have happened the scenes have to be mirrored between the hue hub and their back end.
Question is, how do you extract and invoke them…

The web portal has been around for some time. The scenes stored on the Hue bridge have no relationship to the scenes in the cloud or on the mobile device other than they are cached on the hub when they are executed from either. The Bridge can support 200 scenes in this cache, so if you have less than 200 scenes, all of them will be available from from the Hue API (as long as they have been previously executed). When the bridge’s available scene storing resources have been exhausted, new scenes will overwrite old ones (I am guessing by order of creation but the docs only say they are ‘recycled’).

The individual light parameters for each scene cached on the bridge are actually are stored in the lights themselves (that turned out to be the mysterious location I mentioned earlier). While you can name scenes created on the bridge, they can only be called by ID**:

PUT /api/<username>/groups/<id>/action

{"scene": "441010bbe-on-0"}

If you specify group ID ‘0’, the scene will be recalled for all lights belonging to that scene. Using a different group would recall the scene for all lights that are in that group AND are part of the specified scene (which is pretty bloomin’ cool - you can have sub-scenes based on groups).

** ID’s are assigned only by the Bridge, therefore to know which ID corresponds to any name you have given a scene, you need to get the list of scenes on the bridge and compare the ID and Name value pairs. The ID’s assigned by the bridge can be quite cryptic (I suppose to make sure that they are all unique), so trying to keep track of them by ID would be a real pain.

This is where the tricky part of this comes in. Since there is no ‘scene’ capability in SmartThings, you’ll need an app that returns the list of the scenes available on the bridge at the time you wish to assign one to a switch (or some other trigger). I am sure this is doable, but believe me HAM Bridge and shell scripts is much simpler, especially when it comes to modifying them (which I seem to do pretty regularly).

HTH

-SiP

Edit: BTW… there seems to be a dealbreaker here for me. I love the long transition times available in Hue, especially when changing scenes. It seems there is no way to assign a transition time for a scene called from the API. )c:

Logitech harmony have clicked into this . . . However you cant include them in activities (No idea why, it makes nooooo sense, saying that, does anything harmony does make sense with there limited api) . . . ANYHOWWWWWWW if logitech are now able to active hue scenes over cloud to cloud then surely there must be a way we can do this with smarthings . . . . so we can click a virtual momentary switch and activate pre-defind hue scenes we have made in the hue app

i hate the idea of having to use the very well coded but fix as a pose to solution of FlexiHue which means you have to change your wholes homes mode to set a scene, id like to be able to have people set scenes for each room as a pose to just one at a time . . .

any thoughts @Mike_Maxwell

Yea, I had plenty of thoughts about a year ago when I crafted an epic prose of an app called superState…
By epic prose, I mean a through and stupendous expedition in map storage and manipulation…
I get a head ache just thinking about that app.
It’s a scene capture and replay utility that creates virtual custom switches for each scene.
you create one or more groups of devices, and then one or more scenes within the device group, the app spins up a virtual switch for each scene.
The problem with the hues is that changing their properties via any hue app, doesn’t immediately change their state in ST, so setting the scenes is a PITA, as you either wait for the polling to complete, force it, which requires two phones, or you set the colors in ST, which with the new color tile is even more frustrating…
The app does work, I use it, and there are a few others that do as well. It occasionally will miss setting a HUE, and the thngs due for a child app implementation, however I had high hopes that with V2 the app would perform better with the HUES, but we know where local execution went…
Don’t even get me started with Harmony, I hate the freaking thing, “ultimate home”, my arse…

2 Likes

Philips have a Remote API in limited test right now. Little doubt that this is what Logitech are using to sync scenes. Anyone can request access (they ask that you provide a reason), but I don’t know how tightly they’re controlling access to this API for small fry, or how long until they deem it fully baked and ready for the public at large.

3 Likes

wait for the polling to complete, force it, which requires two phones

Can you elaborate that please? I too have high hope for superState which on paper does everything that I need, but because ST does not reflect changes made by other Hue apps, it’s just a big source of frustration.

How do you force ST to poll the Hue Bridge to update the state of every bulb?
Thanks

@reward72
Open a hue bulb in the mobile app, then select refresh.
This will signal the hub to refresh all the bulbs that the hue hub has connected to it.

I see… it somewhat works, but not consistently… Hopefully we’ll get better Hue support one day… Thanks Mike