basnijholt / adaptive-lighting

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

New Zigbee light added: Both Zigbee lights have different brightnesses #741

Closed danielbrunt57 closed 1 year ago

danielbrunt57 commented 1 year ago

Before submitting a bug report, please follow these troubleshooting steps:

Please confirm that you have completed the following steps:

  1. Debug logs
    2023-08-10 22:13:52.869 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: '_update_attrs_and_maybe_adapt_lights' called with context.id='01H7HG7VF5:al:KBQX:ntrv:0J' lights: 'None', transition: '10.0', force: 'False'
    2023-08-10 22:13:52.874 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: filtered_lights: '['light.patio_lighting', 'light.patio_stair_lighting']'
    2023-08-10 22:13:52.874 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] is_proactively_adapting_context='False', context_id='01H7HFYP08:al:KBQX:ntrv:0I'
    2023-08-10 22:13:52.874 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: Calling _adapt_light from _update_attrs_and_maybe_adapt_lights: 'light.patio_lighting' with transition 10.0 and context.id=01H7HG7VF5:al:KBQX:ntrv:0J
    2023-08-10 22:13:52.875 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] is_proactively_adapting_context='False', context_id='01H7HFNGHH:al:KBQX:ntrv:0H'
    2023-08-10 22:13:52.876 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: Calling _adapt_light from _update_attrs_and_maybe_adapt_lights: 'light.patio_stair_lighting' with transition 10.0 and context.id=01H7HG7VF5:al:KBQX:ntrv:0J
    2023-08-10 22:13:52.887 DEBUG (MainThread) [custom_components.adaptive_lighting.adaptation_utils] Preparing adaptation data for light.patio_lighting with service data {'entity_id': 'light.patio_lighting', 'transition': 10.0, 'brightness': 27}
    2023-08-10 22:13:52.887 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: execute_cancellable_adaptation_calls with data: AdaptationData(entity_id=light.patio_lighting, context_id=01H7HG7VF5:al:KBQX:ntrv:0J, sleep_time=10.0, force=False, max_length=1, which=brightness, initial_sleep=False)
    2023-08-10 22:13:52.888 DEBUG (MainThread) [custom_components.adaptive_lighting.adaptation_utils] Preparing adaptation data for light.patio_stair_lighting with service data {'entity_id': 'light.patio_stair_lighting', 'transition': 10.0, 'brightness': 27}
    2023-08-10 22:13:52.889 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: execute_cancellable_adaptation_calls with data: AdaptationData(entity_id=light.patio_stair_lighting, context_id=01H7HG7VF5:al:KBQX:ntrv:0J, sleep_time=10.0, force=False, max_length=1, which=brightness, initial_sleep=False)
    2023-08-10 22:13:52.889 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.patio_lighting', 'transition': 10.0, 'brightness': 27} with context.id='01H7HG7VF5:al:KBQX:ntrv:0J'
    2023-08-10 22:13:52.889 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.patio_stair_lighting', 'transition': 10.0, 'brightness': 27} with context.id='01H7HG7VF5:al:KBQX:ntrv:0J'
    2023-08-10 22:13:52.890 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.patio_lighting']')' event with context.id='01H7HG7VF5:al:KBQX:ntrv:0J'
    2023-08-10 22:13:52.890 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] (0) _service_interceptor_turn_on_handler: call.context.id='01H7HG7VF5:al:KBQX:ntrv:0J', is_skipped_hash='False'
    2023-08-10 22:13:52.891 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.patio_stair_lighting']')' event with context.id='01H7HG7VF5:al:KBQX:ntrv:0J'
    2023-08-10 22:13:52.891 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] (0) _service_interceptor_turn_on_handler: call.context.id='01H7HG7VF5:al:KBQX:ntrv:0J', is_skipped_hash='False'
    2023-08-10 22:13:53.042 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.patio_stair_lighting' 'state_changed' event: '{'effect_list': ['blink', 'breathe', 'okay', 'channel_change', 'finish_effect', 'stop_effect'], 'supported_color_modes': [<ColorMode.BRIGHTNESS: 'brightness'>], 'color_mode': <ColorMode.BRIGHTNESS: 'brightness'>, 'brightness': 27, 'do_not_disturb': None, 'linkquality': 58, 'friendly_name': 'Stair Lighting', 'supported_features': <LightEntityFeature.EFFECT|FLASH|TRANSITION: 44>}' with context.id='01H7HG7VF5:al:KBQX:ntrv:0J'
    2023-08-10 22:13:53.042 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] AdaptiveLightingManager: New adapt '<state light.patio_stair_lighting=on; effect_list=['blink', 'breathe', 'okay', 'channel_change', 'finish_effect', 'stop_effect'], supported_color_modes=[<ColorMode.BRIGHTNESS: 'brightness'>], color_mode=brightness, brightness=27, do_not_disturb=None, linkquality=58, friendly_name=Stair Lighting, supported_features=44 @ 2023-08-10T20:54:27.828281-07:00>' found for light.patio_stair_lighting
    2023-08-10 22:13:53.049 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Start transition timer of 10.0 seconds for light light.patio_stair_lighting
    2023-08-10 22:14:03.055 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Transition finished for light light.patio_stair_lighting
    2023-08-10 22:17:35.141 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'on' → 'off' event for 'light.patio_stair_lighting' with context.id='01H7HGEMEEJ7PCWM6J9Q9S9WP7'
    _service_interceptor_turn_on_handler: switch_to_eids='{'Adaptive Lighting: Patio Lights': ['light.patio_stair_lighting']}', skipped='[]'
    2023-08-10 22:17:37.552 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] (3) _service_interceptor_turn_on_handler: intercepting entity_ids='['light.patio_stair_lighting']'
    2023-08-10 22:17:37.552 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Intercepted TURN_ON call with data {'params': {}, 'entity_id': ['light.patio_stair_lighting']} (01H7HGEPWGTW5T7VEGGNY6G66V)
    2023-08-10 22:17:37.554 DEBUG (MainThread) [custom_components.adaptive_lighting.adaptation_utils] Preparing adaptation data for light.patio_stair_lighting with service data {'entity_id': 'light.patio_stair_lighting', 'transition': 10.0, 'brightness': 27}
    2023-08-10 22:17:37.554 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.patio_stair_lighting']')' event with context.id='01H7HGEPWGTW5T7VEGGNY6G66V'
    2023-08-10 22:17:37.554 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: execute_cancellable_adaptation_calls with data: AdaptationData(entity_id=light.patio_stair_lighting, context_id=01H7HGEPWJ:al:KBQX:dpt_:0K, sleep_time=10.0, force=False, max_length=1, which=brightness, initial_sleep=True)
    2023-08-10 22:17:37.638 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.patio_stair_lighting' 'state_changed' event: '{'effect_list': ['blink', 'breathe', 'okay', 'channel_change', 'finish_effect', 'stop_effect'], 'supported_color_modes': [<ColorMode.BRIGHTNESS: 'brightness'>], 'color_mode': <ColorMode.BRIGHTNESS: 'brightness'>, 'brightness': 27, 'do_not_disturb': None, 'linkquality': 47, 'friendly_name': 'Stair Lighting', 'supported_features': <LightEntityFeature.EFFECT|FLASH|TRANSITION: 44>}' with context.id='01H7HGEPWGTW5T7VEGGNY6G66V'
    2023-08-10 22:17:37.638 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'off' → 'on' event for 'light.patio_stair_lighting' with context.id='01H7HGEPWGTW5T7VEGGNY6G66V'
    2023-08-10 22:17:37.638 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] is_proactively_adapting_context='True', context_id='01H7HGEPWGTW5T7VEGGNY6G66V'
    2023-08-10 22:17:37.638 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Skipping responding to 'off' → 'on' event for 'light.patio_stair_lighting' with context.id='01H7HGEPWGTW5T7VEGGNY6G66V' because we are already proactively adapting
    2023-08-10 22:17:39.247 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] (0) _service_interceptor_turn_on_handler: call.context.id='01H7HGERHF1TEGYCHQA6PSRHNM', is_skipped_hash='False'
    2023-08-10 22:17:39.248 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] (1) _service_interceptor_turn_on_handler: call='<ServiceCall light.turn_on (c:01H7HGERHF1TEGYCHQA6PSRHNM): entity_id=['light.patio_lighting'], params=>', data='{'entity_id': ['light.patio_lighting'], 'params': {}}'
    2023-08-10 22:17:39.248 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] (2) _service_interceptor_turn_on_handler: switch_to_eids='{'Adaptive Lighting: Patio Lights': ['light.patio_lighting']}', skipped='[]'
    2023-08-10 22:17:39.249 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] (3) _service_interceptor_turn_on_handler: intercepting entity_ids='['light.patio_lighting']'
    2023-08-10 22:17:39.249 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Intercepted TURN_ON call with data {'params': {}, 'entity_id': ['light.patio_lighting']} (01H7HGERHF1TEGYCHQA6PSRHNM)
    2023-08-10 22:17:39.252 DEBUG (MainThread) [custom_components.adaptive_lighting.adaptation_utils] Preparing adaptation data for light.patio_lighting with service data {'entity_id': 'light.patio_lighting', 'transition': 10.0, 'brightness': 27}
    2023-08-10 22:17:39.254 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.patio_lighting']')' event with context.id='01H7HGERHF1TEGYCHQA6PSRHNM'
    2023-08-10 22:17:39.254 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: execute_cancellable_adaptation_calls with data: AdaptationData(entity_id=light.patio_lighting, context_id=01H7HGERHM:al:KBQX:dpt_:0L, sleep_time=10.0, force=False, max_length=1, which=brightness, initial_sleep=True)
    2023-08-10 22:17:39.411 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.patio_lighting' 'state_changed' event: '{'supported_color_modes': [<ColorMode.BRIGHTNESS: 'brightness'>], 'color_mode': <ColorMode.BRIGHTNESS: 'brightness'>, 'brightness': 64, 'countdown': None, 'light_type': 'led', 'linkquality': 58, 'min_brightness': 1, 'power_on_behavior': None, 'friendly_name': 'Main Light', 'supported_features': <LightEntityFeature.FLASH|TRANSITION: 40>}' with context.id='01H7HGERHF1TEGYCHQA6PSRHNM'
    2023-08-10 22:17:39.411 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'off' → 'on' event for 'light.patio_lighting' with context.id='01H7HGERHF1TEGYCHQA6PSRHNM'
    2023-08-10 22:17:39.411 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] is_proactively_adapting_context='True', context_id='01H7HGERHF1TEGYCHQA6PSRHNM'
    2023-08-10 22:17:39.411 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Skipping responding to 'off' → 'on' event for 'light.patio_lighting' with context.id='01H7HGERHF1TEGYCHQA6PSRHNM' because we are already proactively adapting
    2023-08-10 22:17:41.717 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_off('['light.patio_stair_lighting']', transition=None)' event with context.id='01H7HGETYMNMYEFBXKDJT996ZM'
    2023-08-10 22:17:41.717 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Cancelled ongoing brightness adaptation calls (<Task pending name='Task-1508722' coro=<AdaptiveSwitch._execute_adaptation_calls() running at /config/custom_components/adaptive_lighting/switch.py:1262> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[Task.task_wakeup()]>) for 'light.patio_stair_lighting'
    2023-08-10 22:17:41.717 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: Ongoing adaptation of light.patio_stair_lighting cancelled, with AdaptationData: AdaptationData(entity_id=light.patio_stair_lighting, context_id=01H7HGEPWJ:al:KBQX:dpt_:0K, sleep_time=10.0, force=False, max_length=1, which=brightness, initial_sleep=True)
    2023-08-10 22:17:41.799 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'on' → 'off' event for 'light.patio_stair_lighting' with context.id='01H7HGETYMNMYEFBXKDJT996ZM'
    2023-08-10 22:17:42.840 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_off('['light.patio_lighting']', transition=None)' event with context.id='01H7HGEW1QJDH3V5KD8Z3XHRKE'
    2023-08-10 22:17:42.840 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Cancelled ongoing brightness adaptation calls (<Task pending name='Task-1508732' coro=<AdaptiveSwitch._execute_adaptation_calls() running at /config/custom_components/adaptive_lighting/switch.py:1262> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[Task.task_wakeup()]>) for 'light.patio_lighting'
    2023-08-10 22:17:42.840 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: Ongoing adaptation of light.patio_lighting cancelled, with AdaptationData: AdaptationData(entity_id=light.patio_lighting, context_id=01H7HGERHM:al:KBQX:dpt_:0L, sleep_time=10.0, force=False, max_length=1, which=brightness, initial_sleep=True)
    2023-08-10 22:17:42.876 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'on' → 'off' event for 'light.patio_lighting' with context.id='01H7HGEW1QJDH3V5KD8Z3XHRKE'
    2023-08-10 22:17:45.353 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] (0) _service_interceptor_turn_on_handler: call.context.id='01H7HGEYG9WR8M4ED97G5JBNA1', is_skipped_hash='False'
    2023-08-10 22:17:45.354 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] (1) _service_interceptor_turn_on_handler: call='<ServiceCall light.turn_on (c:01H7HGEYG9WR8M4ED97G5JBNA1): entity_id=['light.patio_lighting'], params=>', data='{'entity_id': ['light.patio_lighting'], 'params': {}}'
    2023-08-10 22:17:45.354 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] (2) _service_interceptor_turn_on_handler: switch_to_eids='{'Adaptive Lighting: Patio Lights': ['light.patio_lighting']}', skipped='[]'
    2023-08-10 22:17:45.354 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] (3) _service_interceptor_turn_on_handler: intercepting entity_ids='['light.patio_lighting']'
    2023-08-10 22:17:45.354 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Intercepted TURN_ON call with data {'params': {}, 'entity_id': ['light.patio_lighting']} (01H7HGEYG9WR8M4ED97G5JBNA1)
    2023-08-10 22:17:45.356 DEBUG (MainThread) [custom_components.adaptive_lighting.adaptation_utils] Preparing adaptation data for light.patio_lighting with service data {'entity_id': 'light.patio_lighting', 'transition': 10.0, 'brightness': 27}
    2023-08-10 22:17:45.357 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.patio_lighting']')' event with context.id='01H7HGEYG9WR8M4ED97G5JBNA1'
    2023-08-10 22:17:45.357 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: execute_cancellable_adaptation_calls with data: AdaptationData(entity_id=light.patio_lighting, context_id=01H7HGEYGC:al:KBQX:dpt_:0M, sleep_time=10.0, force=False, max_length=1, which=brightness, initial_sleep=True)
    2023-08-10 22:17:45.515 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.patio_lighting' 'state_changed' event: '{'supported_color_modes': [<ColorMode.BRIGHTNESS: 'brightness'>], 'color_mode': <ColorMode.BRIGHTNESS: 'brightness'>, 'brightness': 64, 'countdown': None, 'light_type': 'led', 'linkquality': 58, 'min_brightness': 1, 'power_on_behavior': None, 'friendly_name': 'Main Light', 'supported_features': <LightEntityFeature.FLASH|TRANSITION: 40>}' with context.id='01H7HGEYG9WR8M4ED97G5JBNA1'
    2023-08-10 22:17:45.515 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'off' → 'on' event for 'light.patio_lighting' with context.id='01H7HGEYG9WR8M4ED97G5JBNA1'
    2023-08-10 22:17:45.515 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] is_proactively_adapting_context='True', context_id='01H7HGEYG9WR8M4ED97G5JBNA1'
    2023-08-10 22:17:45.515 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Skipping responding to 'off' → 'on' event for 'light.patio_lighting' with context.id='01H7HGEYG9WR8M4ED97G5JBNA1' because we are already proactively adapting
    2023-08-10 22:17:47.235 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] (0) _service_interceptor_turn_on_handler: call.context.id='01H7HGF0B222G6HBJ5KVGN4SQE', is_skipped_hash='False'
    2023-08-10 22:17:47.235 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] (1) _service_interceptor_turn_on_handler: call='<ServiceCall light.turn_on (c:01H7HGF0B222G6HBJ5KVGN4SQE): entity_id=['light.patio_stair_lighting'], params=>', data='{'entity_id': ['light.patio_stair_lighting'], 'params': {}}'
    2023-08-10 22:17:47.235 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] (2) _service_interceptor_turn_on_handler: switch_to_eids='{'Adaptive Lighting: Patio Lights': ['light.patio_stair_lighting']}', skipped='[]'
    2023-08-10 22:17:47.235 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] (3) _service_interceptor_turn_on_handler: intercepting entity_ids='['light.patio_stair_lighting']'
    2023-08-10 22:17:47.235 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Intercepted TURN_ON call with data {'params': {}, 'entity_id': ['light.patio_stair_lighting']} (01H7HGF0B222G6HBJ5KVGN4SQE)
    2023-08-10 22:17:47.237 DEBUG (MainThread) [custom_components.adaptive_lighting.adaptation_utils] Preparing adaptation data for light.patio_stair_lighting with service data {'entity_id': 'light.patio_stair_lighting', 'transition': 10.0, 'brightness': 27}
    2023-08-10 22:17:47.237 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.patio_stair_lighting']')' event with context.id='01H7HGF0B222G6HBJ5KVGN4SQE'
    2023-08-10 22:17:47.237 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: execute_cancellable_adaptation_calls with data: AdaptationData(entity_id=light.patio_stair_lighting, context_id=01H7HGF0B4:al:KBQX:dpt_:0N, sleep_time=10.0, force=False, max_length=1, which=brightness, initial_sleep=True)
    2023-08-10 22:17:47.322 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.patio_stair_lighting' 'state_changed' event: '{'effect_list': ['blink', 'breathe', 'okay', 'channel_change', 'finish_effect', 'stop_effect'], 'supported_color_modes': [<ColorMode.BRIGHTNESS: 'brightness'>], 'color_mode': <ColorMode.BRIGHTNESS: 'brightness'>, 'brightness': 27, 'do_not_disturb': None, 'linkquality': 58, 'friendly_name': 'Stair Lighting', 'supported_features': <LightEntityFeature.EFFECT|FLASH|TRANSITION: 44>}' with context.id='01H7HGF0B222G6HBJ5KVGN4SQE'
    2023-08-10 22:17:47.323 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'off' → 'on' event for 'light.patio_stair_lighting' with context.id='01H7HGF0B222G6HBJ5KVGN4SQE'
    2023-08-10 22:17:47.323 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] is_proactively_adapting_context='True', context_id='01H7HGF0B222G6HBJ5KVGN4SQE'
    2023-08-10 22:17:47.323 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Skipping responding to 'off' → 'on' event for 'light.patio_stair_lighting' with context.id='01H7HGF0B222G6HBJ5KVGN4SQE' because we are already proactively adapting
    2023-08-10 22:17:47.501 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Living Room Lights: '_update_attrs_and_maybe_adapt_lights' called with context.id='01H7HGF0KD:al:JRUX:ntrv:7F' lights: 'None', transition: '10.0', force: 'False'
    2023-08-10 22:18:53.370 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: '_update_attrs_and_maybe_adapt_lights' called with context.id='01H7HGH0XT:al:KBQX:ntrv:0O' lights: 'None', transition: '10.0', force: 'False'
    2023-08-10 22:18:53.372 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: filtered_lights: '['light.patio_lighting', 'light.patio_stair_lighting']'
    2023-08-10 22:18:53.372 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] is_proactively_adapting_context='True', context_id='01H7HGEYG9WR8M4ED97G5JBNA1'
    2023-08-10 22:18:53.372 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: Calling _adapt_light from _update_attrs_and_maybe_adapt_lights: 'light.patio_lighting' with transition 10.0 and context.id=01H7HGH0XT:al:KBQX:ntrv:0O
    2023-08-10 22:18:53.372 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] is_proactively_adapting_context='True', context_id='01H7HGF0B222G6HBJ5KVGN4SQE'
    2023-08-10 22:18:53.372 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: Calling _adapt_light from _update_attrs_and_maybe_adapt_lights: 'light.patio_stair_lighting' with transition 10.0 and context.id=01H7HGH0XT:al:KBQX:ntrv:0O
    2023-08-10 22:18:53.381 DEBUG (MainThread) [custom_components.adaptive_lighting.adaptation_utils] Preparing adaptation data for light.patio_lighting with service data {'entity_id': 'light.patio_lighting', 'transition': 10.0, 'brightness': 27}
    2023-08-10 22:18:53.381 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: execute_cancellable_adaptation_calls with data: AdaptationData(entity_id=light.patio_lighting, context_id=01H7HGH0XT:al:KBQX:ntrv:0O, sleep_time=10.0, force=False, max_length=1, which=brightness, initial_sleep=False)
    2023-08-10 22:18:53.382 DEBUG (MainThread) [custom_components.adaptive_lighting.adaptation_utils] Preparing adaptation data for light.patio_stair_lighting with service data {'entity_id': 'light.patio_stair_lighting', 'transition': 10.0, 'brightness': 27}
    2023-08-10 22:18:53.382 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: execute_cancellable_adaptation_calls with data: AdaptationData(entity_id=light.patio_stair_lighting, context_id=01H7HGH0XT:al:KBQX:ntrv:0O, sleep_time=10.0, force=False, max_length=1, which=brightness, initial_sleep=False)
    2023-08-10 22:18:53.383 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Patio Lights: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.patio_lighting', 'transition': 10.0, 'brightness': 27} with context.id='01H7HGH0XT:al:KBQX:ntrv:0O'
    2023-08-10 22:18:53.384 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.patio_lighting']')' event with context.id='01H7HGH0XT:al:KBQX:ntrv:0O'
    2023-08-10 22:18:53.384 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] (0) _service_interceptor_turn_on_handler: call.context.id='01H7HGH0XT:al:KBQX:ntrv:0O', is_skipped_hash='False'

    And after toggling the lights off/on one by one...

