From 00f098f4e13647d08834e01dd083faf8b015a7eb Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Sun, 7 Mar 2021 14:45:27 +0100 Subject: [PATCH] fix(itho-wpu): 0x12 is a 2 byte unsigned decimal --- itho-wpu.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/itho-wpu.py b/itho-wpu.py index 85840ef..cc1b90a 100755 --- a/itho-wpu.py +++ b/itho-wpu.py @@ -341,12 +341,15 @@ def process_datalog(response): message = response[5:] measurements = {} 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] num = int(m[0], 0) elif d.type == 0x10: m = message[d.index:d.index+2] 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: m = message[d.index:d.index+2] num = ((int(m[0], 0) << 8) + int(m[1], 0))