From 9af0e28b94fd44d2340b0b9ddf2dcccc11d48271 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Sun, 18 Dec 2022 05:33:54 +0300 Subject: mqtt refactoring (wip) --- src/home/mqtt/message/sensors.py | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 src/home/mqtt/message/sensors.py (limited to 'src/home/mqtt/message/sensors.py') diff --git a/src/home/mqtt/message/sensors.py b/src/home/mqtt/message/sensors.py deleted file mode 100644 index ee522f0..0000000 --- a/src/home/mqtt/message/sensors.py +++ /dev/null @@ -1,19 +0,0 @@ -import struct - -from typing import Tuple - - -class Temperature: - format = 'IhH' - - def pack(self, time: int, temp: float, rh: float) -> bytes: - return struct.pack( - self.format, - time, - int(temp*100), - int(rh*100) - ) - - def unpack(self, buf: bytes) -> Tuple[int, float, float]: - data = struct.unpack(self.format, buf) - return data[0], data[1]/100, data[2]/100 -- cgit v1.2.3