Zigbee Neo Siren AB02B2-v2 trying to switch melody

I created a zigbee2mqtt version of the script since I dont use ZHA. You dont need to create any helper variables in this version. Select the siren_x_Alarm switch in the entity dropdown.

alias: Siren Control
sequence:
  - service: mqtt.publish
    data:
      topic: >-
        zigbee2mqtt/{{ state_attr(entity_id, 'friendly_name').split(' ')[0]
        }}/set/melody
      payload: "{{ melody }}"
  - service: mqtt.publish
    data:
      topic: >-
        zigbee2mqtt/{{ state_attr(entity_id, 'friendly_name').split(' ')[0]
        }}/set/duration
      payload: "{{ duration }}"
  - service: mqtt.publish
    data:
      topic: >-
        zigbee2mqtt/{{ state_attr(entity_id, 'friendly_name').split(' ')[0]
        }}/set/volume
      payload: >-
        {% if volume == '0' %}low {% elif volume == '1' %}medium {% else
        %}high{% endif %}
  - service: mqtt.publish
    data:
      topic: >-
        zigbee2mqtt/{{ state_attr(entity_id, 'friendly_name').split(' ')[0]
        }}/set/alarm
      payload: "true"
description: Tuya Siren Z2M
fields:
  melody:
    default: "1"
    description: >-
      Melody that will be played based on ID from
      https://zigbee.blakadder.com/Neo_NAS-AB02B2.html
    example: 1-18
    selector:
      select:
        mode: dropdown
        options:
          - label: Doorbell Chime
            value: "0"
          - label: Fur Elise
            value: "1"
          - label: Westminster Chimes
            value: "2"
          - label: Fast double door bell
            value: "3"
          - label: William Tell Overture
            value: "4"
          - label: Turkish March
            value: "5"
          - label: Safe/Security Alarm
            value: "6"
          - label: Chemical Spill Alert
            value: "7"
          - label: Piercing Alarm Clock
            value: "8"
          - label: Smoke Alarm
            value: "9"
          - label: Dog Barking
            value: "10"
          - label: Police Siren
            value: "11"
          - label: Doorbell Chime (reverb)
            value: "12"
          - label: Mechanical Telephone
            value: "13"
          - label: Fire/Ambulance
            value: "14"
          - label: 3/1 Elevator
            value: "15"
          - label: Buzzing Alarm Clock
            value: "16"
          - label: School Bell
            value: "17"
  duration:
    default: 3
    description: Duration melody will be played for
    selector:
      number:
        min: 0
        max: 100
        mode: box
        unit_of_measurement: seconds
  volume:
    default: "1"
    description: Volume of the melody
    selector:
      select:
        options:
          - label: Low
            value: "0"
          - label: Medium
            value: "1"
          - label: High
            value: "2"
  entity_id:
    required: true
    selector:
      entity:
        domain: switch
    description: The switch entity for the siren (should end in Alarm)
mode: parallel
icon: mdi:bullhorn-variant

Thanks to @FoxxMD for providing the script with some useful defaults. I made a slightly modified blueprint which allows to select the siren more easily (no lookup of IEEE) and it allows you to configure the helper from using the blueprint. It means you can install the blueprint and then start using it, no setup steps before that.

I hope it can be useful to others.

1 Like