Group scenes for Blue switch LED effects?

I use zha instead of z2m so I don’t know how much of this will work for you but this is my approach for sending notifications to all of my switches. I have two different scripts to make this work:

alias: Send Inovelli Notification
sequence:
  - service: zha.issue_zigbee_cluster_command
    data_template:
      cluster_type: in
      ieee: "{{ieee_id}}"
      endpoint_id: 1
      cluster_id: 64561
      command: 1
      command_type: server
      params: "{{command_args}}"
mode: parallel
icon: mdi:bell
max: 100

This script takes the ieee_id of the switch and the args for the event. Those are supplied by the script below.

alias: Trigger Switch Notification
sequence:
  - alias: Iterate through switch notifications
    repeat:
      count: "{{ ieee_ids | count }}"
      sequence:
        - variables:
            ieee_id: "{{ ieee_ids[repeat.index - 1] }}"
        - service: script.turn_on
          data_template:
            variables:
              command_args: 
                led_effect: 1
                led_color: 1
                led_level: 99
                led_duration: 255 
              ieee_id: "{{ieee_id}}"
          target:
            entity_id: script.send_inovelli_notification
variables:
  ieee_ids: |-
    {% set result = namespace(ids=[]) %}
    {% for state in states.light %}
      {% if device_attr(state.entity_id, 'model') == 'VZM31-SN' %}
        {% set result.ids = result.ids + [(device_attr(state.entity_id, 'identifiers')|list).0.1] %}
      {% endif %}
    {% endfor %}{{ result.ids }}
mode: single
icon: mdi:bell

The script works by finding the ieee_ids of all lights that match the blues model number. It then iterates through all of the ieee_ids and sends cluster commands to each individual switch.

You can calculate the values for command args as follows:

You can also technically combine this into one script, but zha sometime fails to send a command to a single switch. If it’s one script that causes the whole thing to fail. By breaking it out into another script only that single switch notification fails instead.

2 Likes