diff --git a/PentairProtocol.py b/PentairProtocol.py index 2e65c56..9ed7486 100644 --- a/PentairProtocol.py +++ b/PentairProtocol.py @@ -35,13 +35,22 @@ def getStatus(self): # class DatePayload(Payload): + DAY = { 0x01: "Sunday", + 0x02: "Monday", + 0x04: "Tuesday", + 0x08: "Wednesday", + 0x10: "Thursday", + 0x20: "Friday", + 0x40: "Saturday" } + def __init__(self, body): super().__init__(body) try: self.status['hour'] = self.body[0] self.status['min'] = self.body[1] - self.status['dow'] = self.body[2] + # dow is a bit shift 0x01 << > 2) except Exception as err: pass class PumpPayload(Payload): - # sample: 0A 02 02 03 03 09 60 00 00 00 00 00 01 00 0F + # sample: + # 00,10,60,07,0F,0A 02 02 03 11 09 60 00 00 00 00 00 01 13 3B def __init__(self, body): super().__init__(body) try: @@ -146,7 +158,7 @@ def __init__(self, body): (self.status['pumpMode'], self.status['pumpState'], self.status['pumpWatts'], - self.status['pumpRPM'] ) = struct.unpack(">BBHH", self.body[1:9]) + self.status['pumpRPM'] ) = struct.unpack(">BBHHxx", self.body[1:9]) # print(f"read RPM {self.status['pumpRPM']} from:"); self.dumpBody() diff --git a/pentair-control.py b/pentair-control.py index dd1ed50..2478619 100755 --- a/pentair-control.py +++ b/pentair-control.py @@ -208,9 +208,9 @@ def do_something(): if not connection.isOpen(): connection.open() - state.clear() + # state.clear() streamData.append(connection.listen()) - logger.info(json.dumps(state.getDict())) + logger.info(json.dumps(state.getDict()) + "\n") def run(): if not connection.isOpen():