No announcement yet.

Cant toggle a device via MQTT with identical payloads (flip-flop event)

  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    In this case the broker has already delivered the message so I would expect no additional messages to be sent by the broker. There is also a Quality Of Service option, but I am not familiar if it would affect your scenario or not. You would need to read the spec or experiment if "At Least Once" and "Retain" would result in retransmission after reconnection.

    My guess is that you will want to trigger event on the LWT being Online and then publish whatever you want the arduino to do.

    If possible I would prefer to have the point of control retain the state and restore the state on power application. HS would sync with the node as it publishes its status. Tasmota lets you either initialize output to prior value or to Off.


    • #17
      Hi Michael

      Thanks for your thoughts. Yes read up on "retain", if the retain bit is set which I saw could be done for the devices mcsmqtt creates(for devices you can control as in sonoff basic) I see the publish can set the retain flag. I note in the mosquitto doc, if your remote device subscribes to a "wildcard" topic, as in furthur up the device topic heirarchy for the device, any devices under that will haev those topics and last payload re-sent.

      Interesting as to the approach, I've been following a guy called "Superhouse", he's an Aussie Home Automation guy that is big on MQTT, he has home assistant keep state of all devices and make the remotes "dumb"....

      This is kinda a neat project, worth a look....

      again thanks for your listening to end-user feedback....

      Pete in Oz