Migrate siren switch to new mqtt siren (zigbee2mqtt)

My old config looks like this

switch:
- platform: "mqtt"
  name: Siren
  state_topic: "zigbee2mqtt/MYSIREN/set"
  availability_topic: "zigbee2mqtt/bridge/state"
  payload_off: '{"warning": {"duration": 0, "mode": "stop", "strobe": false}}'
  payload_on: '{"warning": {"duration": 1800, "mode": "emergency", "strobe": true}}'
  command_topic: "zigbee2mqtt/MYSIREN/set"

I have tried to convert it:

mqtt:
  siren:
    - name: MYSIREN
      payload_off: '{"warning": {"duration": 0, "mode": "stop", "strobe": false}}'
      payload_on: '{"warning": {"duration": 30, "mode": "emergency", "strobe": true, "strobe_level": 10, "strobe_duty_cycle": 5}}'
      command_topic: "zigbee2mqtt/MYSIREN/siren/set"

But nothing happens if I try to use the siren.turn_on service. In zigbee2mqtt I can also set the duration, mode and so on dynamically. Is this also possible in homeassistant?

The model of the device is SZ-SRN12N.

I use next commands in my automation to trigger and reset the Sirene.

  action:
  # Trigger or Reset the Sirene
    - service: mqtt.publish
      data:
        topic: zigbee2mqtt/Sirene/set
        payload: >-
          {{
              '{"warning": {"duration":10, "mode":"stop", "strobe":true}}'
            if trigger.platform == "reset" else
              '{"warning": {"duration":120, "mode":"emergency", "strobe":false}}'
          }}

Your solution sounds like a valid approach nevertheless I think the current behavior might be a bug:

1 Like

@runningman84 @complex1
Hi

I am having the same problem as you
I have an SZ-SRN12N siren and I cannot get it to work on the automatic link (MQTT) between Zigbee2MQTT and Home Assistant
I do not know how to do.
Did you get there?