MySensors icon indicating copy to clipboard operation
MySensors copied to clipboard

MQTT Gateways don't support Last Will and Testiment/Keep Alive

Open Cloolalang opened this issue 5 years ago • 1 comments

Mysensors/gateway/Transport/MQTT-pubsubclient/Lastwill

It would be very cool if the MQTT gateway could offer the option for Last Will so that our controllers can monitor and alert to loss of MQTT connection.

Pubsubclient API offers this feature already.

https://pubsubclient.knolleary.net/api.html

Cloolalang avatar Apr 27 '20 17:04 Cloolalang

I've been working on this. it seems to be working OK, I have found that I needed to add a publish MQTT "online" message to the LWT topic just after _MQTT_client.connect in MyGatewayTransportMQTTClient.cpp to set up the LWT topic with an inital message. And, I am publishing "online" every minute in my main gateway sketch to maintain it. ( I found that if I reset my MQTT broker, or Controller client (Hassio) the LWT topic sometimes comes up with no message "online")

How it looks on Hassio Dashboard:

image

P

Cloolalang avatar Apr 30 '20 15:04 Cloolalang