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

Adaptive Lighting No Longer Adapts Hue 3rd Party Bulbs #692

Closed ejpenney closed 1 year ago

ejpenney commented 1 year ago

Home Assistant Adaptive Lighting Issue Template

Bug Reports

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:

home-assistant_adaptive_lighting_2023-08-01T17-09-59.450Z.log

  1. Your Adaptive Lighting configuration:
    Expand for screen shot (via UI)

image

Note I've tried both take_over_control=True and False with no success. I would think at the least having this set to False would mean AL shouldn't ever put the bulbs in manual_control...

  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)
      N/A
  2. Describe the bug and how to reproduce it:

First, I'll get this out of the way, I'm using some Gledopto bulbs connected to a Hue hub via the Hue integration. It is a known issue that these bulbs do not report their state correctly. In the past I've had Adaptive Lighting configured on a separate AL switch with detect_non_ha_changes=False, basically I want AL to blindly adapt these lights, and I have an automation monitoring better behaved bulbs that moves these to manual_control when appropriate. This has been working until the recent round of updates.

I see this in the debug log:

2023-08-01 09:47:40.132 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Kitchen Island: Ignoring 'off' → 'on' event for 'light.kitchen_island_light_1' with context.id='01H6RZZ0VW9MP5NFMPSNP6D705' because 'light.turn_on' was not called by HA and 'detect_non_ha_changes' is False

I'll note this makes no sense to me, AL detected something else changed the bulb, and since I've told it to ignore other sources of bulb changes, it's reacting to that change? In any event, based on the feedback here, I tried turning it on, and started getting these:

2023-08-01 10:09:15.067 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] color RGB of 'light.kitchen_island_light_1' significantly changed from (255, 239.4628632293509, 225.59072584373132) to (255, 59, 0) with context.id='01H6S16HNR:al:JNUX:ntrv:0H'

Which makes sense, since they report their properties incorrectly... As I said, I'd like Adaptive Lighting to blindly control these bulbs, no matter what they say their state is, change the brightness/color_temp unless I explicitly set manual_control or turn off the AL switch.

I'll also note I see these in the logs:

Detected an 'off' → 'on' event for 'light.kitchen_island_light_1' with context.id='01H6RZW8V5:al:JNUX:0slp:01' and event='<Event state_changed[L]: entity_id=light.kitchen_island_light_1, old_state=<state light.kitchen_island_light_1=off; min_color_temp_kelvin=2020, max_color_temp_kelvin=6451, min_mireds=155, max_mireds=495, supported_color_modes=[<ColorMode.COLOR_TEMP: 'color_temp'>, <ColorMode.XY: 'xy'>], mode=normal, dynamics=none, friendly_name=Kitchen Island light 1, supported_features=40 @ 2023-08-01T09:46:12.825413-07:00>, new_state=<state light.kitchen_island_light_1=on; min_color_temp_kelvin=2020, max_color_temp_kelvin=6451, min_mireds=155, max_mireds=495, supported_color_modes=[<ColorMode.COLOR_TEMP: 'color_temp'>, <ColorMode.XY: 'xy'>], color_mode=xy, brightness=255, hs_color=(13.882, 100.0), rgb_color=(255, 59, 0), xy_color=(0.682, 0.315), mode=normal, dynamics=none, friendly_name=Kitchen Island light 1, supported_features=40 @ 2023-08-01T09:46:12.831970-07:00>>', triggered by the adaptive_lighting integration itself, which *should* not happen. If you see this please submit an issue with your full logs at https://github.com/basnijholt/adaptive-lighting
  1. Steps to reproduce the behavior:

    1. Create an AL entry with these four bulbs in them
    2. Set take_over_control = False
    3. Submit
    4. Turn on the bulbs
    5. Within 30 seconds they're in manual_control and AL has failed to adapt them.
basnijholt commented 1 year ago

Thanks a lot for reporting, my apologies for the issues.

Would it be feasible to try the latest main version and turn off take_over_control and detect_non_ha_changes?

I have refactored the code and believe it should be correct now.

ejpenney commented 1 year ago

Switched to master but still see the same issues:

2023-08-02 10:44:15.037 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Kitchen Island: Ignoring 'off' → 'on' event for 'light.kitchen_island_light_1' with context.id='01H6VNKBCYFM1K8FDZJC16J7XE' because 'light.turn_on' was not called by HA and 'detect_non_ha_changes' is False

home-assistant_adaptive_lighting_2023-08-02T17-44-26.657Z.log

Configuration ![image](https://github.com/basnijholt/adaptive-lighting/assets/21226768/07f84bed-f63e-417b-a35f-8ec74f968fcd)
basnijholt commented 1 year ago

Thanks a lot for reporting back! I am relatively sure I found the exact problem in #695.

ejpenney commented 1 year ago

I pulled the latest commit and it does seem to be much better behaved, thanks!

basnijholt commented 1 year ago

Awesome, thanks for letting me know 😄