moroen / IKEA-Tradfri-plugin

A Python plugin for Domoticz to controll IKEA Gateway
68 stars 23 forks source link

After upgrading plugin, dim level is offset by 1 #107

Closed JohnnyJohnnySE closed 3 years ago

JohnnyJohnnySE commented 3 years ago

I am having a weird issue, I was doing some general maintenance on my raspberry and upgrading everything including the Ikea trådfri plugin for domoticz. However I started noticing my LUA scripts was not behaving as they should and I notice that the dim levels are offset by 1.

If I set 100% level through either slider or through the LUA script, actual level is then 99% and if I dim to level 50 , it will actually be 49%.

And sometimes when I select 100% the light goes out and then comes back at a lower dim level.

Trådfri plugin version 0.92 and domoticz 2020.2

A bit unsure if this is Domoticz or plugin issue, but the problem was not there until I upgraded to 0.92 and switched to py3coap

moroen commented 3 years ago

This is due to rounding errors, since Domoticz is using levels 0-100, while tradfri uses 0-254. I'll take a look and try to get this sorted...

moroen commented 3 years ago

Fixed in latest 0.9.3 version, and as a bonus, fixed error that prevented dimmers to correctly show percentages.