image

  1. Your Adaptive Lighting configuration:

(It would be nice if we could click an "export config button" and get a yaml equivalent of the UI config to paste in here!)

image

image

image

image

image

  1. (If using Zigbee2MQTT), provide your configuration files (remove all personal information before posting):

image

  1. Describe the bug and how to reproduce it: I've just added a new 2nd patio light via Zigbee to the patio light integration. The first one, also Zigbee, was working correctly but now with the 2nd one I noticed tonight that the 1st one came on at sunset via automation to 10% brightness (correct) but the 2nd new once came on at 37% brightness. I turned it off and back on but still cam on at 37%. I initially had enabled the multi_light_intercept and so disabled that, turned the lights off and back on one by one and they were both at 10%. Then I adjusted the brightness_mode_time_dark from 3600 to 5400 and the brightness_mode_time_light from 3600 to 900, turned them off and back on and they both came on at around 30%. It's now 10:07 pm (2-1/2h after sunset) and the original light is still at 25% and the new light is at 10%. Trying to wrap my head around what might be wrong but I can't.

image

  1. Steps to reproduce the behavior: (See the bug description)
danielbrunt57 commented 1 year ago

BTW, "Main Light" in screenshot is light.patio_lighting...

image

danielbrunt57 commented 1 year ago

I've discovered that it's the initial_transition: 10 causing the failure. If I turn the light on, it comes on at the last brightness. I set a new different brightness, turn it off, back on, and it comes on at that last brightness. If I set initial_transition: 0 then it behaves correctly, i.e. I can turn it on, adjust brightness to say 30%, turn it off then back on, and it comes on at the expected AL brightness of 10%.

