How to Parse Sonoff Friendly Full Topic Name for a script

So for example I have a Trigger of /tele/+/LWT
when topic is ‘offline’

And I want the autoamtion to notify me which one of the + is the one that is down.

Is it possible to take the topic attribute and slice it up?

See trigger variable for MQTT triggers. I don’t use MQTT, but if I’m understanding correctly, you can use trigger.topic. If the topic is /tele/xxx/LWT, and you want to see what xxx is, you could do something like:

{{ trigger.topic.split('/')[2] }}

1 Like