HUE on OpenHab 2 binding

I am trying to get the state of a lamp, in order knowing if it is ON or OFF. I think having a channel for that would be a good idea, but there is no such thing.

I manage to switch the lamp on or off, by using the two channels, but the state they provide give no answer if it is ON or OFF. I am guessing, this is a work in progress, since when I am in Paper UI and I use the switch, the other channel is not affected directly.

I am looking for information about how it is implemented since I am working on an addon for OH2.


Not sure if I get the question. A hue light has a channel that can be linked to a color item. The color item should therefore always represent the state of the light and you can determine whether it is on or off.
If you are talking about the internals of a binding, you can always keep the last value in an internal field. I think the hue binding doesn’t do it because it doesn’t have the need.

Hi @Kai,
When I turn off (with physical switch) the HUE lights, the color/brightness parameters are lost. To workaround this problem, I would like to create a rule to restore color/brightness when the physical switch turns to ON.
Is it possible in OH2 ?


Hi, not sure about openHAB2 but you can already do this with a rule in openHAB1.

The bulbs lose any dimm and colour settings by default when you turn them off at the wall switch. This is a safety feature, and wont get changed.

But… openHAB polls the bulbs at the interval you define in the config. There is no push event.

Create a rule that gets triggered on the state change and then send the commands to set the light… like so:

rule "HUE Poll test"
    Item Light_FF_Office_Desk received update ON
    logInfo("Light_FF_Office_Desk", Light_FF_Office_Desk.state.toString)
    sendCommand(Light_FF_Office_Desk_B, 50);

Be aware there will be a moderate delay as the poll is not instant.

You might also consider the Hue Dimmer switch or another wireless switch to control the light through openHAB and not the mains.

Good luck

Thanks for your answer ! I will to try your rule in OH2 shortly…