1
0
mirror of https://github.com/pommi/python-itho-wpu.git synced 2024-11-24 14:22:14 +01:00

fix(itho-wpu): 0x90 is a 2 byte signed decimal

This commit is contained in:
Pim van den Berg 2021-06-10 13:19:54 +02:00
parent 751182b70d
commit 370209603b

View File

@ -140,7 +140,7 @@ class IthoWPU:
if dt in ["0x0", "0xc"]:
index = index + 1
elif dt in ["0x10", "0x12", "0x92"]:
elif dt in ["0x10", "0x12", "0x90", "0x92"]:
index = index + 2
elif dt in ["0x20"]:
index = index + 4
@ -266,6 +266,11 @@ def process_datalog(response, wpu):
elif d.type == 0x12:
m = message[d.index : d.index + 2] # noqa: E203
num = round((int(m[0], 0) << 8) + int(m[1], 0) / 100, 2)
elif d.type == 0x90:
m = message[d.index : d.index + 2] # noqa: E203
num = (int(m[0], 0) << 8) + int(m[1], 0)
if num >= 32768:
num -= 65536
elif d.type == 0x92:
m = message[d.index : d.index + 2] # noqa: E203
num = (int(m[0], 0) << 8) + int(m[1], 0)