Skip to content

Manual Control Not Being Declared For Various 'light.turn_on' Calls from Google Assistant and for Scenes #82

@regoras

Description

@regoras

The detection of light.turn_on calls frequently doesn't seem to get detected as something where manual control would be desired. I didn't collect logs from the scenes example, but when calling a scene on lights that are under an adaptive lighting control, my automation has to include a call for manual_control before calling the scene, otherwise the lights will not get turned on to the correct color temperature and brightness. (This portion seems to be working for now.)

Similarly, while testing the Gentle Wake feature from Google, I'm finding that if adaptive lighting is enabled on the light, nothing is recognized about the the call to make it manually controlled. Logs below:

2021-02-02 18:43:15 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.living_room_desk_light']')' event with context.id='e194f1bb3836ff2ebef91bf6d45549c1' 2021-02-02 18:43:15 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.living_room_desk_light']')' event with context.id='1a9d75b8d32324b6fd6db0e55b1c39b3' 2021-02-02 18:43:15 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.living_room_desk_light' 'state_changed' event: '{'min_mireds': 153.0, 'max_mireds': 370.0, 'effect_list': ['None', 'Random', 'Strobe', 'Throb', 'Color Cycle'], 'brightness': 3, 'color_temp': 370.0, 'hs_color': (0.0, 0.0), 'rgb_color': (255, 255, 255), 'xy_color': (0.323, 0.329), 'white_value': 255, 'effect': 'None', 'friendly_name': 'Desk Light', 'supported_features': 191, 'icon': 'mdi:desk-lamp'}' with context.id='1a9d75b8d32324b6fd6db0e55b1c39b3' 2021-02-02 18:43:15 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Office: Detected an 'off' → 'on' event for 'light.living_room_desk_light' with context.id='1a9d75b8d32324b6fd6db0e55b1c39b3' 2021-02-02 18:43:15 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Office: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt_6c3a_light_event_1' 2021-02-02 18:43:15 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Office: '_adapt_lights(['light.living_room_desk_light'], 0.25, force=True, context.id=adapt_lgt_6c3a_light_event_1)' called 2021-02-02 18:43:15 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Office: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.living_room_desk_light', 'transition': 0.25, 'brightness': 240, 'white_value': 240, 'color_temp': 370} with context.id='adapt_lgt_6c3a_light_event_1' 2021-02-02 18:43:15 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.living_room_desk_light']')' event with context.id='adapt_lgt_6c3a_light_event_1' 2021-02-02 18:43:15 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.living_room_desk_light' 'state_changed' event: '{'min_mireds': 153.0, 'max_mireds': 370.0, 'effect_list': ['None', 'Random', 'Strobe', 'Throb', 'Color Cycle'], 'brightness': 240, 'color_temp': 370.0, 'hs_color': (0.0, 0.0), 'rgb_color': (255, 255, 255), 'xy_color': (0.323, 0.329), 'white_value': 255, 'effect': 'None', 'friendly_name': 'Desk Light', 'supported_features': 191, 'icon': 'mdi:desk-lamp'}' with context.id='adapt_lgt_6c3a_light_event_1' 2021-02-02 18:43:54 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Office: '_update_attrs_and_maybe_adapt_lights' called with context.id='adapt_lgt_6c3a_interval_2' 2021-02-02 18:43:54 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Office: '_adapt_lights(['light.living_room_desk_light'], None, force=False, context.id=adapt_lgt_6c3a_interval_2)' called 2021-02-02 18:43:54 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] State of 'light.living_room_desk_light' didn't change wrt change event nr. 0 (context.id=adapt_lgt_6c3a_interval_2) 2021-02-02 18:43:54 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Office: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.living_room_desk_light', 'transition': 30.0, 'brightness': 240, 'white_value': 240, 'color_temp': 370} with context.id='adapt_lgt_6c3a_interval_2' 2021-02-02 18:43:54 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.living_room_desk_light']')' event with context.id='adapt_lgt_6c3a_interval_2' 

From the debug logs and looking at the logs from ESPHome for the bulb, I can see that it's getting turned on at 3% brightness, but then immediately getting controlled by adaptive_lighting.

I'm not sure what the correct solution here is, maybe some sort of state check to see if the new turn_on command is substantively different than the old turn_on command, but driving me a bit nuts over here. I know the Gentle Wake feature works by itself, so maybe the janky solution is just to turn off adaptive_lighting for the appropriate lights when I would want to call Gentle Wake, but that's a bit of a moving target and doesn't really solve that the same issue occurs for a range of other light.turn_on calls (such as calling the service from an automation or from a scene).

Edit: after a quick check, I'll amend that it's when a scene is called from an automation that there are issues with detecting manual_control.

2nd edit: and of course as soon as I go actually try to get logs for the scenes issue, it stops reproducing.

Notes: I do have take_over_control and detect_non_ha_changes enabled. Separate commands is disabled.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions