mirror of
https://github.com/pommi/python-itho-wpu.git
synced 2024-11-22 14:02:15 +01:00
fix(itho-wpu): 0x90 is a 2 byte signed decimal
This commit is contained in:
parent
751182b70d
commit
370209603b
@ -140,7 +140,7 @@ class IthoWPU:
|
|||||||
|
|
||||||
if dt in ["0x0", "0xc"]:
|
if dt in ["0x0", "0xc"]:
|
||||||
index = index + 1
|
index = index + 1
|
||||||
elif dt in ["0x10", "0x12", "0x92"]:
|
elif dt in ["0x10", "0x12", "0x90", "0x92"]:
|
||||||
index = index + 2
|
index = index + 2
|
||||||
elif dt in ["0x20"]:
|
elif dt in ["0x20"]:
|
||||||
index = index + 4
|
index = index + 4
|
||||||
@ -266,6 +266,11 @@ def process_datalog(response, wpu):
|
|||||||
elif d.type == 0x12:
|
elif d.type == 0x12:
|
||||||
m = message[d.index : d.index + 2] # noqa: E203
|
m = message[d.index : d.index + 2] # noqa: E203
|
||||||
num = round((int(m[0], 0) << 8) + int(m[1], 0) / 100, 2)
|
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:
|
elif d.type == 0x92:
|
||||||
m = message[d.index : d.index + 2] # noqa: E203
|
m = message[d.index : d.index + 2] # noqa: E203
|
||||||
num = (int(m[0], 0) << 8) + int(m[1], 0)
|
num = (int(m[0], 0) << 8) + int(m[1], 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user