Adaptive Lighting with Sengled and Zigbee

Hello All,

I am starting to run out of ideas to try for my light setup. I love adaptive lighting but have noticed a few odd behaviors that I cannot seem to track down. I have around 95 zigbee light bulbs, all Sengled, a mix of floods and standard bulbs. I have Adaptive lighting set on each logical light group (ZHA group) and in general it works fairly well.

I have run into a weird edge case where it seems some of the lights stop adapting or don’t start. One of my automations is to turn on 5 or 6 light groups at 0730 each weekday morning and I set it to go up to 100% brightness over 5 minutes thinking a gradual transition would be best.

One light group attempts to do this and turns on over about 3 minutes while the rest of the light groups just instant turn on. Now for the ones that instant turn on sometimes its the last state other times its the current adaptive lighting setting and sometimes certain groups just don’t adapt.

Here is my current automation:

alias: Turn On Lights During the Week
description: Turn on bedroom and other pertinent lights in the morning.
trigger:
  - platform: time
    at: '07:30:00'
condition:
  - condition: time
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
    before: '00:00:00'
    after: '00:00:00'
action:
  - service: light.turn_on
    target:
      entity_id:
        - light.coffee_bar_zha_group_0x0008
        - light.breakfast_room_zha_group_0x0010
        - light.kitchen_bar_zha_group_0x000a
        - light.miles_room_zha_group_0x0004
        - light.master_bedroom_fan_zha_group_0x000b
        - light.pearson_s_room_zha_group_0x0005
        - light.entryway_lights_zha_group_0x0011
        - light.family_room_hallway_level_light_color_on_off
    data:
      transition: 300
      brightness_pct: 100
mode: parallel
max: 10

Here is my current adaptive lighting settings:

adaptive_lighting:
  - name: "Theater"
    lights: [light.theater_zha_group_0x0006]
    take_over_control: false
  - name: "Family Room"
    lights: [light.family_room_zha_group_0x000c, light.family_room_fan_zha_group_0x000d, light.family_room_hallway_level_light_color_on_off]
    take_over_control: false 
  - name: "Entryway"    
    lights: [light.entryway_lights_zha_group_0x0011]
    take_over_control: false
  - name: "Kitchen"
    lights: [light.kitchen_zha_group_0x0003, light.kitchen_bar_zha_group_0x000a]
    take_over_control: false
  - name: "Coffee Bar"
    lights: [light.coffee_bar_zha_group_0x0008]
    take_over_control: false
  - name: "Breakfast Room"
    lights: [light.breakfast_room_zha_group_0x0010]
    take_over_control: false
  - name: "Loft"
    lights: [light.loft_zha_group_0x0013, light.christmas_nook_zha_group_0x0012]
    take_over_control: false
  - name: "Living Room"
    lights: [light.living_room_zha_group_0x0002]
    take_over_control: false
  - name: "Dining Room"
    lights: [light.dining_room_zha_group_0x000f]
    take_over_control: false
  - name: "Master Bedroom"
    lights: [light.master_bedroom_zha_group_0x0007, light.master_bedroom_fan_zha_group_0x000b]
    take_over_control: false
  - name: "Bar"
    lights: [light.bar_light_level_light_color_on_off]
    take_over_control: false
  - name: "Office"
    lights: [light.office_zha_group_0x0009]
    take_over_control: false
  - name: "Basement Stairs"
    lights: [light.basement_stairs_zha_group_0x000e]
    take_over_control: false
  - name: "Miles' Room"
    lights: [light.miles_room_zha_group_0x0004]
    take_over_control: false
  - name: "Pearson's Room"
    lights: [light.pearson_s_room_zha_group_0x0005]
    take_over_control: false
  - name: "Master Sink"
    lights: [light.master_sink_lights_zha_group_0x0014]
    take_over_control: false
  - name: "Master Bath"
    lights: [light.master_bath_zha_group_0x0015]
    take_over_control: false
  - name: "Master Shower"
    lights: [light.shower_level_light_color_on_off]
    take_over_control: false

Here are the logs around the fan light group that turned on but didn’t adapt or transition brightness per the automation (maser_bedroom_fan):

