Hi everyone,
I have installed a water level sensor which provides a 4-20 mA signal.
I am already reading the holding register from a Modbus TCP, succesfully.
#configuration.yaml entry
modbus:
- name: ZisternenPi
type: tcp
host: 192.168.178.63
port: 502
sensors:
- name: Zisterne1
slave: 1
address: 1024
input_type: holding
data_type: int
scan_interval: 5
precision: 2
The value stored in the Modbus holding register is not the actual value (unit) of the measurement.
To get the “mA”-value, the integer value from Modbus holding register hast to be trasformed by calculation (value*20/4095)
I have tried different solutions from various forums, but didnt manage to implement the calculation.
I assume that it is just one line of appropriate code, but i am obvisouly to nooby.
Maybe someone can help me with this?
Dont hesitate to ask if something’s unclear.
kind regards,
Jonas