What is the problem?
Cannot pass arguments to NodeJS script using YAML event hook. The code into the config.yaml file is:
events:
enabled: True
subscriptions:
- event: Connected
command: /usr/bin/node /home/pi/prototype-rasp/listenPrintStarted.js "foo" "bar"
type: system
enabled: true
I could verify that the event occurs and the listenPrintStarted.js will be fired since I can see its logs, but the process.argv contains only process.argv is: ['/usr/bin/node', '/home/pi/prototype-rasp/listenPrintStarted.js'].
What did you already try to solve it?
I tested launching the same exact command out of YAML, running it directly in the command line and so it works. In fact, running: $ /usr/bin/node /home/pi/prototype-rasp/listenPrintStarted.js "foo" "bar" I get in the logs of the script: process.argv is: ['/usr/bin/node', '/home/pi/prototype-rasp/listenPrintStarted.js', 'foo', 'bar'].
Additional information about your setup
OctoPrint version : 1.3.10
OctoPi version : 0.16.0
How to pass foo and bar when OctoPrint event occurs?