From 0aba139aeff8ff80757c5d36502413299a0b449e Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Thu, 11 May 2023 04:18:08 +0300 Subject: mqtt, esp: add new esp8266-based device --- src/home/mqtt/payload/temphum.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/home/mqtt/payload/temphum.py (limited to 'src/home/mqtt/payload/temphum.py') diff --git a/src/home/mqtt/payload/temphum.py b/src/home/mqtt/payload/temphum.py new file mode 100644 index 0000000..5b45ecb --- /dev/null +++ b/src/home/mqtt/payload/temphum.py @@ -0,0 +1,14 @@ +from .base_payload import MqttPayload + +two_digits_precision = lambda x: round(x, 2) + + +class TempHumDataPayload(MqttPayload): + FORMAT = '=dd' + UNPACKER = { + 'temp': two_digits_precision, + 'rh': two_digits_precision + } + + temp: float + rh: float -- cgit v1.2.3