cmroche / OctoPrint-HomeAssistant

Home Assistant plugin for OctoPrint, enabling MQTT discovery of you device and sensors
110 stars 18 forks source link

File uploaded event/notification for turning the printer on #60

Closed calexandre closed 3 years ago

calexandre commented 3 years ago

Hello @cmroche ! Great plugin btw. I use it extensively. Does the plugin support any kind of file upload events?

I'm trying to create an automation that powers a smart plug where the printer is plugged in when a file is uploaded to OctoPrint. I need to listen for some kind of event, so that I can trigger it on HA side...but right now I'm not getting anywhere, because when the print is disconnected, OctoPrint shows an error related to the Serial Port (as expected). If I upload something through CURA or PrusaSlicer, the file just sits there, probably because it's in an error state...

What I am missing right now is an event related to the file upload (or is there something better?) so that I can create an automation through HA and power-on the printer so that it can start printing...

I'm currently using a Prusa Mini+

Any help is appreciated :)

cmroche commented 3 years ago

I have no idea if this event is supported, but there is a generic "events" sensor sensor.octoPrint_last_event or something like this. If the file upload event it sent, it is likely written to this sensor.

Given that some plugins do seem to trigger on file upload, it's possible that something is written here that you can test against using a template sensor or automation.

cmroche commented 3 years ago

@calexandre Have you been able to confirm if the notification is already sent via the events topics / sensor in MQTT?

calexandre commented 3 years ago

Hello @cmroche sorry for the delay. Yes I can confirm that all events are sent to the sensor you mentioned. I guess we can close this.