diff options
Diffstat (limited to 'src/home/mqtt/message/sensors.py')
-rw-r--r-- | src/home/mqtt/message/sensors.py | 19 |
1 files changed, 0 insertions, 19 deletions
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 |