fredck / lightener

Magically control the state and brightness of lights in Home Assistant.
MIT License
99 stars 2 forks source link

Optimistic state preference #109

Open jakubheglas opened 8 months ago

jakubheglas commented 8 months ago

The Lightener instance seems to try to reflect the real state of associated lights. This on it's own isn't wrong behavior per se, but can severely affect control in the case of physical dimmer control, especially if the instance is comprised of different light types.

Events from a knob on the wall fire at much higher rate than when clicking around in the HA UI as per example GIF in the readme. When that rate collides with Lightener updating it's real state, the brightness slider will eventually start jumping all over the place.

Example: I can be dimming a group of lights from 50% to 10% and during that attempt the brightness can go all the way up to 100%, all they way down to 0 or anywhere in between.

How to replicate: In my case, I use the old Ikea Sonos Volume Control zigbee knob via ControllerX with repeat delay set to 100ms — that means when I turn the knob, change to brightness is triggered 10 times in 1 second. While it's default of 500ms would probably solve the issue, the experience is far from "dimmer-like".

Alternatively, clicking violently on the brightness slider (up and down) yields similar results.

Ideally, having an "optimistic" bool attribute or delay number attribute (time after which the real state of lights is updated, say, 1 second after last change), would most certainly help my case.

fredck commented 6 months ago

@jakubheglas, are you able to give a try to Lightener v2.3.0-beta.5? This is a pre-release so HACS doesn't install it by default but it gives you the option to install it ("redownload").

Several things on the Lightener logic changed, including also the way it handles changes from controlled lights.

Does it have any impact in your use case?