Philips Hue CLIP 2 API v2 Discussion Thread

The Hue bridge is rate limited to 20 requests per second, and the binding respects that limit.

Personally I am not working on that. But volunteers are welcome.

1 Like

Great, I have something to work with now I know that :+1:

No worries, I’ll see if I can find some time somewhere

Hi All

In order to work around the API V2 limitation of having to use Scenes to apply Color Temp or Color to a group (Room) of lights I have tried the following:

Create A Group with all the required Color or Color Temp items that I want to change.

For Color Temp I have the Base Type set to Dimmer and Aggregation Function set to None.

For Color I have the Base Type set to Color and Aggregation Function set to None.

When sending the required Color Temp to the group everything works, as does sending a required scene as well as turning the lamps off and on etc.

However if I have the Color items in the Color Group, the entire group seems to take on the satte of the group and it is no longer to changes the lamps using Scenes or Color Temp and Power ff and on etc.

Any ideas as to why this would differently with Color as opposed to Color temp?

Thanks
Mark

Hi, I am running openHABian 4.0.4 on a RPI 4…

For quite a while I have the Hue API v2 binding running; now I noticed something strange.

Ib the Hue Bridge, I recently added some new scenes to an existing room. So far, so unspectacular, my expectation was that the new scenes could be commanded in the existing “Scene” Item by their string name as with the other, older scenes there.

Well, if I do so (in a text based rule) I get an error that this command is not supported (while the older ones still work).

So I checked in the rules GUI which scene names are suggested when creating a new rule - and these were exactly the scenes from when the corresponding Thing was first created, but no update ever since…

Is there a more elegant and less time-consuming way to update this, apart from deleting and recreating the Thing and all linked Items?
I really wonder that I found absolutely nothing about that in the forum… Adding new scenes should not be such a rare case…? :wink:

Thanks in advance! :slight_smile:

Currently the scenes are imported into OH when the respective thing is created.

If you have a text based .things file the easiest way to recreate the thing is to temporarily delete the things file, and the restore it again.

Thanks for the quick reply!

Unfortunately no - all my Hue Things are created in the GUI…

Is it possible to trick it into a refresh? Like stop openhab, do something nasty in the jsondb, start again?

You probably could do that, but it would be very nasty, so I cant advise it. If you are on openhabian there is a backup and restore command. So a backup / delete json / restore might work. But it might not…

Okay, better not mess around too much. So I tried it like this:

  • Delete the “Room” Thing where I added new scenes in the Hue Bridge
  • Leave all channel links and items as they are
  • Run “Scan” in the Hue Binding (it detects the deleted room as expected)
  • Recreate the “Room” Thing, making sure all the UIDs and names are identical

This was successful in the sense that all the channel links and items are back functional.

But still: only the old scenes. :thinking:

Which Thing do I have to actually recreate that the scenes are being read again?

You may need to delete the room, restart OH and then recreate the room.

And yes, OH is sufficiently clever to remember items linked to deleted and restored things.

@Hundertvolt1 could you please open an issue here Issues · openhab/openhab-addons · GitHub

Hi again,

first of all: delete Thing - reboot - let Thing be detected - recreate worked so far.

Just to be sure: create an issue which says more or less “There is no elegant way to update the scenes in a Hue room, please include a feature which will however cater for this in some future release”?

Yup.

Done :smiley:
Here it is.
Thanks for your support again!

Today I had a deeper look at the Java code, and I also tested it on my own system. It seems that my advice to delete and recreate the thing was wrong (or actually overkill).

The scenes list will be automatically refreshed on any of the following events: a) dis-/re- enable the thing, or b) dis-/re- enable the bridge, or c) stop/re-start OH, or d) delete/re-create the thing (overkill).

@Hundertvolt1 can you kindly confirm that the above is indeed true for your case? (In which case we can probably close the Issue on GitHub).

Hi, I just checked the different methods.
The result was somewhat unexpected…

  • First test: Add a scene to a room, disable-enable the Thing for the room. Success! The new scene appeared / was commandable.
  • Second test: Add another scene, disable-enable the (virtual) Hue Bridge Thing, both v1 and v2. This did not work.
    Super strange: disable-enable the room Thing, which worked just before, did not work either, even minutes after the bridges were up again.
  • From there on, I did not manage to add the new scene, and even deleting the first added scene was no longer possible (deleted in the physical bridge, and still there in the Thing…)
  • Also, a stop-start of the openhab service did not update it. A second stop-start now lead to all scene suggestions in the GUI rules to disappear. For all things, not just the one room…

