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