basnijholt / adaptive-lighting

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

light.turn_on and light.toggle services impacted by update #638

Closed StumblingGamer closed 1 year ago

StumblingGamer commented 1 year ago

Home Assistant Adaptive Lighting Issue Template

Bug Reports

If you need help with using or configuring Adaptive Lighting, please open a Q&A discussion thread here instead.

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

Please confirm that you have completed the following steps:

Required information for bug reports:

Please include the following information in your issue.

Issues missing this information may not be addressed.

  1. Debug logs captured while the issue occurred. See here for instructions on enabling debug logging:
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/adaptive_lighting/switch.py:327
Integration: Home Assistant WebSocket API ([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 1:09:33 PM (12 occurrences)
Last logged: 1:38:14 PM

[140634344999312] find_switch_for_lights: Light(s) ['light.table'] not found in any switch's configuration. You must either include the light(s) that is/are in the integration config, or pass a switch under 'entity_id'.
[140634344999312] find_switch_for_lights: Light(s) ['light.family_room_ceiling'] not found in any switch's configuration. You must either include the light(s) that is/are in the integration config, or pass a switch under 'entity_id'.
[140633627447376] find_switch_for_lights: Light(s) ['light.family_room_ceiling'] not found in any switch's configuration. You must either include the light(s) that is/are in the integration config, or pass a switch under 'entity_id'.
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 205, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1965, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2005, in _execute_service
    return await cast(
           ^^^^^^^^^^^
  File "/config/custom_components/adaptive_lighting/hass_utils.py", line 46, in service_func_proxy
    await intercept_func(call, data)
  File "/config/custom_components/adaptive_lighting/switch.py", line 1843, in _service_interceptor_turn_on_handler
    adaptive_switch = find_switch_for_lights(self.hass, [entity_id])
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/adaptive_lighting/switch.py", line 327, in find_switch_for_lights
    raise ValueError(
ValueError: find_switch_for_lights: Light(s) ['light.table'] not found in any switch's configuration. You must either include the light(s) that is/are in the integration config, or pass a switch under 'entity_id'.
  1. Your Adaptive Lighting configuration:
I used Front End to configure... not sure how to get the config.  I am willing to get it, just need to know how.
  1. (If using Zigbee2MQTT), provide your configuration files (remove all personal information before posting):

    • devices.yaml
    • groups.yaml
    • configuration.yaml ⚠️; Warning REMOVE ALL of the PERSONAL INFORMATION BELOW before posting ⚠️;
      • mqtt: server:
      • mqtt: user:
      • mqtt: password:
      • advanced: pan_id:
      • advanced: network_key:
      • anything in log_syslog if you use this
    • Brand and model number of problematic light(s)
      problem persists against all light devices zwave and zigbee and wifi...   I have already confirmed this isn't related to those services.
  2. Describe the bug and how to reproduce it: Likely the cause: https://github.com/basnijholt/adaptive-lighting/pull/628 When attempting to call light.turn_on or light.toggle on any light that is not configured in Adaptive Lighting, an error is generated and light control is not possible.

  3. Steps to reproduce the behavior: Call light.toggle or light.turn_on service on ANY light entity that is NOT configured with Adaptive Lighting.

ghost commented 1 year ago

+1 All not in AL integrated lights (e.g. switches converted to lights) cannot be turned on with version 1.15.1. 1.15.0 is working, so commit 1133f0d seems to be the culprit.

basnijholt commented 1 year ago

@StumblingGamer, @Eyco1981, thanks a lot for reporting. I understand what the problem is.

We don't have tests for managing lights that are not managed by AL so I didn't catch this one.

I opened https://github.com/basnijholt/adaptive-lighting/pull/639 which should fix this. I will release 1.15.2 promptly.

basnijholt commented 1 year ago

I have just released https://github.com/basnijholt/adaptive-lighting/releases/tag/1.15.2, let me know whether it works now.

ghost commented 1 year ago

Seems to be working again

basnijholt commented 1 year ago

Great, thanks for reporting back! 😄

StumblingGamer commented 1 year ago

Great, thanks for reporting back! 😄

Thanks for your quick response to this! Much appreciated.

Keep up the good work! My wife and I love the integration and what it does for the ambiance of the house. 🤘😁