It seems that if I update any automation, the above one gets triggered. Obviously not what I intended. It should only trigger when a message with this topic is received. What am I doing wrong here?
In the HA UI, if I update any automation this gets triggered (after the automations are reloaded I guess).
The payload for this mqtt topic is empty when it is being sent (it is only sent very explicitly).
The topic value doesn’t matter much because I can 100% surely say this topic was not sent at the moment the automation is triggered.
When I go to Server Control and hit the Reload Automations action, it gets triggered.
That’s what I was thinking as well. I’ll have to look at it tonight, I’m using mosquitto_pub in a python script to push the msg, not sure what flags are used.
Let’s say it has, what does reloading the automations have to do with it? I wonder, why doesn’t the automation then continuously trigger rather than on an automations reload?
afaik when you reload automations, each automation re-subscribes to its topic. if that topic has a retained message, the MQTT broker sends it to your automation(that’s the idea behind retained flag and that’s why you only have to use it for states) and, as your automation does not have payload it will trigger on any message, every reload/resubscribe.
restart your broker and it most certainly will. restart your HA and you’ll see the same. that’s my theory