-
-
Notifications
You must be signed in to change notification settings - Fork 97
better MQTT handling for testament / last will #57
Comments
last will is already setup (see my_config.h) and myESP line 718:
With your examples like Tasmota, how often do the devices publish to the LWT topic? Is it like a heartbeat? |
When i understand it correctly: You have to send at least two messages. Both with retain=true
The effect of the first line will be that the payload "offline" will only be published to the subscribers if the broker identifies that the client has disconnected. In your configuration a new parameter should be included: |
that's correct. I'll add the changes and test it. Thanks. |
In 1.5.3. Please test and let me know if it works as proposed! |
closing |
Describe the solution you'd like
In my home automation (home assistant) i commonly use the mqtt lwl/testament to identify if the device is online or offline. Other ESP-solution like the Tasmota firmware or Node Red support this behaviour per default: Besides the last will statement also "online" statements are set up accordingly. Example of an MQTT binary sensor Home Assistant configuration: ...
availability_topic: "NodeRed/LWT"
payload_available: "online"
payload_not_available: "offline"
From a technical point of view it should (i belive) be easy to implement: when the device establish an mqtt connection, publish a second message with the same LWT-topic (but without the last will flag set) and the body "online" (example) using the retain flag.
Benefit: Direct detection if the device crashed or was gone offline! Then Home Assistant set the states as unavailable.
The text was updated successfully, but these errors were encountered: