basnijholt / adaptive-lighting

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

Lights turning on after turning off (reported by @robmarshall2) #726

Closed basnijholt closed 1 year ago

basnijholt commented 1 year ago

Reported here https://github.com/basnijholt/adaptive-lighting/issues/85#issuecomment-1669932313 by @robmarshall2

basnijholt commented 1 year ago

So the light is on. Then a turn_off is called:

2023-08-08 17:15:48.730 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_off('['light.ikea_of_sweden_tradfribulbgu10ws345lm_light', 'light.ikea_of_sweden_tradfribulbgu10ws345lm_light_2', 'light.ikea_of_sweden_tradfribulbgu10ws345lm_light_3']', transition=None)' event with context.id='01H7AYXQFCPVSXSP9BD0EAEFE5'

then before registering an on -> off it has an interval update

2023-08-08 17:15:48.935 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Dining Room : Calling _adapt_light from _update_attrs_and_maybe_adapt_lights: 'light.ikea_of_sweden_tradfribulbgu10ws345lm_light_3' with transition 45.0 and context.id=01H7AYXPJB:al:IRUW:ntrv:46

Note that for the other lights (e.g., light2) there is this just before that.

2023-08-08 17:15:48.933 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'on' → 'off' event for 'light.ikea_of_sweden_tradfribulbgu10ws345lm_light_2' with context.id='01H7AYXPJB:al:IRUW:ntrv:46'

The interval results in a turn_on:

2023-08-08 17:15:48.936 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Dining Room : Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.ikea_of_sweden_tradfribulbgu10ws345lm_light_3', 'brightness': 255, 'transition': 22.5} with context.id='01H7AYXPJB:al:IRUW:ntrv:46'

but then with the same context it gets this? ¯_(ツ)_/¯

2023-08-08 17:15:48.974 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'on' → 'off' event for 'light.ikea_of_sweden_tradfribulbgu10ws345lm_light_3' with context.id='01H7AYXPJB:al:IRUW:ntrv:46'

then the error happens:

2023-08-08 17:15:50.194 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.ikea_of_sweden_tradfribulbgu10ws345lm_light_3' 'state_changed' event: '{'min_color_temp_kelvin': 2202, 'max_color_temp_kelvin': 4000, 'min_mireds': 250, 'max_mireds': 454, 'supported_color_modes': [<ColorMode.COLOR_TEMP: 'color_temp'>], 'color_mode': <ColorMode.COLOR_TEMP: 'color_temp'>, 'brightness': 254, 'color_temp_kelvin': 3802, 'color_temp': 263, 'hs_color': (26.923, 38.579), 'rgb_color': (255, 200, 156), 'xy_color': (0.433, 0.368), 'off_with_transition': False, 'off_brightness': None, 'friendly_name': 'IKEA of Sweden TRADFRIbulbGU10WS345lm Light', 'supported_features': <LightEntityFeature.FLASH|TRANSITION: 40>}' with context.id='01H7AYXPJB:al:IRUW:ntrv:46'
2023-08-08 17:15:50.194 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] AdaptiveLightingManager: New adapt '<state light.ikea_of_sweden_tradfribulbgu10ws345lm_light_3=on; min_color_temp_kelvin=2202, max_color_temp_kelvin=4000, min_mireds=250, max_mireds=454, supported_color_modes=[<ColorMode.COLOR_TEMP: 'color_temp'>], color_mode=color_temp, brightness=254, color_temp_kelvin=3802, color_temp=263, hs_color=(26.923, 38.579), rgb_color=(255, 200, 156), xy_color=(0.433, 0.368), off_with_transition=False, off_brightness=None, friendly_name=IKEA of Sweden TRADFRIbulbGU10WS345lm Light, supported_features=40 @ 2023-08-08T17:15:50.193494+01:00>' found for light.ikea_of_sweden_tradfribulbgu10ws345lm_light_3
2023-08-08 17:15:50.196 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/adaptive_lighting/switch.py", line 2354, in state_changed_event_listener
    self.start_transition_timer(entity_id)
  File "/config/custom_components/adaptive_lighting/switch.py", line 2095, in start_transition_timer
    last_service_data = self.last_service_data[light]
                        ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