2022-03-17 07:28:53 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Master Bedroom: '_adapt_lights(['light.master_bedroom_fan_zha_group_0x000b', 'light.master_bedroom_zha_group_0x0007'], 45.0, force=False, context.id=adapt_lgt_7508_interval_900)' called
2022-03-17 07:30:00 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.coffee_bar_zha_group_0x0008', 'light.breakfast_room_zha_group_0x0010', 'light.kitchen_bar_zha_group_0x000a', 'light.miles_room_zha_group_0x0004', 'light.master_bedroom_fan_zha_group_0x000b', 'light.pearson_s_room_zha_group_0x0005', 'light.entryway_lights_zha_group_0x0011', 'light.family_room_hallway_level_light_color_on_off']')' event with context.id='0ff0c2969f00ec67274af427cc09b67c'
2022-03-17 07:30:00 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.master_bedroom_fan_zha_group_0x000b' 'state_changed' event: '{'min_mireds': 154, 'max_mireds': 500, 'supported_color_modes': ['color_temp', 'hs'], 'color_mode': 'unknown', 'brightness': 254, 'off_brightness': None, 'icon': 'mdi:ceiling-fan-light', 'friendly_name': 'Master Bedroom Fan', 'supported_features': 59}' with context.id='0ff0c2969f00ec67274af427cc09b67c'
2022-03-17 07:30:00 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Master Bedroom: Detected an 'off' → 'on' event for 'light.master_bedroom_fan_zha_group_0x000b' with context.id='0ff0c2969f00ec67274af427cc09b67c'
2022-03-17 07:30:00 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Adaptive Lighting: Master Bedroom: '_adapt_lights(['light.master_bedroom_fan_zha_group_0x000b'], 1.0, force=True, context.id=adapt_lgt_7508_light_event_901)' called
2022-03-17 07:30:00 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Master Bedroom: Scheduling 'light.turn_on' with the following 'service_data': {'entity_id': 'light.master_bedroom_fan_zha_group_0x000b', 'transition': 1.0, 'brightness': 255, 'color_temp': 493} with context.id='adapt_lgt_7508_light_event_901'
2022-03-17 07:30:00 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.master_bedroom_fan_zha_group_0x000b']')' event with context.id='adapt_lgt_7508_light_event_901'
2022-03-17 07:30:07 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected a 'light.master_bedroom_fan_zha_group_0x000b' 'state_changed' event: '{'min_mireds': 154, 'max_mireds': 500, 'supported_color_modes': ['color_temp', 'hs'], 'color_mode': 'hs', 'brightness': 5, 'hs_color': (27.479, 15.075), 'rgb_color': (255, 234, 216), 'xy_color': (0.36, 0.346), 'color_temp': 188, 'off_brightness': None, 'icon': 'mdi:ceiling-fan-light', 'friendly_name': 'Master Bedroom Fan', 'supported_features': 59}' with context.id='22bb128338b6564ad616127580862372'

I’ve tried take_over_control on/off, changing transition times, etc. I am not sure if Sengled needs separate on and brightness control but in general without the separate commands a turn off/on will force the lights to adapt properly.

Any thoughts or ideas would be welcomed at this point.

Not sure if this is relevant here, but I have previously seen a thread (can’t find it at the moment) where it was proposed that Sengled bulbs don’t report their On/Off state in a timely manner, which can cause some issues with how Adaptive Lighting is able to respond. I know I have some trouble with my Sengled bulbs not adapting properly, or turning on immediately after being turned off, because HA thinks the bulb is actually off or on respectively.

I see in your logs the line:

2022-03-17 07:30:00 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Detected an 'light.turn_on('['light.coffee_bar_zha_group_0x0008', 'light.breakfast_room_zha_group_0x0010', 'light.kitchen_bar_zha_group_0x000a', 'light.miles_room_zha_group_0x0004', 'light.master_bedroom_fan_zha_group_0x000b', 'light.pearson_s_room_zha_group_0x0005', 'light.entryway_lights_zha_group_0x0011', 'light.family_room_hallway_level_light_color_on_off']')' event with context.id='0ff0c2969f00ec67274af427cc09b67c'

That to me seems like Adaptive Lighting is acknowledging that there was a call to turn all of these light groups on. But slightly later:

2022-03-17 07:30:00 DEBUG (MainThread) [custom_components.adaptive_lighting.switch] Master Bedroom: Detected an 'off' → 'on' event for 'light.master_bedroom_fan_zha_group_0x000b' with context.id='0ff0c2969f00ec67274af427cc09b67c'

Since it seems like “Master Bedroom” is the only group that was detected to turn from 'off ’ to ‘on’, maybe that is why it is the only group to get the Adaptive Lighting function applied? Maybe it doesn’t see a response from any of the other groups?

This is just speculation though. I don’t contribute to this project and am an intermediate HA user at best.