OctoPrint/OctoPrint-MQTT

No MQTT connected event message sent when Octoprint autoconnects to printer

Opened this issue · 2 comments

What were you doing?

Looking to get a notification that my printer is connected.

Ideally provide exact steps to follow in order to reproduce your problem: -->

MQTT plugin installed with default settings
Octoprint configured to autoconnect to printer on startup

What did you expect to happen?

Connected message received via MQTT broker

(As a related issue, although no connected message is received I will strangely get a /progress/printing message each time the printer/Octoprint is started with progress = 0)

What happened instead?

No message received. If I terminate the printer connection and manually reconnect the printer the connected message will be sent

Version of OctoPrint

1.8.6

Version of the MQTT plugin

0.8.13

Used MQTT broker and its version

Mosquitto 2.0

I suspect this is a race condition of some kind where the connection is established to printer prior to the plugin's code being loaded to react to the connection event.

Thanks - that makes sense. I imagine that a lot of ppl would use the auto connect function so I'm a bit surprised to be the only one reporting this. Any thing I can do the speed up the plugin or delay the connection? Do plugins load in order in which they were installed? If so I could delete and re-add them with MQTT at the front.

Alternative is it possible to get additional server events like "PrinterStateChanged" sent via MQTT. There is an event payload called "operational" which could be used as a poxy for connected I guess.