Read the statement by Michael Teeuw here.
MMM-PIR-Sensor execute .py script
-
Goal: Execute .py using MMM-Pir-Sensor
Hi all, I’m having trouble executing a .py script that sits in the directory:
/home/pi/Documents/test.pyAccording to @orayoflighto in this thread, he suggests adding 1 line to node_helper.js that sits in the MMM-PIR-Sensor module directory from:
if (data.indexOf("0x120002") !== -1) exec("/opt/vc/bin/tvservice --preferred && chvt 6 && chvt 7", null);to
if (data.indexOf("0x120002") !== -1){ exec("/opt/vc/bin/tvservice --preferred && chvt 6 && chvt 7", null); exec("python /home/pi/py-spidev/RPi-LPD8806/LED.py"); }I’ve tried this exec() below in both activateMonitor and briefHDMIWakeup function and it’s not working.
briefHDMIWakeup: function() { const self = this exec("/usr/bin/vcgencmd display_power").stdout.on('data', function(data) { if (data.indexOf("display_power=0") === 0) { exec("/usr/bin/vcgencmd display_power 1", null); exec("python /home/pi/Documents/test.py")Note, calling sudo python3 test.py in cmd line works itself. I’m having trouble figuring out why exec() is not calling in node_helper.js. Any tips on debugging this?
I tried console.log(text); in .js file. It’s not calling either (i may be totally viewing command prompt wrong to view debug message)
Thanks for reading!
-
MMM-PIR-Sensor by paviro node_helper.js txt here
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login