KeyError: 'light.ikea_of_sweden_tradfribulbgu10ws345lm_light_3'

What is completely unexpected to me is what happens at 2023-08-08 17:15:48.974.

I will investigate more later.

broyuken commented 1 year ago

I had some lights do that overnight as well last night. And I have detect non ha changes off.

basnijholt commented 1 year ago

Oh, I realized that I fixed this in already in the latest betas (https://github.com/basnijholt/adaptive-lighting/issues/679).

@broyuken and @robmarshall2 are you both using 1.18.0 perhaps?

basnijholt commented 1 year ago

I noticed one light turning on too immediately after turning off. However, it is not accompanied by an exception like for Rob.

2023-08-09 01:09:04.760 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_off('['light.baby_room']', transition=1)' event with context.id='01H7CNF6Z67ZBW0ASS4JSN32A7'
2023-08-09 01:09:04.907 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Bedroom: '_update_attrs_and_maybe_adapt_lights' called with context.id='01H7CNF74B:al:IJSW:ntrv:15' lights: 'None', transition: '45.0', force: 'False'
2023-08-09 01:09:04.912 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Bedroom: filtered_lights: '['light.baby_room', 'light.bamboo', 'light.philips_go']'
2023-08-09 01:09:04.919 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] is_proactively_adapting_context='False', context_id='01H7CNE9B6:al:IJSW:ntrv:14'
2023-08-09 01:09:04.919 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Bedroom: Calling _adapt_light from _update_attrs_and_maybe_adapt_lights: 'light.baby_room' with transition 45.0 and context.id=01H7CNF74B:al:IJSW:ntrv:15
2023-08-09 01:09:04.919 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Bedroom: 'light.bamboo' is being manually controlled, stop adapting, context.id=01H7CNF74B:al:IJSW:ntrv:15.
2023-08-09 01:09:04.919 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Bedroom: 'light.philips_go' is being manually controlled, stop adapting, context.id=01H7CNF74B:al:IJSW:ntrv:15.
2023-08-09 01:09:04.938 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Bedroom: Setting color_temp of light light.baby_room
2023-08-09 01:09:04.938 DEBUG (MainThread) [custom_components.adaptive_lighting.adaptation_utils] Preparing adaptation data for light.baby_room with service data {'entity_id': 'light.baby_room', 'transition': 45.0, 'brightness': 179, 'color_temp_kelvin': 2202}
2023-08-09 01:09:04.939 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Bedroom: execute_cancellable_adaptation_calls with data: AdaptationData(entity_id=light.baby_room, context_id=01H7CNF74B:al:IJSW:ntrv:15, sleep_time=45.0, force=False, max_length=1, which=both, initial_sleep=False)
2023-08-09 01:09:04.943 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Bedroom: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.baby_room', 'transition': 45.0, 'brightness': 179, 'color_temp_kelvin': 2202} with context.id='01H7CNF74B:al:IJSW:ntrv:15'
2023-08-09 01:09:04.944 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.baby_room']')' event with context.id='01H7CNF74B:al:IJSW:ntrv:15'
2023-08-09 01:09:04.945 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] (0) _service_interceptor_turn_on_handler: call.context.id='01H7CNF74B:al:IJSW:ntrv:15', is_skipped_hash='False'
2023-08-09 01:09:04.958 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Bedroom LED: '_update_attrs_and_maybe_adapt_lights' called with context.id='01H7CNF75X:al:IJSW:ntrv:0W' lights: 'None', transition: '45.0', force: 'False'
2023-08-09 01:09:04.962 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Bedroom LED: filtered_lights: '['light.bed_led']'
2023-08-09 01:09:04.963 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Bedroom LED: 'light.bed_led' is being manually controlled, stop adapting, context.id=01H7CNF75X:al:IJSW:ntrv:0W.
2023-08-09 01:09:04.966 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'on' → 'off' event for 'light.baby_room' with context.id='01H7CNF74B:al:IJSW:ntrv:15'
2023-08-09 01:09:05.206 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.baby_room' 'state_changed' event: '{'min_color_temp_kelvin': 2202, 'max_color_temp_kelvin': 4000, 'min_mireds': 250, 'max_mireds': 454, 'effect_list': ['blink', 'breathe', 'okay', 'channel_change', 'finish_effect', 'stop_effect'], 'supported_color_modes': ['color_temp'], 'color_mode': <ColorMode.COLOR_TEMP: 'color_temp'>, 'brightness': 178, 'color_temp_kelvin': 2202, 'color_temp': 454, 'hs_color': (29.79, 84.553), 'rgb_color': (255, 146, 39), 'xy_color': (0.579, 0.388), 'friendly_name': 'Baby room', 'supported_features': <LightEntityFeature.EFFECT|FLASH|TRANSITION: 44>}' with context.id='01H7CNF74B:al:IJSW:ntrv:15'
2023-08-09 01:09:05.206 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] AdaptiveLightingManager: New adapt '<state light.baby_room=on; min_color_temp_kelvin=2202, max_color_temp_kelvin=4000, min_mireds=250, max_mireds=454, effect_list=['blink', 'breathe', 'okay', 'channel_change', 'finish_effect', 'stop_effect'], supported_color_modes=['color_temp'], color_mode=color_temp, brightness=178, color_temp_kelvin=2202, color_temp=454, hs_color=(29.79, 84.553), rgb_color=(255, 146, 39), xy_color=(0.579, 0.388), friendly_name=Baby room, supported_features=44 @ 2023-08-09T01:09:05.199475-07:00>' found for light.baby_room
2023-08-09 01:09:05.207 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] No last service data for light light.baby_room, not starting timer.
2023-08-09 01:09:05.207 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'off' → 'on' event for 'light.baby_room' with context.id='01H7CNF74B:al:IJSW:ntrv:15'
2023-08-09 01:09:05.207 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] is_proactively_adapting_context='False', context_id='01H7CNF74B:al:IJSW:ntrv:15'
2023-08-09 01:09:05.207 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] just_turned_off: 'on' → 'off' state change has the same context.id as the 'off' → 'on' state change for 'light.baby_room'. This is probably a false positive.
2023-08-09 01:09:05.208 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Cancelling adjusting lights for light.baby_room
basnijholt commented 1 year ago

