From d24d417fa872e261b9c1662d3b2e0f67a84769f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Mind=C3=AAllo=20de=20Andrade?= Date: Tue, 6 Aug 2024 09:42:26 +0000 Subject: [PATCH] feat(e1): change work mode --- midealocal/devices/e1/message.py | 18 ++++++++++++++++++ midealocal/message.py | 1 + 2 files changed, 19 insertions(+) diff --git a/midealocal/devices/e1/message.py b/midealocal/devices/e1/message.py index 9e39615b..345e7060 100644 --- a/midealocal/devices/e1/message.py +++ b/midealocal/devices/e1/message.py @@ -53,6 +53,24 @@ def _body(self) -> bytearray: return bytearray([power, 0x00, 0x00, 0x00]) +class MessageWork(MessageE1Base): + """E1 message work.""" + + def __init__(self, protocol_version: int) -> None: + """Initialize E1 message work.""" + super().__init__( + protocol_version=protocol_version, + message_type=MessageType.set, + body_type=BodyType.X08, + ) + self.work_status = 0x3 + self.mode = 0 + + @property + def _body(self) -> bytearray: + return bytearray([self.work_status, self.mode, 0x00, 0x00]) + + class MessageLock(MessageE1Base): """E1 message lock.""" diff --git a/midealocal/message.py b/midealocal/message.py index 1dd6dcaa..b18c39d6 100644 --- a/midealocal/message.py +++ b/midealocal/message.py @@ -30,6 +30,7 @@ class BodyType(IntEnum): X05 = 0x05 X06 = 0x06 X07 = 0x07 + X08 = 0x08 X0A = 0x0A X11 = 0x11 X21 = 0x21