MQTT Interface Should Send LWT on Hub Reboot

  • Hubitat supports an MQTT interface in-box
  • MQTT interface supports LWT messaging
    • LWT support was added in 2.1.2
  • MQTT Interface does not send the LWT message on hub reboots

Arguably the main (maybe ONLY?) purpose of a LWT message is to tell the MQTT broker and its subscribers that the MQTT client is going offline/unavailable.

This is not happening on hubitat's MQTT interface as it does not actually send the LWT message as expected on a hub reboot.

Note that proactively sending a LWT isn't "required" in any standard, so the current implementation isn't "wrong" as the broker typically makes the LWT decision.

That said, many MQTT client/hubs do proactively send the LWT if their parent hardware is going down, and that is what I would like to b considered for Hubitat's MQTT implementation. That's why this is a feature request.

Example connection in a driver - this does not send an "offline" as desired on a hub reboot:

			interfaces.mqtt.connect("tcp://${settings?.brokerIp}:${settings?.brokerPort}",
							   "hubitat_${state.HubId}_${device.displayName}", 
							   settings?.brokerUser, 
							   settings?.brokerPassword, 
							   lastWillTopic: "hubitat/${state.HubId}/${device.displayName}/LWT",
							   lastWillQos: 0, 
							   lastWillMessage: "offline", 
							   lastWillRetain: true)

Thanks in advance for the consideration!

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.