Is this a Zigbee quirk??

basnijholt commented 1 year ago

Thanks a lot for reporting and providing all information so clearly! 😄

(Only quickly looking now, I have to leave)

Interestingly, it seems like AL sets them to the same brightness at least:

22:13:52.887 Preparing adaptation data for light.patio_lighting with service data {'entity_id': 'light.patio_lighting', 'transition': 10.0, 'brightness': 27}
22:13:52.888 Preparing adaptation data for light.patio_stair_lighting with service data {'entity_id': 'light.patio_stair_lighting', 'transition': 10.0, 'brightness': 27}
22:17:37.554 Preparing adaptation data for light.patio_stair_lighting with service data {'entity_id': 'light.patio_stair_lighting', 'transition': 10.0, 'brightness': 27}
22:17:39.252 Preparing adaptation data for light.patio_lighting with service data {'entity_id': 'light.patio_lighting', 'transition': 10.0, 'brightness': 27}
22:17:45.356 Preparing adaptation data for light.patio_lighting with service data {'entity_id': 'light.patio_lighting', 'transition': 10.0, 'brightness': 27}
22:17:47.237 Preparing adaptation data for light.patio_stair_lighting with service data {'entity_id': 'light.patio_stair_lighting', 'transition': 10.0, 'brightness': 27}
22:18:53.381 Preparing adaptation data for light.patio_lighting with service data {'entity_id': 'light.patio_lighting', 'transition': 10.0, 'brightness': 27}
22:18:53.382 Preparing adaptation data for light.patio_stair_lighting with service data {'entity_id': 'light.patio_stair_lighting', 'transition': 10.0, 'brightness': 27}

