Best practice to ensure a MQTT switch command is executed by the switch


I am working with a sonoff switch that is in not so good wifi coverage. I just realized that switch OFF MQTT command executed in my UI never actually turned off, 4 days after… so I have been heating my pool for 4 days without knowing it because the UI was showing me that the switch was OFF.

I could think of two approaches, but rather ask the experts for recommendations.

  1. One approach, could be using a proxy switch item to monitor the actual state of the sonoff switch
  2. Another approach that I think could work is have a rule that monitor the executing of the command and the state of the switch, and loops until it is executed

Any advise would be greatly appreciated.

What about a temp sensor in the pool. Use something entirely secondary for feedback. If it was just near the water outlet…or in the heating housing you should be able to get a reading quick enough to determine if it’s done it’s job or not.

Simply set the item to autoupdate="false". This way, the status will only be set by postUpdate() or a received status message. When using the switch within the UI, the switch should jump back to its former position after some seconds, as long as there is no explicit status update.

1 Like

I would simply buy an extra WIFI access point :slight_smile:
(and still have autoupdate to false as Udo suggest as this is I guess the preferred option for all devices that report their own state)

In my view, automation only adds value if it works perfectly. If you would have to switch off the heater in openhab 10 times before the send-receive chain finally is properly closed and openhab reports it is off, I’d prefer just walking to the heater and unplug it myself :wink:

Super Udo, this autoupdate setting did the trick.

Thanks so much for tip!