I believe the problem is that when light.turn_off and a regular interval update are happening at the same time.

My plan to fix this: if detect_non_ha_changes: false, check whether the most recent light.turn_off has been called after light.turn_on.

broyuken commented 1 year ago

I’m on 1.18.3

basnijholt commented 1 year ago

OK thanks for letting me know.

I think I just fixed this race condition in #727.

I will release a new beta version in 2 minutes.

robmarshall2 commented 1 year ago

1.18.3 here too, I'll update to the beta and come back to you in a day or so. Appreciate the help!

basnijholt commented 1 year ago

I have just released 1.19.0 proper :tada:

Give it a try!

robmarshall2 commented 1 year ago

I spent all evening/morning turning the lights on and off and they've not skipped a beat - I'm very happy! (but my neighbours must think I'm weird) Thanks for the help :)

basnijholt commented 1 year ago

That’s great!

Haha, my neighbors must think the same! 😂

benwainwright commented 1 year ago

I'm on 1.19.1 and I still have this issue. Here are some recent logs

2023-08-20 15:36:09.507 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Transition finished for light light.living_room
2023-08-20 15:36:35.970 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Bathroom: '_update_attrs_and_maybe_adapt_lights' called with context.id='01H89P0P82:al:IJQX:ntrv:2F' lights: 'None', transition: '45.0', force: 'False'
2023-08-20 15:36:35.973 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Bathroom: filtered_lights: '['light.bedroom']'
2023-08-20 15:36:35.974 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] is_proactively_adapting_context='False', context_id='01H89NXXVY:al:IJQX:ntrv:2E'
2023-08-20 15:36:35.974 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Bathroom: Calling _adapt_light from _update_attrs_and_maybe_adapt_lights: 'light.bedroom' with transition 45.0 and context.id=01H89P0P82:al:IJQX:ntrv:2F
2023-08-20 15:36:35.990 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Bathroom: Setting color_temp of light light.bedroom
2023-08-20 15:36:35.991 DEBUG (MainThread) [custom_components.adaptive_lighting.adaptation_utils] Preparing adaptation data for light.bedroom with service data {'entity_id': 'light.bedroom', 'transition': 45.0, 'brightness': 255, 'color_temp_kelvin': 5110}
2023-08-20 15:36:35.991 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Bathroom: execute_cancellable_adaptation_calls with data: AdaptationData(entity_id=light.bedroom, context_id=01H89P0P82:al:IJQX:ntrv:2F, sleep_time=45.0, force=False, max_length=1, which=both, initial_sleep=False)
2023-08-20 15:36:35.992 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Bathroom: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.bedroom', 'transition': 45.0, 'brightness': 255, 'color_temp_kelvin': 5110} with context.id='01H89P0P82:al:IJQX:ntrv:2F'
2023-08-20 15:36:36.000 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.bedroom']')' event with context.id='01H89P0P82:al:IJQX:ntrv:2F'
2023-08-20 15:36:36.001 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] (0) _service_interceptor_turn_on_handler: call.context.id='01H89P0P82:al:IJQX:ntrv:2F', is_skipped_hash='False'
2023-08-20 15:36:36.015 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Hallway: '_update_attrs_and_maybe_adapt_lights' called with context.id='01H89P0P9F:al:JBQW:ntrv:2F' lights: 'None', transition: '45.0', force: 'False'
2023-08-20 15:36:36.018 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Hallway: Light 'light.hallway' was turned just turned off, context.id='01H89P0P9F:al:JBQW:ntrv:2F'
2023-08-20 15:36:36.018 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Hallway: filtered_lights: '[]'
2023-08-20 15:36:36.018 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Bedroom: '_update_attrs_and_maybe_adapt_lights' called with context.id='01H89P0P9J:al:IJSW:ntrv:2F' lights: 'None', transition: '45', force: 'False'
2023-08-20 15:36:36.022 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Bedroom: filtered_lights: '[]'
2023-08-20 15:36:53.693 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Living Room: '_update_attrs_and_maybe_adapt_lights' called with context.id='01H89P17HX:al:JRUX:ntrv:04' lights: 'None', transition: '45.0', force: 'False'
2023-08-20 15:36:53.707 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Living Room: filtered_lights: '['light.living_room']'
2023-08-20 15:36:53.708 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] is_proactively_adapting_context='False', context_id='01H89NYF5Q:al:JRUX:ntrv:03'
2023-08-20 15:36:53.708 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Living Room: Calling _adapt_light from _update_attrs_and_maybe_adapt_lights: 'light.living_room' with transition 45.0 and context.id=01H89P17HX:al:JRUX:ntrv:04
2023-08-20 15:36:53.719 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Living Room: Setting color_temp of light light.living_room
2023-08-20 15:36:53.719 DEBUG (MainThread) [custom_components.adaptive_lighting.adaptation_utils] Preparing adaptation data for light.living_room with service data {'entity_id': 'light.living_room', 'transition': 45.0, 'brightness': 255, 'color_temp_kelvin': 5110}
2023-08-20 15:36:53.719 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Living Room: execute_cancellable_adaptation_calls with data: AdaptationData(entity_id=light.living_room, context_id=01H89P17HX:al:JRUX:ntrv:04, sleep_time=45.0, force=False, max_length=1, which=both, initial_sleep=False)
2023-08-20 15:36:53.721 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Living Room: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.living_room', 'transition': 45.0, 'brightness': 255, 'color_temp_kelvin': 5110} with context.id='01H89P17HX:al:JRUX:ntrv:04'
2023-08-20 15:36:53.729 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.living_room']')' event with context.id='01H89P17HX:al:JRUX:ntrv:04'
2023-08-20 15:36:53.730 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] (0) _service_interceptor_turn_on_handler: call.context.id='01H89P17HX:al:JRUX:ntrv:04', is_skipped_hash='False'
2023-08-20 15:36:54.257 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.living_room' 'state_changed' event: '{'min_color_temp_kelvin': 2000, 'max_color_temp_kelvin': 6535, 'min_mireds': 153, 'max_mireds': 500, 'supported_color_modes': [<ColorMode.COLOR_TEMP: 'color_temp'>, <ColorMode.XY: 'xy'>], 'color_mode': <ColorMode.COLOR_TEMP: 'color_temp'>, 'brightness': 255, 'color_temp_kelvin': 4504, 'color_temp': 222, 'hs_color': (26.728, 26.434), 'rgb_color': (255, 217, 187), 'xy_color': (0.394, 0.357), 'is_hue_group': True, 'hue_scenes': {'Mountain Breeze', 'Nightlight', 'Bright', 'Dimmed', 'Savanna sunset'}, 'hue_type': 'room', 'lights': {'Media Cabinet Lamp', 'Hue color lamp 1', 'Hue color lamp 3', 'Bookcase Lamp', 'Floor Lamp (Bottom Bulb)', 'Floor Lamp (Middle Bulb)', 'Hue color lamp 4', 'Floor Lamp (Top Bulb)', 'Hue color spot 1', 'Hue color spot 3', 'Hue color spot 4', 'Hue color spot 2', 'Hue color lamp 2', 'Floor Lamp', 'Table Lamp'}, 'dynamics': False, 'icon': 'mdi:lightbulb-group', 'friendly_name': 'Living Room', 'supported_features': <LightEntityFeature.FLASH|TRANSITION: 40>}' with context.id='01H89P17HX:al:JRUX:ntrv:04'
2023-08-20 15:36:54.260 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] AdaptiveLightingManager: New adapt '<state light.living_room=on; min_color_temp_kelvin=2000, max_color_temp_kelvin=6535, min_mireds=153, max_mireds=500, supported_color_modes=[<ColorMode.COLOR_TEMP: 'color_temp'>, <ColorMode.XY: 'xy'>], color_mode=color_temp, brightness=255, color_temp_kelvin=4504, color_temp=222, hs_color=(26.728, 26.434), rgb_color=(255, 217, 187), xy_color=(0.394, 0.357), is_hue_group=True, hue_scenes={'Mountain Breeze', 'Nightlight', 'Bright', 'Dimmed', 'Savanna sunset'}, hue_type=room, lights={'Media Cabinet Lamp', 'Hue color lamp 1', 'Hue color lamp 3', 'Bookcase Lamp', 'Floor Lamp (Bottom Bulb)', 'Floor Lamp (Middle Bulb)', 'Hue color lamp 4', 'Floor Lamp (Top Bulb)', 'Hue color spot 1', 'Hue color spot 3', 'Hue color spot 4', 'Hue color spot 2', 'Hue color lamp 2', 'Floor Lamp', 'Table Lamp'}, dynamics=False, icon=mdi:lightbulb-group, friendly_name=Living Room, supported_features=40 @ 2023-08-20T13:51:51.519017+01:00>' found for light.living_room
2023-08-20 15:36:54.261 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Start transition timer of 45.0 seconds for light light.living_room
2023-08-20 15:36:56.193 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.living_room' 'state_changed' event: '{'min_color_temp_kelvin': 2000, 'max_color_temp_kelvin': 6535, 'min_mireds': 153, 'max_mireds': 500, 'supported_color_modes': [<ColorMode.COLOR_TEMP: 'color_temp'>, <ColorMode.XY: 'xy'>], 'color_mode': <ColorMode.COLOR_TEMP: 'color_temp'>, 'brightness': 240, 'color_temp_kelvin': 4504, 'color_temp': 222, 'hs_color': (26.728, 26.434), 'rgb_color': (255, 217, 187), 'xy_color': (0.394, 0.357), 'is_hue_group': True, 'hue_scenes': {'Mountain Breeze', 'Nightlight', 'Bright', 'Dimmed', 'Savanna sunset'}, 'hue_type': 'room', 'lights': {'Media Cabinet Lamp', 'Hue color lamp 1', 'Hue color lamp 3', 'Bookcase Lamp', 'Floor Lamp (Bottom Bulb)', 'Floor Lamp (Middle Bulb)', 'Hue color lamp 4', 'Floor Lamp (Top Bulb)', 'Hue color spot 1', 'Hue color spot 3', 'Hue color spot 4', 'Hue color spot 2', 'Hue color lamp 2', 'Floor Lamp', 'Table Lamp'}, 'dynamics': False, 'icon': 'mdi:lightbulb-group', 'friendly_name': 'Living Room', 'supported_features': <LightEntityFeature.FLASH|TRANSITION: 40>}' with context.id='01H89P17HX:al:JRUX:ntrv:04'
2023-08-20 15:36:56.194 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] AdaptiveLightingManager: State change event of 'light.living_room' is already in 'self.our_last_state_on_change' (01H89P17HX:al:JRUX:ntrv:04) adding this state also
2023-08-20 15:37:02.303 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.living_room' 'state_changed' event: '{'min_color_temp_kelvin': 2000, 'max_color_temp_kelvin': 6535, 'min_mireds': 153, 'max_mireds': 500, 'supported_color_modes': [<ColorMode.COLOR_TEMP: 'color_temp'>, <ColorMode.XY: 'xy'>], 'color_mode': <ColorMode.COLOR_TEMP: 'color_temp'>, 'brightness': 227, 'color_temp_kelvin': 4504, 'color_temp': 222, 'hs_color': (26.728, 26.434), 'rgb_color': (255, 217, 187), 'xy_color': (0.394, 0.357), 'is_hue_group': True, 'hue_scenes': {'Mountain Breeze', 'Nightlight', 'Bright', 'Dimmed', 'Savanna sunset'}, 'hue_type': 'room', 'lights': {'Media Cabinet Lamp', 'Hue color lamp 1', 'Hue color lamp 3', 'Bookcase Lamp', 'Floor Lamp (Bottom Bulb)', 'Floor Lamp (Middle Bulb)', 'Hue color lamp 4', 'Floor Lamp (Top Bulb)', 'Hue color spot 1', 'Hue color spot 3', 'Hue color spot 4', 'Hue color spot 2', 'Hue color lamp 2', 'Floor Lamp', 'Table Lamp'}, 'dynamics': False, 'icon': 'mdi:lightbulb-group', 'friendly_name': 'Living Room', 'supported_features': <LightEntityFeature.FLASH|TRANSITION: 40>}' with context.id='01H89P1FYDPNVMXHT3WFV1KMKG'
Connected
basnijholt commented 1 year ago

@benwainwright, thanks for reporting. However, I do not see a light.turn_off command in your logs. Is this incomplete?

benwainwright commented 1 year ago

Hey @basnijholt I've actually worked out what the problem was, and its not a bug.

basnijholt commented 1 year ago

I’m happy you figured it out and it was not a bug in AL 😃