blob: 49029911e8210bb2efb53ff2b5dab616070a35fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
from .base_payload import MqttPayload
from .esp import (
OTAResultPayload,
OTAPayload,
InitialDiagnosticsPayload,
DiagnosticsPayload
)
class PowerPayload(MqttPayload):
FORMAT = '=12sB'
PACKER = {
'state': lambda n: int(n),
'secret': lambda s: s.encode('utf-8')
}
UNPACKER = {
'state': lambda n: bool(n),
'secret': lambda s: s.decode('utf-8')
}
secret: str
state: bool
|