Identifying the source of a change to the colour of Philips hue bulb


Does anyone know if it is possible to identify the origin of a change to the colour on a Philips hue bulb.
What I want to achieve is set the colour of a bulb using a rule in OH and then when the user uses the Philips hue app to change the colour OH would recognise this and store the new value to a global variable in OH. But for this I need some way of identifying that it was the Philips hue app to that changed the colour and not a rule.

Hi Ethan,

I have a similiar set-up. In my understanding this is not possible.
But I am watching this topic now as well.

I think that if I can set the default to something and then l get an inbound item that can linked to a rule to identify it changing then I can capture the new value somehow and store this in a new global variable.

I’m just running a thought experiment here but what if you had a proxy Item in openHAB which is what appears on your sitemap and is used by other rules when they want to check the state of the bulb. Then have a rule which triggers whenever this proxy is updated which issues the command to the “real” bulb’s Item. This rule also sets a flag to indicate that this was an openHAB initiated change.

Then have a rule that triggers on changes to the “real” bulb’s Item. In this rule you can check the flag and if it is set you know it was openHAB initiated. If it isn’t set you know that the change took place outside of openHAB. Make sure to reset the flag.

Of course this assumes that the Hue binding reports changes to the bulb that occur outside of openHAB, which I have know knowledge whether it does or not. If it doesn’t report changes to openHAB this is impossible.

I also assumes that the changes take place far enough apart that you will not run into a race condition where you update the bulb though openHAB but before that can be processed a change takes place outside of openHAB at the same time in which case it is all but impossible to tell the difference in the second rule.

This is exactly what I have not seen so far. Maybe we have an HUE Binding expert here that could help us out.

Is it possible to get the colour set by the philips hue app, i can see on the console that OH recognises the change but im not sure how to capture this.

The data i can see on the OH console is a long number like 6535893

Is this something you know about?

I have no experience with Hue.

Also interested in this! Not only for keeping OH in sync with external changes, but also for a ‘system started’ rule which polls the bulbs current state(s) and updates the item value(s) accordingly.

Any help would be greatly appreciated!

According to the wiki page:

The hue:refresh defines the polling interval in msec to retrieve Philips bulb status.

That implies that the binding is constantly checking for the status of the bulbs and presumably updating the bound Items with their current value. With the default value, your OH Hue Items should be updated with external changes within ten seconds of that change occurring.

There is no information on the wiki as to what states are retrieved during this polling (i.e. on/off, brightness, color?).

Correct, and that is happening. Changes by other apps update the OpenHAB item state, however at system start up the items do not reflect the current state, and are simply all ‘off’.


Do they eventually get to the right state (e.g. after 10 seconds)?

Do you have persistence setup for the items with a restoreOnStartup strategy? That should at least set your items to whatever they were when OH stopped.