mirror of
https://github.com/pommi/python-itho-wpu.git
synced 2024-11-13 12:32:15 +01:00
feat(itho-wpu): implement getserial action
This commit is contained in:
parent
8647056564
commit
ffdce829fd
10
itho-wpu.py
10
itho-wpu.py
@ -177,6 +177,8 @@ def process_response(action, response, args):
|
||||
export_to_influxdb(action, measurements)
|
||||
elif action == "getnodeid":
|
||||
process_nodeid(response)
|
||||
elif action == "getserial":
|
||||
process_serial(response)
|
||||
|
||||
|
||||
def process_nodeid(response):
|
||||
@ -199,6 +201,14 @@ def process_nodeid(response):
|
||||
f"ListVersion: {listversion}")
|
||||
|
||||
|
||||
def process_serial(response):
|
||||
if int(response[1], 0) != 0x90 and int(response[2], 0) != 0xE1:
|
||||
logger.error(f"Response MessageClass != 0x90 0xE1 (getserial), but {response[1]} {response[2]}")
|
||||
return
|
||||
serial = (int(response[5], 0) << 16) + (int(response[6], 0) << 8) + int(response[7], 0)
|
||||
logger.info(f"Serial: {serial}")
|
||||
|
||||
|
||||
def process_datalog(response):
|
||||
if int(response[1], 0) != 0xA4 and int(response[2], 0) != 0x01:
|
||||
logger.error(f"Response MessageClass != 0xA4 0x01 (getdatalog), but {response[1]} {response[2]}")
|
||||
|
Loading…
Reference in New Issue
Block a user