both at 27.

Will come back to this issue later.

danielbrunt57 commented 1 year ago

So, after a few hours of troubelshooting a failed HA update to 2023.8.2...and a little more analyzing the patio light control!... The patio lights seem to have a problem with transition, specifically the new stair lighting strip. With a transition > 0, theny do not turn on. I thought HA would handle transition if it can not hand it off to the device but apparently not. With AL initial_transition: 5 it does not even turn on after turning it off/on. The other light supports transition natively but also turns on at the last brightness, which is okay if I do not enable take_over_control, otherwise AL sees the turn on at previous brightness as a "someone else changed the brightness so I concede to their control" and does not adapt...

Shaking head, violently!!! LOL!

danielbrunt57 commented 1 year ago

image

image

image

image

danielbrunt57 commented 1 year ago

I can only imagine the complexity you have to deal with in this integration!
Far too many permutations and combinations out there!! Not to mention "user knowledge"!!!

danielbrunt57 commented 1 year ago

I'm closing this as solved... Time to enjoy my patio! 20230811_225817

(BTW, the 5m strip of stair lighting will be cut and attached under each step, but that's a project for another day!)

20230811_225753

basnijholt commented 1 year ago

That's looking very cozy! 😄

Sorry you had to go through that. Do you think there is any lesson you learned that is useful to add to the Troubleshooting section of the README?

danielbrunt57 commented 1 year ago

If a new light won't turn on with Adaptive lighting enabled and using transition, check if Home Assistant can turn on the light with transition as It may not!

  1. Check and test your device without Adaptive Lighting involved! If transition is not working it's not Adaptive Lighting's problem.
    It's could be either a device limitation &/or the integration which added it to Home Assistent.

Example: Zigbee YSR-MINI--01_dimmer (eWeLight ZB-DL01)

image

image

It has a native transition value which Zigbee2MQTT does not present to Home Assistant.

image

image

If you try and use transition: nnn in Home Assistatnt, this light will not turn on. Therefore (for now) do not use transition in either Home Assistant or Adaptive Lighting with this device!

danielbrunt57 commented 1 year ago

How's that?

I don't know if it's an HA problem or a Zigbee2MQTT problem. I will report the lack of ability to set the native transition value to Zigbee2MQTT. We'll see what unfolds!