basnijholt / adaptive-lighting

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

Integration fails to load if sleep/brightness/color switch is disabled #988

Open MrEbbinghaus opened 1 month ago

MrEbbinghaus commented 1 month ago

I disabled the color switch, because I don't need that feature. Now I noticed that the integration won't start up correctly any more.

I investigated and found that these lines will loop until HA terminates it after timeout is reached.

https://github.com/basnijholt/adaptive-lighting/blob/1a2cd7399d99a8dece62d6ad1c99cc7a5448c855/custom_components/adaptive_lighting/switch.py#L990-L1005

The docs recommend tracking entities only in async_added_to_hass.

https://developers.home-assistant.io/docs/entity_registry_disabled_by#integration-architecture