summaryrefslogtreecommitdiff
path: root/src/home/mqtt/payload/sensors.py
blob: 3ecc243faa446f49d8b42a9508bd82f6db8bdfac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from .base_payload import MQTTPayload

_mult_100 = lambda n: int(n*100)
_div_100 = lambda n: n/100


class Temperature(MQTTPayload):
    FORMAT = 'IhH'
    PACKER = {
        'temp': _mult_100,
        'rh': _mult_100,
    }
    UNPACKER = {
        'temp': _div_100,
        'rh': _div_100,
    }

    time: int
    temp: float
    rh: float