ADC Value in NodeRed

Hello

I have a python program in my raspberry.

from periphery import I2C
def get_adc_value():
	# Open i2c-1 controller
	i2c = I2C("/dev/i2c-1")

	msgs = [I2C.Message([0x61]), I2C.Message([0x00,0x00], read=True)]
	i2c.transfer(0x36, msgs)
	adc_value = (msgs[1].data[0] & 0x0F) <<8 | (msgs[1].data[1])

	# ATTENTION le 4.93 est la tension de ref mesurée à la main
	# pas utile en mode ratiometrique
	adc_value_volt=(adc_value*4.93/4096)
	print("ADC VALUE P4.2: 0x{:04x} , {:0.2f}V".format(adc_value,adc_value_volt))

	msgs = [I2C.Message([0x63]), I2C.Message([0x00,0x00], read=True)]
	i2c.transfer(0x36, msgs)
	adc_value = (msgs[1].data[0] & 0x0F) <<8 | (msgs[1].data[1])

	adc_value_volt=(adc_value*4.93/4096)
	print("ADC VALUE P6.2: 0x{:04x} , {:0.2f}V".format(adc_value,adc_value_volt))

	i2c.close()

I want to integrate this function in my node red in order to have only one point of debug.
Can you tell me how to do it?

Thank You

Well you could call it from an exec node. python -u path-to/yourfile.py or did you want to implement it 100% in Node-RED using the i2c node ?

I will integrate 100% in node red because the resut of msg does anaylsed in node red

If you look in the flows section and search for ADC you will find a number of nodes designed to read from ADC devices attached to a RPi.

eg node-red-contrib-iiot-rpi-ads1115 (node) - Node-RED