Philips Hue Binding: Wrong Dimmer Values (always one percent too high)

Hi everybody,

I use actually OH 3.4 with official hue-binding build.

All my bulb are displayed in OpenHAB with “one percent too high”
When I set a light bulb (with the hue app) to 30%, then in OpenHAB it will displayed as 31%

Other 3rd-Party Apps, which are connected to the hue-bridge are showing the values correct.

Can somebody confirm this behaviour ?
I think, it is not new to OH 3.4…I saw this in OH 3.3 too…

Thanks, Ralph

I just checked. The Hue app shows 40% and the item as well:

openhab> openhab:items list Dim_KitchenR
Dim_KitchenR (Type=DimmerItem, State=40, ...
1 Like

I am able to reproduce the difference of 1%.
Will investigate.

1 Like

Here are the results of my investigations.
In the Hue app (at least with the version I am using), the slider displays a value between 1% and 100%. When the binding calls the API to get a fresh data, it leads to a brightness being respectively 1 and 254.
The binding uses this formula to convert to a percent: percent = (int) Math.ceil(lightState.getBrightness() / 2.54);
When the slider is set to 25% in the hue app, it leads to value 66 returned by the API. 66 / 2.54 = 25.984252 and ceil of that gives 26. We get the small difference.
When the slider is set to 1% in the hue app, it leads to value 1 returned bu the API. And finally 1% in OH.
When the slider is set to 100% in the hue app, it leads to value 254 returned bu the API. And finally 100% in OH.
So there is certainly a small difference in the percent/brightness conversion (rounding) between the hue app and the openHAB binding. I am not sure who is wrong !

For 25%, I would have expected something like 254/4=63.5 so either 63 or 64 but not 66. 63 would have been converted to 25% in OH.
For 50%, I would have expected something like 254/2=127 but not 129. 127 would have been converted to 50% in OH.

So it let me think that the percentage shown in the hue app is not correct … or the conversion in brightness done by the hue app is not correct.

Thank you for your investigation.
This sounds a little bit strange…

I have a few systems in my environment that are connected to the Hue Bridge. All show the correct percentages except OpenHAB.

I believe your statement that this is a rounding problem in the binding is correct.

The only funny thing is that nobody seems to have noticed it until now.
There should be a lot of people using OpenHAB with Hue…

My statement is not exactly this one. I believe that the % shown by the hue app is also not correct !

Just to be sure, you are talking about the % shown temporarily when moving the brightness slider in the hue app ?

We are talking only about a difference of 1% and this shift is not for all values between 1 and 100%. And the value is not very visible in the hue app, you see it only when moving the slider. That is probably the reason why noone made attention to that in the past.

If you can find a better conversion leading to same percentages, let me know.