LED Bar sync issue with Zigbee Binding

EDIT - I think I’ve figured this out. The conflict between the zigbee binding and scene/bulb changes was just due to timing. I introduced a 500ms delay to the start of the actions in the automation below which has resolved this.

I have a bunch of Inovelli Blue dimmers connected to Hue bulbs (in smart bulb mode).

Some of the bulbs and switches are associated with zigbee binding, and others are not.

For those that don’t have zigbee binding, this automation works great:

alias: Switch LED Bar - Brightness
description: >
Syncs the Inovelli Blue dimmer LED bar with the brightness of light group
triggers:

  • entity_id:
    • light.room_lights_all
      trigger: state
      actions:
  • choose:
    • conditions:
      • condition: template
        value_template: “{{ trigger.entity_id == ‘light.room_lights_all’ }}”
        sequence:
      • target:
        entity_id: light.switch_room_light
        data:
        brightness_pct: |-
        {% if trigger.to_state.state == ‘off’ %}
        0
        {% else %}
        {{ ((trigger.to_state.attributes.brightness | default(0)) / 255 * 100) | round }}
        {% endif %}
        action: light.turn_on
        mode: restart

The problem is with the switches with zigbee binding. The light.switch_room_light entity on the switch is what controls the LED dim/brightness. When the bulbs are zigbee bound, that same entity also controls the dim/brightness of the bulbs. So, the automation above creates a feedback loop, and the bulbs adjust brightness a number of times when the automation is triggered (even if triggered with a scene in Home Assistant) before eventually settling after a few seconds. The bulbs will never turn off fully when this automation is in place.

I’m hoping someone who knows a lot more about zigbee binding can tell me what I’m doing wrong.