mirror of
https://github.com/pommi/python-itho-wpu.git
synced 2024-11-21 13:52:15 +01:00
fix(itho-wpu): 0x12 is a 2 byte unsigned decimal
This commit is contained in:
parent
1f8eca43f6
commit
00f098f4e1
@ -341,12 +341,15 @@ def process_datalog(response):
|
|||||||
message = response[5:]
|
message = response[5:]
|
||||||
measurements = {}
|
measurements = {}
|
||||||
for d in datalog:
|
for d in datalog:
|
||||||
if d.type == 0x0 or d.type == 0x12 or d.type == 0xc:
|
if d.type == 0x0 or d.type == 0xc:
|
||||||
m = message[d.index:d.index+1]
|
m = message[d.index:d.index+1]
|
||||||
num = int(m[0], 0)
|
num = int(m[0], 0)
|
||||||
elif d.type == 0x10:
|
elif d.type == 0x10:
|
||||||
m = message[d.index:d.index+2]
|
m = message[d.index:d.index+2]
|
||||||
num = ((int(m[0], 0) << 8) + int(m[1], 0))
|
num = ((int(m[0], 0) << 8) + int(m[1], 0))
|
||||||
|
elif d.type == 0x12:
|
||||||
|
m = message[d.index:d.index+2]
|
||||||
|
num = round((int(m[0], 0) << 8) + int(m[1], 0) / 100, 2)
|
||||||
elif d.type == 0x92:
|
elif d.type == 0x92:
|
||||||
m = message[d.index:d.index+2]
|
m = message[d.index:d.index+2]
|
||||||
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