OctoPrint/OctoPrint-MQTT

Non-retained LWTT topic incorrect state issues with other clients, including Home Assistant

cmroche opened this issue · 1 comments

What were you doing?

  1. Disable retain
  2. Connect Octoprint with this plugin to MQTT service
  3. Disconnect client (home assistant) from MQTT service, and reconnect
  4. Status of device will be unavailable until Octoprint is restarted

What did you expect to happen?

Status of devices remained available.

What happened instead?

Status of devices are unavailable until octoprint is restarted.

Why did it happen?

The LWTT topic is not retained in this case, but HA (and presumably other clients) are watching this topic to know if valid data is coming in from the device. This topic is stateful by nature as a result.

When LWTT is not retained, and the listening client reconnect, it is unable to determine the state (the will published a retained disconnect on top of that), so disconnected tends to be retained in this context anyway.

Given how this topic is intended to be used, I think it makes sense that it is always retained. Or a separate option to control retain on this topic from the rest.

This bug is related to: cmroche/OctoPrint-HomeAssistant#55

@cmroche is there any update to this? I see the #100 has been approved but not committed for 1 year now...Would love this fix...