Read the statement by Michael Teeuw here.
Python in to the magic mirror.
-
@paulvanderheijden90 i don’t see the python module
you can add it to the directory and repo temporarily, then remove it later
-
@paulvanderheijden90 so far I don’t see the same crash error…
I did have to make some minor changes…
Module name to match the git repo name
path to a python script
and change the display handling…
rule is ONLY content change location is getDom()…
other routines should store data and call updateDom(0 to signal that there ARE changes to displayI’m gonna let it run for a while…
-
@sdetweil
hello ! Thank you for your help so far.The python project is running fine on it selfs.
But wenn I use it with the magic mirror the buffer of the magic mirror is filling. And freezes.
the python project is made in combination with a Antenna.
Setup looks like https://nl.oneguyoneblog.com/2016/08/09/p2000-ontvangen-decoderen-raspberry-pi/#comment-488so you’ll need to have data from the Multimom to get different information to send to the mirror
-
@paulvanderheijden90 I wrote a little hello world python script to send data. All that is working as expected so far
How big is the data buffer your python script sends?
-
@sdetweil
it is almost 50 char long. Im making a screen movie to let you see what I meen so it will become clear.
Send it you in a couple of minutesPlease see the full movie and notice the fail at 1:41
https://www.youtube.com/watch?v=VBYL1j4p2aI&feature=youtu.be -
Very interested in this project… I have a python script to control my thermostat and was wondering how to get port it over…this may give me some answers :)
-
@paulvanderheijden90 i submitted a pull request to your repo. this code runs for hours and hours…
tiny changes from yours…the biggest is that the module filename is changed to match the name of the project
(but that isn’t why it hung)… I actually don’t know the cause on your side…please download my code and try it out… let me know
-
@sdetweil @Sean
Hello Guys Thank you for your vallueed help!I found out that the spawn function is called every time. so in a couple of minuts the spawn function has called 100 python projects. and this is blocking the raspberry
I changed is to this: and now im going to Import the project of sdetweil in the software. But it is no more blocking.
thank you guys/// node_helper.js const spawn = require("child_process").spawn var NodeHelper = require("node_helper") var process = spawn("python", ["/home/pi/src/P2000.py"]) module.exports = NodeHelper.create({ socketNotificationReceived: function(notification, payload) { switch(notification) { case "GIVE_ME_DATA": this.job() break } }, job: function() { process.stdout.on("data", (data)=>{ console.log(data) var result = String.fromCharCode.apply(null, new Uint16Array((data))) this.sendSocketNotification("HERE_IS_DATA", result) }) } })
-
does your python script continue to run once its started? the design of the node helper starting the script every second depends on the script ending…
or as you have found you will kill the system (doesn’t matter, pi or larger)…
you could do it your suggested way… but typically, one would add code in the notification received to start it once…
-
@paulvanderheijden90
You can putvar process = spawn("python", ["/home/pi/src/P2000.py"])
intostart
function if you want to execute when module is successfully loaded.Or you can make some
START
notification from main module then use it as trigger for execution. You can usesocketNotificationReceived
function to that purpose.Or, you can terminate spawned child process when it becomes needless.