Open Cloolalang opened 4 years ago
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:
P
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