Using python script to read Wiiboard data using bluetooth


I have a python script to read the data of the Wiiboard (it's works correctly if I run the python code from the terminal).

I'd like to run the same thing in Note-red, so I have done a simple flow [{"id":"e7d70765.df79d8","type":"exec","z":"91cb8da0.1019d8","command":"python /home/franck/Bureau/Yann/","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":390,"y":220,"wires":[["50e195f7.d2d324"],["49bfc4f6.1d350c"],["1c185622.fe1422"]]}]
but I got an error in the 3 outputs...


I have not idea why it is not working since it worked in my terminal...

Thank you

It says "Host is down" near the end! Looks like the Python script it throwing an error.
Also you have appended the msg.payload, does that contain valid parameters?

Yes, I think the python script throw an error but I do not get why since when I run my code inside the terminal it works perfectly... the error "Trying to connect..." comes from my python code..

You did not reply to the question about the payload.

what does mean by "valid parameters" ?

There is an option in the exec node to append the payload as parameters to the python script as you would if you executed the script manually:

Python3 myparameter

You have checked this option in the node. This means that the exec node is appending the payload to your script. This may not be what you want.


Thank you. It's better, the code begins to work. But I think that my main trouble is that inside my python code I do the init, then the connection and when this is done I can print the output of the signal... Probably that by doing this node-red, my python code is every time re read from the beginning whereas the init and connection should not be done a second time... I need to figure out how to pass this...

maybe use the node-red-node-daemon node - that is designed for longer running process (like scanning). You specify an app to run - then you can send it commands via the input and get outputs as they come back.