Need help with Rules: How to turn relay Off if there is long lasting error when trying to communicate with MQTT broker?

Hi.

Any tips how I should configure Tasmota when I want it turn relay Off if there is over 10 minutes lasting error when trying to communicate with MQTT broker? Examples: Maybe MQTT broker is down, or there is no Wifi connection…

If you send the MQTT command with a retain flag, it will remain that value in the MQTT broker until changed. This would help if your device is offline where it will get the correct command when the relay comes back on the network.

For faults with the broker itself (more aligned to your question) - have a look at the different QOS settings for MQTT.

Personally I have never had any issues with my MQTT broker being unavailable in over 4 years of use - so seems a fairly edge case you are trying to cover.

Not sure how to do this with tasmota, but I think you are looking for LWT: Last Will and Testament - MQTT Essentials: Part 9

Hi.

Thank you both about reply.

I’m familar with Last Will and Testament / QOS, but sadly they will not help in my case.

I’ve have had been some Wifi problems and even some SSD problems (Reason: stupid Kingston A2000 firmware and it’s power saving feature bug), so I need give Tasmota ability to turn its own relay Off.

Yesterday I noticied that one of Tasmotas had kicked out from network over one day. So, this would be security feature… like dead man switch in trains.

How about using ESPHome ?

Thank you about reply.

They are smart plugs with power monitoring so I don’t want to start begin with another firmware when all other things are working fine…

In this link will found the answer, if anyone else may need it…

https://github.com/arendst/Tasmota/discussions/14946