So the functionality seems somewhat there but quite brittle. Let me know if I can do some more tests!

By the way, I used Chrome and re-loaded the page regularly, so it should not be a caching issue…

UPDATE: Some 5 minutes later after the service restart, scenes are back and in sync again!

Is there something like a rate limit how often to query the scenes in place? I did the tests quite quickly, the first try worked, and then the second time it worked was some 10 minutes later - all in between failed, even the known-working ones.
A rate limit would explain this very well…

Hi @AndrewFG and Maintainers :slight_smile:

I am wondering and just curious if the Binding supports the “Hue Play HDMI Sync Box” as well?
I was searching for it in the things inbox - but it’s not there :roll_eyes:
Can the sync-box be controlled as well?

Best, Kai

I did not write any code for such devices, so the short answer is “no”.

The longer answer is that, the Hue API v2 does have some ‘entertainment’ API endpoints, as you can see from the link below. BUT from looking at those APIs, it is actually very hard to imagine a use case where OH would interact with them.

I don’t own such a box, so a) I may be the wrong person to imagine potential use cases, and b) unable to test any resulting code. So perhaps @April_Wexler you can have a look at the APIs and let me know what kind of use cases you imagine to have based on them?

Thanks for your fast answer, Andrew.
The use cases are quite simple, e.g.:

  • switch on (other lights), if Hue Sync Box was switched off
  • reduce brightness of synced lamps after dawn (increase brightness if bright light outside)
  • enable Alexa/Siri support via OH: start syncbox, start sync, stop sync etc.

I found in another thread a solution to add the HUE sync box:
https://community.openhab.org/t/philips-hdmi-sync-api/111679/9
After installing and enabling that jar the sync box appeared in OH.

Of course it would be nicer to have all in one binding :wink:

Some API infos are already in the code, but it seems to be APIv1:
https://github.com/Homey-GER/openhab-addons

In fact there is a totally different API for that device.

Hello @AndrewFG,

I have run into some problems I was hoping I could get some help on, please.

I use OpenHAB 4.0.4 with the Hue binding version shipped with OH 4.0.4 and Hue API v2. All configuration is done textually. I previously used API v1 and just switched over. Here is an excerpt of my config files:

.things file
Bridge hue:bridge-api2:dg [ipAddress="...", applicationKey="..."] {
    Thing room DG_NZ_Room "DG Nordzimmer" [resourceId="0eae1497-868a-4e00-8793-2defc2a547d2"]
    Thing device DG_NZ_Light_Desk [resourceId="ac66600f-7e85-4e27-9c31-e7345e880dd9"]
}
.items file
String DG_NZ_Lights_Scene "Lichtkonzept [%s]" <gluehbirne> (S_DG_Nordzimmer, F_Innenlichter) {channel="hue:room:dg:DG_NZ_Room:scene"}
String DG_NZ_Lights_LightBulb_Desk_Alert "Schreibtisch Alarm" <gluehbirne> (S_DG_Nordzimmer, F_Innenlichter) {channel="hue:device:dg:DG_NZ_Light_Desk:alert"}
.sitemapfile
Selection item=DG_NZ_Lights_Scene mappings=["DG NZ Off"="Aus", "DG NZ Nightlight"="Nachtlicht", "DG NZ White Max"="Weiss", "DG NZ Gaming White"="Gaming Weiss", "DG NZ Gaming Red"="Gaming Rot"]

The problems I ran into are:

  1. When I toggle through scenes using a Philips Hue Dimmer Switch, Items like DG_NZ_Lights_Scene always have the value UNDEF.
  2. When I send commands to a scene-channel, like so DG_NZ_Lights_Scene.sendCommand(“DG NZ Off”), it doesn’t do anything.
  3. When I send commands to the alert-channel of a device, like so DG_NZ_Lights_LightBulb_Desk_Alert.sendCommand(“LSELECT”), it doesn’t do anything.

Could you please help me by telling me what I am missing / doing wrong in these cases?
Thank you very much for your time and effort!

Best regards,
Gregory