Closed allistermaguire closed 2 years ago
Duplicate of #550 but admittedly this issue has a more concrete description of the problem and a suggestion for how to fix it
Thank you for re flagging this! It causes real issues for me as I use a lot of scene snapshots in my setup which then decreases the level each time the snapshot is used. It seems such an easy fix so hopefully it gets updated. As a side note it’s not just Dimmer2 but Dimmer1 and also RGBW2 intensity levels it happens on
See pull request #637
Environment
Describe the bug
Brightness for Dimmer 2 in Home Assistant for 100 percent is 254, it should be 255.
I have only noticed it now as I am using the scene snapshot functionality to record the existing state to re apply it later. Lights that are set at 100% will be 99% once the state is reapplied.
This looks to be caused by a differences between python 3.x and 2.7, and the conversion of brightness scale between Shelly and Home Assistant. For example the code below returns
254
in 3.x and255
in 2.7.It would be a simple fix; use
round()
instead ofint()
when retuning or setting brightness.Steps to Reproduce
View entity state in developer tools for a Dimmer 2 that is set to 100%.
Expected behavior
Dimmer 2 brightness should be 255.
Screenshots
Traceback/Error logs
Additional context