diff --git a/__pycache__/shelly_pro_3m.cpython-312.pyc b/__pycache__/shelly_pro_3m.cpython-312.pyc index 7c6e8f1..4cae6d0 100644 Binary files a/__pycache__/shelly_pro_3m.cpython-312.pyc and b/__pycache__/shelly_pro_3m.cpython-312.pyc differ diff --git a/shelly_pro_3m.py b/shelly_pro_3m.py index 581cf99..3bd527d 100644 --- a/shelly_pro_3m.py +++ b/shelly_pro_3m.py @@ -1,3 +1,5 @@ +import struct + from pymodbus.client import ModbusTcpClient import pandas as pd import time @@ -53,7 +55,8 @@ class ShellyPro3m: print(f"Fehler beim Lesen von Adresse {address}: {result}") continue - value = result.registers[0] / 10.0 + packed = struct.pack(">HH", result.registers[1], result.registers[0]) + value = round(struct.unpack(">f", packed)[0], 2) print(f"Adresse {address} - {info['desc']}: {value}") data[f"{address} - {info['desc']}"] = value