Getting data from python into node red

Hello People

Very unusually, I'm posting rather than asking for help this time! (although I'm not sure I would rely on this, and/or it may have been mentioned before).

Anyway,

I have a raspberry pi with various sensors, which I wanted to feed into node red.
The data from these sensors is collected and manipulated by python scripts.

I was looking for the best way to send the data from these scripts to node red (there seems to be tons of options, MQTT being the most straight forward).

But, all I did is use the Exec node to call the script and then used the Stdout output of the Exec node to get the values.

This removes the need for any extra layer to communicate between python and node red, but also makes the python scripts very simple - because all you need to do is print the values you want.

It also allows you to get values in real time without having to wait until the script finishes.

1 Like

As long as NR is. starting the script via the exec node yes, but if you have another script controlled
& executed from another process or running as an independent process, that will not work. Then MQTT is a good choice

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.