I'm IoT newbie and I have a project with Schneider Power Meter.
I read voltage raw data from registers using pymodbus
but I don't know how to convert it to the correct value.
Raw data is [24206, 17242]
from registers address 3927-3928
.
Here is my code :
from pymodbus.client.sync import ModbusSerialClient as ModbusClient
def main():
try:
register = int(input("Registers: "))
modbus = ModbusClient(method='rtu', port='COM4', baudrate=9600, timeout=1,
parity='E', bytesize=8
)
modbus.connect()
r = modbus.read_holding_registers(register, 2, unit=1)
print(r.registers)
modbus.close()
return r.registers
except AttributeError as e:
print(e)
return None
if __name__ == "__main__":
main()
Out:
[24206, 17242]
Can everyone tell me how to do it?
Thanks.
Still, I'm waiting for your code, but with my guess, you will need like the following stuff:
Reading and decoding:
[NOTE]:
Your data either is float32 or float32_inverse.
Thus, with the float32 you will have:
And with the float32_inverse you will have: