Cannot turn off lights with long transition
See original GitHub issueVersion information:
core-2021.9.7 on Home Assistant OS 6.4 with supervisor-2021.09.6
Description:
When turning off a light with a long transition, AL will keep adjusting the light and thus prevent the light from turning off. This will happen even if you take manual control over the light before you turn it off, as AL resets the manual control flag for the light as soon as it sees the light.turn_off
command. This happens here:
https://github.com/basnijholt/adaptive-lighting/blob/e2212c11448da1bcdf719f5db411687b7afc7fdf/custom_components/adaptive_lighting/switch.py#L1245-L1256
I think you should be able to turn off your lights, with a transition, and without the need to turn off AL entirely.
Steps to reproduce bug:
Turning off with long transition:
service: light.turn_off
data:
transition: 90
target:
entity_id: light.bedroom
2021-10-02 19:41:08 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_off('['light.bedroom']', transition=90)' event with context.id='4c2c53f2bf0bce29922bd59bfdfcc564'
2021-10-02 19:41:17 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.bedroom' 'state_changed' event: '{'min_mireds': 111, 'max_mireds': 666, 'effect_list': ['effect_colorloop', 'effect_pulse', 'effect_stop'], 'supported_color_modes': ['color_temp', 'hs'], 'color_mode': 'color_temp', 'brightness': 164, 'color_temp': 666, 'hs_color': (25.487, 100.0), 'rgb_color': (255, 108, 0), 'xy_color': (0.635, 0.355), 'friendly_name': 'Bedroom', 'supported_features': 55}' with context.id='d92b037072fd888f7e019ad5df635898'
2021-10-02 19:41:27 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.bedroom' 'state_changed' event: '{'min_mireds': 111, 'max_mireds': 666, 'effect_list': ['effect_colorloop', 'effect_pulse', 'effect_stop'], 'supported_color_modes': ['color_temp', 'hs'], 'color_mode': 'color_temp', 'brightness': 143, 'color_temp': 666, 'hs_color': (25.487, 100.0), 'rgb_color': (255, 108, 0), 'xy_color': (0.635, 0.355), 'friendly_name': 'Bedroom', 'supported_features': 55}' with context.id='1fe7e4998a0dbba20ec9f418875969a8'
2021-10-02 19:41:37 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.bedroom' 'state_changed' event: '{'min_mireds': 111, 'max_mireds': 666, 'effect_list': ['effect_colorloop', 'effect_pulse', 'effect_stop'], 'supported_color_modes': ['color_temp', 'hs'], 'color_mode': 'color_temp', 'brightness': 123, 'color_temp': 666, 'hs_color': (25.487, 100.0), 'rgb_color': (255, 108, 0), 'xy_color': (0.635, 0.355), 'friendly_name': 'Bedroom', 'supported_features': 55}' with context.id='dd45402530b450f0c2179f3563843c16'
2021-10-02 19:41:47 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.bedroom' 'state_changed' event: '{'min_mireds': 111, 'max_mireds': 666, 'effect_list': ['effect_colorloop', 'effect_pulse', 'effect_stop'], 'supported_color_modes': ['color_temp', 'hs'], 'color_mode': 'color_temp', 'brightness': 103, 'color_temp': 666, 'hs_color': (25.487, 100.0), 'rgb_color': (255, 108, 0), 'xy_color': (0.635, 0.355), 'friendly_name': 'Bedroom', 'supported_features': 55}' with context.id='007e8307c9dadad12b5326cdbe00fdfa'
2021-10-02 19:41:56 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] All lights default: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt_860c_interval_2'
2021-10-02 19:41:56 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: All lights default: '_adapt_lights(['light.bedroom'], None, force=False, context.id=adapt_lgt_860c_interval_2)' called
2021-10-02 19:41:56 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] All lights default: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.bedroom', 'transition': 45.0, 'brightness': 181, 'color_temp': 666} with context.id='adapt_lgt_860c_interval_2'
2021-10-02 19:41:56 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.bedroom']')' event with context.id='adapt_lgt_860c_interval_2'
2021-10-02 19:41:57 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.bedroom' 'state_changed' event: '{'min_mireds': 111, 'max_mireds': 666, 'effect_list': ['effect_colorloop', 'effect_pulse', 'effect_stop'], 'supported_color_modes': ['color_temp', 'hs'], 'color_mode': 'color_temp', 'brightness': 183, 'color_temp': 666, 'hs_color': (25.487, 100.0), 'rgb_color': (255, 108, 0), 'xy_color': (0.635, 0.355), 'friendly_name': 'Bedroom', 'supported_features': 55}' with context.id='adapt_lgt_860c_interval_2'
Setting manual control first:
service: adaptive_lighting.set_manual_control
data:
entity_id: switch.adaptive_lighting_all_lights_default
lights: light.bedroom
service: light.turn_off
data:
transition: 90
target:
entity_id: light.bedroom
2021-10-02 19:52:48 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Called 'adaptive_lighting.set_manual_control' service with '{'entity_id': ['switch.adaptive_lighting_all_lights_default'], 'lights': ['light.bedroom'], 'manual_control': True}'
2021-10-02 19:52:48 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] 'adaptive_lighting.manual_control' event fired for switch.adaptive_lighting_all_lights_default for light light.bedroom
2021-10-02 19:53:08 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.bedroom' 'state_changed' event: '{'min_mireds': 111, 'max_mireds': 666, 'effect_list': ['effect_colorloop', 'effect_pulse', 'effect_stop'], 'supported_color_modes': ['color_temp', 'hs'], 'color_mode': 'color_temp', 'brightness': 169, 'color_temp': 666, 'hs_color': (25.487, 100.0), 'rgb_color': (255, 108, 0), 'xy_color': (0.635, 0.355), 'friendly_name': 'Bedroom', 'supported_features': 55}' with context.id='1cffb7d6e7ad6ca35828e4ceea23be53'
2021-10-02 19:53:56 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] All lights default: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt_860c_interval_10'
2021-10-02 19:53:56 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: All lights default: '_adapt_lights(['light.bedroom'], None, force=False, context.id=adapt_lgt_860c_interval_10)' called
2021-10-02 19:53:56 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] All lights default: 'light.bedroom' is being manually controlled, stop adapting, context.id=adapt_lgt_860c_interval_10.
2021-10-02 19:54:48 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_off('['light.bedroom']', transition=90)' event with context.id='f9df7673a8cb3ec1fe431ba6fee1d655'
2021-10-02 19:54:58 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.bedroom' 'state_changed' event: '{'min_mireds': 111, 'max_mireds': 666, 'effect_list': ['effect_colorloop', 'effect_pulse', 'effect_stop'], 'supported_color_modes': ['color_temp', 'hs'], 'color_mode': 'color_temp', 'brightness': 152, 'color_temp': 666, 'hs_color': (25.487, 100.0), 'rgb_color': (255, 108, 0), 'xy_color': (0.635, 0.355), 'friendly_name': 'Bedroom', 'supported_features': 55}' with context.id='106a7b08aa82f693d4cf3583639a609c'
2021-10-02 19:55:08 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.bedroom' 'state_changed' event: '{'min_mireds': 111, 'max_mireds': 666, 'effect_list': ['effect_colorloop', 'effect_pulse', 'effect_stop'], 'supported_color_modes': ['color_temp', 'hs'], 'color_mode': 'color_temp', 'brightness': 133, 'color_temp': 666, 'hs_color': (25.487, 100.0), 'rgb_color': (255, 108, 0), 'xy_color': (0.635, 0.355), 'friendly_name': 'Bedroom', 'supported_features': 55}' with context.id='7f431d787dbc0746bf8381bd906f8737'
2021-10-02 19:55:18 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.bedroom' 'state_changed' event: '{'min_mireds': 111, 'max_mireds': 666, 'effect_list': ['effect_colorloop', 'effect_pulse', 'effect_stop'], 'supported_color_modes': ['color_temp', 'hs'], 'color_mode': 'color_temp', 'brightness': 114, 'color_temp': 666, 'hs_color': (25.487, 100.0), 'rgb_color': (255, 108, 0), 'xy_color': (0.635, 0.355), 'friendly_name': 'Bedroom', 'supported_features': 55}' with context.id='e3227f41b036ff8ed96daa59431c99ce'
2021-10-02 19:55:26 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] All lights default: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt_860c_interval_11'
2021-10-02 19:55:26 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: All lights default: '_adapt_lights(['light.bedroom'], None, force=False, context.id=adapt_lgt_860c_interval_11)' called
2021-10-02 19:55:26 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] All lights default: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.bedroom', 'transition': 45.0, 'brightness': 166, 'color_temp': 666} with context.id='adapt_lgt_860c_interval_11'
2021-10-02 19:55:26 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.bedroom']')' event with context.id='adapt_lgt_860c_interval_11'
2021-10-02 19:55:27 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.bedroom' 'state_changed' event: '{'min_mireds': 111, 'max_mireds': 666, 'effect_list': ['effect_colorloop', 'effect_pulse', 'effect_stop'], 'supported_color_modes': ['color_temp', 'hs'], 'color_mode': 'color_temp', 'brightness': 169, 'color_temp': 666, 'hs_color': (25.487, 100.0), 'rgb_color': (255, 108, 0), 'xy_color': (0.635, 0.355), 'friendly_name': 'Bedroom', 'supported_features': 55}' with context.id='adapt_lgt_860c_interval_11'
2021-10-02 19:55:38 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.bedroom' 'state_changed' event: '{'min_mireds': 111, 'max_mireds': 666, 'effect_list': ['effect_colorloop', 'effect_pulse', 'effect_stop'], 'supported_color_modes': ['color_temp', 'hs'], 'color_mode': 'color_temp', 'brightness': 168, 'color_temp': 666, 'hs_color': (25.487, 100.0), 'rgb_color': (255, 108, 0), 'xy_color': (0.635, 0.355), 'friendly_name': 'Bedroom', 'supported_features': 55}' with context.id='f2b2c7b3bb99d709e24dff962f0c7002'
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
ZHA Light Transition to Off not working · Issue #17040 - GitHub
I am using various Philips Hue lights. Using the ZHA Component, the lights just turn off with about a 0.5 second fade out,...
Read more >Help needed with light transition - Home Assistant Community
I want to emulate sunrise to sunset on my fish tank, so slowly increasing then decreasing light levels throughout a 10 hour period....
Read more >Need Global Illumination to turn off when using "transition to ...
Problem is with the transition between the two. For daytime, you have to use Global Illumination/multiple huge-range-bright-light sources. For ...
Read more >How to Transition Into Different Lighted Situations
Wearing sunglasses when you're outside. The longer you're exposed to bright light, the longer it will take for your eyes to adjust to...
Read more >Transition gets cancelled when lights turn on - Using LIFX
I'm using long transition times (> 1 h) to change the color and brightness of my lights at the sunrise/sunset so this is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Since the title is “Cannot turn off lights with long transition”, I do not see setting transition to 0s as a solution. Surely it would turn off the lights, but I think that you should have the ability to turn off lights with arbitrary long transitions. Especially if you have taken manual control over the lights first.
Hey @OEHC @psbankar @ivlis @kgroshert,
this is now part of the Roadmap for Version 2.
Feel free to vote on the point which will fix this:
https://github.com/basnijholt/adaptive-lighting/discussions/291#discussioncomment-2886261