I'm trying, for the first time, to get an event to fire my python script. Here is what I put in /home/pi/.octiprint/config.yaml:
events:
enabled: True
subscriptions:
- event: PrintStarted
command: python /home/pi/bin/events.py {__filename} {__now}
type: system
enabled: True
It's right after the appearance section in the first 20 or so lines of the file. After I restart Octoprint, I get the following in the logs:
2018-09-23 23:27:28,047 - octoprint.events - INFO - Disabled command trigger: {'enabled': False, 'command': 'python /home/pi/bin/events.py {__filename} {__now}', 'event': 'PrintStarted', 'type': 'system'}
2018-09-23 23:27:28,279 - octoprint.server - INFO - Shutting down intermediary server...
2018-09-23 23:27:28,305 - octoprint.server - INFO - Intermediary server shut down
2018-09-23 23:27:28,309 - octoprint.events - INFO - Processing startup event, this is our first event
2018-09-23 23:27:28,309 - octoprint.events - INFO - Adding 0 events to queue that were held back before startup event
2018-09-23 23:27:28,315 - octoprint.filemanager - INFO - Adding backlog items from all storage types to analysis queue...
2018-09-23 23:27:28,394 - octoprint.filemanager - INFO - Added 0 items from storage type "local" to analysis queue
and the config.yaml entry has been !changed! to
events:
enabled: true
subscriptions:
- command: python /home/pi/bin/events.py {__filename} {__now}
enabled: false
event: PrintStarted
type: system
My script does not get called on the PrintStarted event.
What did you already try to solve it?
I have tried different ordering of the lines in the subscription section but that didn't seem to make a difference. I believe that this section of the python code in _initSubscriptions()
if "enabled" in subscription.keys() and not subscription["enabled"]:
self._logger.info("Disabled command trigger: {!r}".format(subscription))
continue
is making the log entry but I don't know if it is triggered after the config.yaml file is doctored to show enabled as false (it starts out true in my entry). I also don't know what code is changing enabled to false and reordering the lines in my subscription entry.
Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, octoprint.log, serial.log or output on terminal tab, ...)
I'm running octoprint 1.39 on a Raspberry Pi 3B+ installed using Octopi. It is connected to an Anet A8 running Marlin 1.1.9.
Is there a way to attach my complete config.yaml file and log file to this entry as attachments?