basnijholt / adaptive-lighting

Adaptive Lighting custom component for Home Assistant
https://basnijholt.github.io/adaptive-lighting/
Apache License 2.0
1.77k stars 131 forks source link

Prevent light.turn_on of light that was just turned off #727

Closed basnijholt closed 1 year ago

basnijholt commented 1 year ago

Closes #726

This was a rare condition that showed up when the update that happens at interval occurred at the same moment as light.turn_off was called. In that case this happens in this order:

  1. someone calls light.turn_off, but light_state=off has not been registered
  2. AL starts regular update
  3. HA registers light as off
  4. AL makes an update and sets the colors/brightness to the state it thinks it should have (which turns on the light again).