Need help on how to use python in node red

Hello, I have a project involving a sensor with an I2C output. I'm using NODE RED and I managed to get the I2C information but I don't know how I can use a python code to make a test on the value of the I2C output and use the python script to output to a GPIO.
Thanks

Welcome to the forum @elpepito

Do you mean you want help writing the python code, or do you mean you want to call python code from node red. You can run a python script from node red using an exec node.

Why do you want to use python to output to GPIO? You can do that directly from node red.

Node-RED is mostly javascript - so any processing inside Node-RED would be much easier using that... You can of course use an exec node to call out to a python program and get the result back if that is what you need - but there are also i2c type nodes and some sensor specific ones as well that may help do what you want.

Take a look at pigpiod and in particular pigs and the pipe interface http://abyz.me.uk/rpi/pigpio/pigpiod.html

With this library you can run I2C/SPI on any GPIO pin. It also allows you to create output wave forms and input timing/edge detection with ~10uS accuracy without having to use sudo.

Start by testing pigs commands from within a terminal session to detect your hardware and read results. Then access pigs from node-red using either exec, file in out or access the pipe interface of the library using tcp nodes.

In my experience if one is running on a Pi zero, python can put too much of a strain on memory/cpu especially if lots of devices are being accessed frequently.

P.S. The library has C and Python source examples to help you customise your device driver.

Hello and thank you, my project is to water automatically a plant with a humidity sensor which uses I2C. I don't know how I can get a python script running doing that on the raspberry because I don't know how to get the I2C values in python but I found how to get them with node red, but I don't know javascript, I only know python a bit. I hope it helps to understand my issues

Not really, I still don't know what you want help with. You don't need to know much javascript to use node-red, and there are people here who will help if you get stuck.