I have migrated all my device from ZHA to MQTT, based on a Sonoff stick.
I have some soundmakers (sirens!) which I want to use for different purposes in different automations. So for instance I want a loud siren (melody = 14) for some presence related warnings but a more pleasant bell for my doorbell (melody - 18). Melody is one of 7 things exposed in MQTT.
In ZHA I found a script someone had done which enabled me to use Service Data in my automation like this:
ieee_id: xx:xx:xx:xx:xx:xx:xx
melody: 6
duration: 1
volume: 2
alarm: "on"
so it was easy to vary the noise according to what I needed within the automation.
How can I do this in an automation for an MQTT device? I’m reading about payload which is probably how it’s done but I don’t understand how to implement it, so some examples would be useful.
Thanks