From a906d7f2cb642da6604c87b3ce163cf66c987fbe Mon Sep 17 00:00:00 2001 From: Simone Chemelli Date: Fri, 4 Oct 2024 16:21:03 +0000 Subject: [PATCH 1/3] fix: message protocol version default --- midealocal/device.py | 2 +- midealocal/message.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/midealocal/device.py b/midealocal/device.py index 6bce4e0c..4f2b9d75 100644 --- a/midealocal/device.py +++ b/midealocal/device.py @@ -97,7 +97,7 @@ def __init__( self._device_protocol_version = device_protocol self._model = model self._subtype = subtype - self._message_protocol_version: ProtocolVersion = ProtocolVersion.V1 + self._message_protocol_version: int = 0 self._updates: list[Callable[[dict[str, Any]], None]] = [] self._unsupported_protocol: list[str] = [] self._is_run = False diff --git a/midealocal/message.py b/midealocal/message.py index ba782611..75a76edb 100644 --- a/midealocal/message.py +++ b/midealocal/message.py @@ -4,7 +4,7 @@ from enum import IntEnum from typing import Generic, SupportsIndex, TypeVar, cast -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType _LOGGER = logging.getLogger(__name__) @@ -132,7 +132,7 @@ def __init__(self) -> None: self._device_type: DeviceType = DeviceType.X00 self._message_type: MessageType = MessageType.default self._body_type: BodyType = BodyType.X00 - self._message_protocol_version: ProtocolVersion = ProtocolVersion.V1 + self._message_protocol_version: int = 0 @staticmethod def checksum(data: bytes) -> SupportsIndex: @@ -177,12 +177,12 @@ def body_type(self, value: BodyType) -> None: self._body_type = value @property - def protocol_version(self) -> ProtocolVersion: + def protocol_version(self) -> int: """Message protocol version.""" return self._message_protocol_version @protocol_version.setter - def protocol_version(self, protocol_version: ProtocolVersion) -> None: + def protocol_version(self, protocol_version: int) -> None: self._message_protocol_version = protocol_version def _format_attribute( @@ -233,7 +233,7 @@ class MessageRequest(MessageBase): def __init__( self, device_type: DeviceType, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -299,7 +299,7 @@ class MessageQuestCustom(MessageRequest): def __init__( self, device_type: DeviceType, - protocol_version: ProtocolVersion, + protocol_version: int, cmd_type: MessageType, cmd_body: bytearray, ) -> None: @@ -329,7 +329,7 @@ def __init__(self, device_type: DeviceType) -> None: """Initialize message query appliance.""" super().__init__( device_type=device_type, - protocol_version=ProtocolVersion.V1, + protocol_version=0, message_type=MessageType.query_appliance, body_type=BodyType.X00, ) @@ -573,7 +573,7 @@ def __init__(self, message: bytearray) -> None: if message is None or len(message) < self.HEADER_LENGTH + 1: raise MessageLenError self._header = message[: self.HEADER_LENGTH] - self.protocol_version = ProtocolVersion(self._header[-2]) + self.protocol_version = self._header[-2] self.message_type = MessageType(self._header[-1]) self.device_type = DeviceType(self._header[2]) body = message[self.HEADER_LENGTH : -1] From c1911a3184f4161bc6e9ccabfa75186e1cc47232 Mon Sep 17 00:00:00 2001 From: Simone Chemelli Date: Fri, 4 Oct 2024 21:28:25 +0000 Subject: [PATCH 2/3] chore: adapt devices (a-f) --- midealocal/devices/a1/message.py | 6 +++--- midealocal/devices/ac/message.py | 24 ++++++++++++------------ midealocal/devices/b0/message.py | 4 ++-- midealocal/devices/b1/message.py | 6 +++--- midealocal/devices/b3/message.py | 6 +++--- midealocal/devices/b4/message.py | 6 +++--- midealocal/devices/b6/message.py | 10 ++++------ midealocal/devices/b8/message.py | 10 +++++----- midealocal/devices/bf/message.py | 4 ++-- midealocal/devices/c2/message.py | 8 ++++---- midealocal/devices/c3/message.py | 16 ++++++++-------- midealocal/devices/ca/message.py | 6 +++--- midealocal/devices/cc/message.py | 8 ++++---- midealocal/devices/cd/message.py | 8 ++++---- midealocal/devices/ce/message.py | 8 ++++---- midealocal/devices/cf/message.py | 8 ++++---- 16 files changed, 68 insertions(+), 70 deletions(-) diff --git a/midealocal/devices/a1/message.py b/midealocal/devices/a1/message.py index 3564ce54..4d31f89d 100644 --- a/midealocal/devices/a1/message.py +++ b/midealocal/devices/a1/message.py @@ -31,7 +31,7 @@ class MessageA1Base(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -62,7 +62,7 @@ def body(self) -> bytearray: class MessageQuery(MessageA1Base): """Message A1 query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize message A1 query.""" super().__init__( protocol_version=protocol_version, @@ -120,7 +120,7 @@ def _body(self) -> bytearray: class MessageSet(MessageA1Base): """Message A1 set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize message A1 set.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/ac/message.py b/midealocal/devices/ac/message.py index 2edaac83..1086fcb0 100644 --- a/midealocal/devices/ac/message.py +++ b/midealocal/devices/ac/message.py @@ -2,7 +2,7 @@ from enum import IntEnum -from midealocal.const import MAX_BYTE_VALUE, DeviceType, ProtocolVersion +from midealocal.const import MAX_BYTE_VALUE, DeviceType from midealocal.crc8 import calculate from midealocal.message import ( BodyType, @@ -106,7 +106,7 @@ class MessageACBase(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -137,7 +137,7 @@ def body(self) -> bytearray: class MessageQuery(MessageACBase): """AC message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize AC message query.""" super().__init__( protocol_version=protocol_version, @@ -177,7 +177,7 @@ class MessageCapabilitiesQuery(MessageACBase): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, additional_capabilities: bool, ) -> None: """Initialize AC message capabilities query.""" @@ -198,7 +198,7 @@ def _body(self) -> bytearray: class MessagePowerQuery(MessageACBase): """AC message power query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize AC message power query.""" super().__init__( protocol_version=protocol_version, @@ -221,7 +221,7 @@ def body(self) -> bytearray: class MessageToggleDisplay(MessageACBase): """AC message toggle display.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize AC message toggle display.""" super().__init__( protocol_version=protocol_version, @@ -261,7 +261,7 @@ def _body(self) -> bytearray: class MessageNewProtocolQuery(MessageACBase): """AC message new protocol query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize AC message new protocol query.""" super().__init__( protocol_version=protocol_version, @@ -291,7 +291,7 @@ class MessageSubProtocol(MessageACBase): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, subprotocol_query_type: int, ) -> None: @@ -339,7 +339,7 @@ class MessageSubProtocolQuery(MessageSubProtocol): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, subprotocol_query_type: int, ) -> None: """Initialize AC message sub protocol query.""" @@ -353,7 +353,7 @@ def __init__( class MessageSubProtocolSet(MessageSubProtocol): """AC message sub protocol set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize AC message sub protocol set.""" super().__init__( protocol_version=protocol_version, @@ -437,7 +437,7 @@ def _subprotocol_body(self) -> bytes: class MessageGeneralSet(MessageACBase): """AC message general set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize AC message general set.""" super().__init__( protocol_version=protocol_version, @@ -529,7 +529,7 @@ def _body(self) -> bytearray: class MessageNewProtocolSet(MessageACBase): """AC message new protocol set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize AC message new protocol set.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/b0/message.py b/midealocal/devices/b0/message.py index d02469f2..ab024f9b 100644 --- a/midealocal/devices/b0/message.py +++ b/midealocal/devices/b0/message.py @@ -17,7 +17,7 @@ class MessageB0Base(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -53,7 +53,7 @@ def _body(self) -> bytearray: class MessageQuery01(MessageB0Base): """B0 message query 01.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize B0 message query 01.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/b1/message.py b/midealocal/devices/b1/message.py index 065b613f..eec137d5 100644 --- a/midealocal/devices/b1/message.py +++ b/midealocal/devices/b1/message.py @@ -1,6 +1,6 @@ """Midea local B1 message.""" -from midealocal.const import MAX_BYTE_VALUE, DeviceType, ProtocolVersion +from midealocal.const import MAX_BYTE_VALUE, DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -15,7 +15,7 @@ class MessageB1Base(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -35,7 +35,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageB1Base): """B1 message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize B1 message query.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/b3/message.py b/midealocal/devices/b3/message.py index a7c7d807..ac1d4d40 100644 --- a/midealocal/devices/b3/message.py +++ b/midealocal/devices/b3/message.py @@ -1,6 +1,6 @@ """Midea local B3 message.""" -from midealocal.const import MAX_BYTE_VALUE, DeviceType, ProtocolVersion +from midealocal.const import MAX_BYTE_VALUE, DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -22,7 +22,7 @@ class MessageB3Base(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -42,7 +42,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageB3Base): """B3 message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize B3 message query.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/b4/message.py b/midealocal/devices/b4/message.py index 1973098e..507928c3 100644 --- a/midealocal/devices/b4/message.py +++ b/midealocal/devices/b4/message.py @@ -1,6 +1,6 @@ """Midea local B4 message.""" -from midealocal.const import MAX_BYTE_VALUE, DeviceType, ProtocolVersion +from midealocal.const import MAX_BYTE_VALUE, DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -15,7 +15,7 @@ class MessageB4Base(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -35,7 +35,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageB4Base): """B4 message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize B4 message query.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/b6/message.py b/midealocal/devices/b6/message.py index 069d6058..8bbf4ea7 100644 --- a/midealocal/devices/b6/message.py +++ b/midealocal/devices/b6/message.py @@ -21,7 +21,7 @@ class MessageB6Base(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -41,14 +41,12 @@ def _body(self) -> bytearray: class MessageQuery(MessageB6Base): """B6 message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize B6 message query.""" super().__init__( protocol_version=protocol_version, message_type=MessageType.query, - body_type=BodyType.X11 - if protocol_version == ProtocolVersion.V2 - else BodyType.X31, + body_type=BodyType.X11 if protocol_version == 2 else BodyType.X31, ) @property @@ -75,7 +73,7 @@ def _body(self) -> bytearray: class MessageSet(MessageB6Base): """B6 message set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize B6 message set.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/b8/message.py b/midealocal/devices/b8/message.py index 7584fa86..488731cf 100644 --- a/midealocal/devices/b8/message.py +++ b/midealocal/devices/b8/message.py @@ -1,6 +1,6 @@ """Midea local B8 message.""" -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, BoolParser, @@ -37,7 +37,7 @@ class MessageB8Base(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -57,7 +57,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageB8Base): """B8 message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize B8 message query.""" super().__init__( protocol_version=protocol_version, @@ -73,7 +73,7 @@ def _body(self) -> bytearray: class MessageSet(MessageB8Base): """B8 message set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize B8 message set.""" super().__init__( protocol_version=protocol_version, @@ -107,7 +107,7 @@ class MessageSetCommand(MessageB8Base): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, work_mode: B8WorkMode, ) -> None: """Initialize B8 message set command.""" diff --git a/midealocal/devices/bf/message.py b/midealocal/devices/bf/message.py index 5b34c0f8..2548d18f 100644 --- a/midealocal/devices/bf/message.py +++ b/midealocal/devices/bf/message.py @@ -15,7 +15,7 @@ class MessageBFBase(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -35,7 +35,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageBFBase): """BF message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize BF message query.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/c2/message.py b/midealocal/devices/c2/message.py index 4731ed5e..8376b6af 100644 --- a/midealocal/devices/c2/message.py +++ b/midealocal/devices/c2/message.py @@ -54,7 +54,7 @@ class MessageC2Base(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -74,7 +74,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageC2Base): """C2 message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize C2 message query.""" super().__init__( protocol_version=protocol_version, @@ -90,7 +90,7 @@ def _body(self) -> bytearray: class MessagePower(MessageC2Base): """C2 message power.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize C2 message power.""" super().__init__( protocol_version=protocol_version, @@ -127,7 +127,7 @@ def _body(self) -> bytearray: class MessageSet(MessageC2Base): """C2 message set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize C2 message set.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/c3/message.py b/midealocal/devices/c3/message.py index 9da2d08c..b8aa6f96 100644 --- a/midealocal/devices/c3/message.py +++ b/midealocal/devices/c3/message.py @@ -1,6 +1,6 @@ """Midea local C3 message.""" -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -19,7 +19,7 @@ class MessageC3Base(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -39,7 +39,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageC3Base): """C3 message query.""" - def __init__(self, protocol_version: ProtocolVersion, body_type: BodyType) -> None: + def __init__(self, protocol_version: int, body_type: BodyType) -> None: """Initialize C3 message query.""" super().__init__( protocol_version=protocol_version, @@ -55,7 +55,7 @@ def _body(self) -> bytearray: class MessageQueryBasic(MessageQuery): """C3 Message query basic.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize C3 message query basic.""" super().__init__(protocol_version, BodyType.X01) @@ -63,7 +63,7 @@ def __init__(self, protocol_version: ProtocolVersion) -> None: class MessageQuerySilence(MessageQuery): """C3 Message query silence.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize C3 message query silence.""" super().__init__(protocol_version, BodyType.X05) @@ -71,7 +71,7 @@ def __init__(self, protocol_version: ProtocolVersion) -> None: class MessageSet(MessageC3Base): """C3 message set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize C3 message set.""" super().__init__( protocol_version=protocol_version, @@ -122,7 +122,7 @@ def _body(self) -> bytearray: class MessageSetSilent(MessageC3Base): """C3 message set silent.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize C3 message set silent.""" super().__init__( protocol_version=protocol_version, @@ -152,7 +152,7 @@ def _body(self) -> bytearray: class MessageSetECO(MessageC3Base): """C3 message set eco.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize C3 message set eco.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/ca/message.py b/midealocal/devices/ca/message.py index c3f6817d..0f4e4c8e 100644 --- a/midealocal/devices/ca/message.py +++ b/midealocal/devices/ca/message.py @@ -1,6 +1,6 @@ """Midea local CA message.""" -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -21,7 +21,7 @@ class MessageCABase(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -41,7 +41,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageCABase): """CA message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize CA message query.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/cc/message.py b/midealocal/devices/cc/message.py index c7625aa8..3d133c3f 100644 --- a/midealocal/devices/cc/message.py +++ b/midealocal/devices/cc/message.py @@ -2,7 +2,7 @@ from enum import IntEnum -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -24,7 +24,7 @@ class MessageCCBase(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -44,7 +44,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageCCBase): """CC message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize CC message query.""" super().__init__( protocol_version=protocol_version, @@ -60,7 +60,7 @@ def _body(self) -> bytearray: class MessageSet(MessageCCBase): """CC message set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize CC message set.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/cd/message.py b/midealocal/devices/cd/message.py index 4634911c..67408d25 100644 --- a/midealocal/devices/cd/message.py +++ b/midealocal/devices/cd/message.py @@ -2,7 +2,7 @@ from typing import Any -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -17,7 +17,7 @@ class MessageCDBase(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -37,7 +37,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageCDBase): """CD message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize CD message query.""" super().__init__( protocol_version=protocol_version, @@ -53,7 +53,7 @@ def _body(self) -> bytearray: class MessageSet(MessageCDBase): """CD message set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize CD message set.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/ce/message.py b/midealocal/devices/ce/message.py index 842a843b..7f6a26e5 100644 --- a/midealocal/devices/ce/message.py +++ b/midealocal/devices/ce/message.py @@ -1,6 +1,6 @@ """Midea local CE message.""" -from midealocal.const import MAX_BYTE_VALUE, DeviceType, ProtocolVersion +from midealocal.const import MAX_BYTE_VALUE, DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -15,7 +15,7 @@ class MessageCEBase(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -35,7 +35,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageCEBase): """CE message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize CE message query.""" super().__init__( protocol_version=protocol_version, @@ -51,7 +51,7 @@ def _body(self) -> bytearray: class MessageSet(MessageCEBase): """CE message set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize CE message set.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/cf/message.py b/midealocal/devices/cf/message.py index 41feb180..934dc990 100644 --- a/midealocal/devices/cf/message.py +++ b/midealocal/devices/cf/message.py @@ -2,7 +2,7 @@ from enum import IntEnum -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -26,7 +26,7 @@ class MessageCFBase(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -46,7 +46,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageCFBase): """CF message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize CF message query.""" super().__init__( protocol_version=protocol_version, @@ -62,7 +62,7 @@ def _body(self) -> bytearray: class MessageSet(MessageCFBase): """CF message set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize CF message set.""" super().__init__( protocol_version=protocol_version, From d91a81c66df4c8685f9271a30084ad30dc8d8b5f Mon Sep 17 00:00:00 2001 From: Simone Chemelli Date: Fri, 4 Oct 2024 21:47:29 +0000 Subject: [PATCH 3/3] chore: adapt devices (f-x) --- midealocal/devices/da/message.py | 10 +++++----- midealocal/devices/db/message.py | 10 +++++----- midealocal/devices/dc/message.py | 10 +++++----- midealocal/devices/e1/message.py | 12 ++++++------ midealocal/devices/e2/message.py | 12 ++++++------ midealocal/devices/e3/message.py | 12 ++++++------ midealocal/devices/e6/message.py | 8 ++++---- midealocal/devices/e8/message.py | 6 +++--- midealocal/devices/ea/message.py | 6 +++--- midealocal/devices/ec/message.py | 6 +++--- midealocal/devices/ed/message.py | 10 +++++----- midealocal/devices/fa/message.py | 8 ++++---- midealocal/devices/fb/message.py | 8 ++++---- midealocal/devices/fc/message.py | 8 ++++---- midealocal/devices/fd/message.py | 8 ++++---- midealocal/devices/x13/message.py | 8 ++++---- midealocal/devices/x26/message.py | 8 ++++---- midealocal/devices/x34/message.py | 12 ++++++------ midealocal/devices/x40/message.py | 8 ++++---- 19 files changed, 85 insertions(+), 85 deletions(-) diff --git a/midealocal/devices/da/message.py b/midealocal/devices/da/message.py index cefdb272..493474cc 100644 --- a/midealocal/devices/da/message.py +++ b/midealocal/devices/da/message.py @@ -1,6 +1,6 @@ """Midea local DA message.""" -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -15,7 +15,7 @@ class MessageDABase(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -35,7 +35,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageDABase): """DA message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize DA message query.""" super().__init__( protocol_version=protocol_version, @@ -51,7 +51,7 @@ def _body(self) -> bytearray: class MessagePower(MessageDABase): """DA message power.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize DA message power.""" super().__init__( protocol_version=protocol_version, @@ -69,7 +69,7 @@ def _body(self) -> bytearray: class MessageStart(MessageDABase): """DA message start.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize DA message start.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/db/message.py b/midealocal/devices/db/message.py index 389861e0..93fb820d 100644 --- a/midealocal/devices/db/message.py +++ b/midealocal/devices/db/message.py @@ -1,6 +1,6 @@ """Midea local DB message.""" -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -15,7 +15,7 @@ class MessageDBBase(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -35,7 +35,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageDBBase): """DB message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize DB message query.""" super().__init__( protocol_version=protocol_version, @@ -51,7 +51,7 @@ def _body(self) -> bytearray: class MessagePower(MessageDBBase): """DB message power.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize DB message power.""" super().__init__( protocol_version=protocol_version, @@ -93,7 +93,7 @@ def _body(self) -> bytearray: class MessageStart(MessageDBBase): """DB message start.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize DB message start.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/dc/message.py b/midealocal/devices/dc/message.py index 9673ae9b..ce8e7d75 100644 --- a/midealocal/devices/dc/message.py +++ b/midealocal/devices/dc/message.py @@ -1,6 +1,6 @@ """Midea local DC message.""" -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -15,7 +15,7 @@ class MessageDCBase(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -35,7 +35,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageDCBase): """DC message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize DC message query.""" super().__init__( protocol_version=protocol_version, @@ -51,7 +51,7 @@ def _body(self) -> bytearray: class MessagePower(MessageDCBase): """DC message power.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize DC message power.""" super().__init__( protocol_version=protocol_version, @@ -69,7 +69,7 @@ def _body(self) -> bytearray: class MessageStart(MessageDCBase): """DC message start.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize DC message start.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/e1/message.py b/midealocal/devices/e1/message.py index 393ab807..b124d011 100644 --- a/midealocal/devices/e1/message.py +++ b/midealocal/devices/e1/message.py @@ -1,6 +1,6 @@ """Midea local E1 message.""" -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -19,7 +19,7 @@ class MessageE1Base(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -39,7 +39,7 @@ def _body(self) -> bytearray: class MessagePower(MessageE1Base): """E1 message power.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize E1 message power.""" super().__init__( protocol_version=protocol_version, @@ -57,7 +57,7 @@ def _body(self) -> bytearray: class MessageLock(MessageE1Base): """E1 message lock.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize E1 message lock.""" super().__init__( protocol_version=protocol_version, @@ -75,7 +75,7 @@ def _body(self) -> bytearray: class MessageStorage(MessageE1Base): """E1 message storage.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize E1 message storage.""" super().__init__( protocol_version=protocol_version, @@ -97,7 +97,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageE1Base): """E1 message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize E1 message query.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/e2/message.py b/midealocal/devices/e2/message.py index d46d67e4..0f520e1c 100644 --- a/midealocal/devices/e2/message.py +++ b/midealocal/devices/e2/message.py @@ -1,6 +1,6 @@ """Midea local E2 message.""" -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -19,7 +19,7 @@ class MessageE2Base(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -39,7 +39,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageE2Base): """E2 message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize E2 message query.""" super().__init__( protocol_version=protocol_version, @@ -55,7 +55,7 @@ def _body(self) -> bytearray: class MessagePower(MessageE2Base): """E2 message power.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize E2 message power.""" super().__init__( protocol_version=protocol_version, @@ -76,7 +76,7 @@ def _body(self) -> bytearray: class MessageNewProtocolSet(MessageE2Base): """E2 message new protocol set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize E2 message new protocol set.""" super().__init__( protocol_version=protocol_version, @@ -106,7 +106,7 @@ def _body(self) -> bytearray: class MessageSet(MessageE2Base): """E2 message set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize E2 message set.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/e3/message.py b/midealocal/devices/e3/message.py index baefc5d9..4a8cd9be 100644 --- a/midealocal/devices/e3/message.py +++ b/midealocal/devices/e3/message.py @@ -2,7 +2,7 @@ from typing import Any -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -27,7 +27,7 @@ class MessageE3Base(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -47,7 +47,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageE3Base): """E3 message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize E3 message query.""" super().__init__( protocol_version=protocol_version, @@ -63,7 +63,7 @@ def _body(self) -> bytearray: class MessagePower(MessageE3Base): """E3 message power.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize E3 message power.""" super().__init__( protocol_version=protocol_version, @@ -84,7 +84,7 @@ def _body(self) -> bytearray: class MessageSet(MessageE3Base): """E3 message set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize E3 message set.""" super().__init__( protocol_version=protocol_version, @@ -133,7 +133,7 @@ def _body(self) -> bytearray: class MessageNewProtocolSet(MessageE3Base): """E3 message new protocol set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize E3 message new protocol set.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/e6/message.py b/midealocal/devices/e6/message.py index 20ba849f..d492949a 100644 --- a/midealocal/devices/e6/message.py +++ b/midealocal/devices/e6/message.py @@ -1,6 +1,6 @@ """Midea local E6 message.""" -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -15,7 +15,7 @@ class MessageE6Base(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, ) -> None: """Initialize E6 message base.""" @@ -39,7 +39,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageE6Base): """E6 message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize E6 message query.""" super().__init__( protocol_version=protocol_version, @@ -54,7 +54,7 @@ def _body(self) -> bytearray: class MessageSet(MessageE6Base): """E6 message set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize E6 message set.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/e8/message.py b/midealocal/devices/e8/message.py index 2585063d..f8ab61b1 100644 --- a/midealocal/devices/e8/message.py +++ b/midealocal/devices/e8/message.py @@ -2,7 +2,7 @@ from enum import IntEnum -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -27,7 +27,7 @@ class MessageE8Base(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -47,7 +47,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageE8Base): """E8 message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize E8 message query.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/ea/message.py b/midealocal/devices/ea/message.py index bbdedfd0..d168052e 100644 --- a/midealocal/devices/ea/message.py +++ b/midealocal/devices/ea/message.py @@ -2,7 +2,7 @@ from enum import IntEnum -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -25,7 +25,7 @@ class MessageEABase(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType = BodyType.X00, ) -> None: @@ -45,7 +45,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageEABase): """EA message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize EA message query.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/ec/message.py b/midealocal/devices/ec/message.py index 29bc2e6f..c0f9cfed 100644 --- a/midealocal/devices/ec/message.py +++ b/midealocal/devices/ec/message.py @@ -1,6 +1,6 @@ """Midea local EC message.""" -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -16,7 +16,7 @@ class MessageECBase(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType = BodyType.X00, ) -> None: @@ -36,7 +36,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageECBase): """EC message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize EC message query.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/ed/message.py b/midealocal/devices/ed/message.py index 01e306b1..7a51549e 100644 --- a/midealocal/devices/ed/message.py +++ b/midealocal/devices/ed/message.py @@ -2,7 +2,7 @@ from enum import IntEnum -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -44,7 +44,7 @@ class MessageEDBase(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType = BodyType.X00, ) -> None: @@ -64,7 +64,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageEDBase): """ED message query.""" - def __init__(self, protocol_version: ProtocolVersion, body_type: BodyType) -> None: + def __init__(self, protocol_version: int, body_type: BodyType) -> None: """Initialize ED message query.""" super().__init__( protocol_version=protocol_version, @@ -80,7 +80,7 @@ def _body(self) -> bytearray: class MessageNewSet(MessageEDBase): """ED message new set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize ED message new set.""" super().__init__( protocol_version=protocol_version, @@ -117,7 +117,7 @@ def _body(self) -> bytearray: class MessageOldSet(MessageEDBase): """ED message old set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize ED message old set.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/fa/message.py b/midealocal/devices/fa/message.py index 52b6f395..f7ad927b 100644 --- a/midealocal/devices/fa/message.py +++ b/midealocal/devices/fa/message.py @@ -1,6 +1,6 @@ """Midea local FA message.""" -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -20,7 +20,7 @@ class MessageFABase(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType = BodyType.X00, ) -> None: @@ -40,7 +40,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageFABase): """Message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize the message with protocol version.""" super().__init__( protocol_version=protocol_version, @@ -60,7 +60,7 @@ def _body(self) -> bytearray: class MessageSet(MessageFABase): """Message set.""" - def __init__(self, protocol_version: ProtocolVersion, subtype: int) -> None: + def __init__(self, protocol_version: int, subtype: int) -> None: """Initialize the message with protocol version and subtype.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/fb/message.py b/midealocal/devices/fb/message.py index 9b7199f9..ec000d25 100644 --- a/midealocal/devices/fb/message.py +++ b/midealocal/devices/fb/message.py @@ -1,6 +1,6 @@ """Midea local FB message.""" -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -23,7 +23,7 @@ class MessageFBBase(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType = BodyType.X00, ) -> None: @@ -43,7 +43,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageFBBase): """FB message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize FB message query.""" super().__init__( protocol_version=protocol_version, @@ -63,7 +63,7 @@ def _body(self) -> bytearray: class MessageSet(MessageFBBase): """FB message set.""" - def __init__(self, protocol_version: ProtocolVersion, subtype: int) -> None: + def __init__(self, protocol_version: int, subtype: int) -> None: """Initialize FB message set.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/fc/message.py b/midealocal/devices/fc/message.py index d117c965..d0ef97f0 100644 --- a/midealocal/devices/fc/message.py +++ b/midealocal/devices/fc/message.py @@ -1,6 +1,6 @@ """Midea local FC message.""" -from midealocal.const import MAX_BYTE_VALUE, DeviceType, ProtocolVersion +from midealocal.const import MAX_BYTE_VALUE, DeviceType from midealocal.crc8 import calculate from midealocal.message import ( BodyType, @@ -35,7 +35,7 @@ class MessageFCBase(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -66,7 +66,7 @@ def body(self) -> bytearray: class MessageQuery(MessageFCBase): """FC message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize FC message query.""" super().__init__( protocol_version=protocol_version, @@ -104,7 +104,7 @@ def _body(self) -> bytearray: class MessageSet(MessageFCBase): """FC message set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize FC message set.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/fd/message.py b/midealocal/devices/fd/message.py index 0cd34988..2a550a87 100644 --- a/midealocal/devices/fd/message.py +++ b/midealocal/devices/fd/message.py @@ -1,6 +1,6 @@ """Midea local FD message.""" -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.crc8 import calculate from midealocal.message import ( BodyType, @@ -23,7 +23,7 @@ class MessageFDBase(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -54,7 +54,7 @@ def body(self) -> bytearray: class MessageQuery(MessageFDBase): """FD message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize FD message query.""" super().__init__( protocol_version=protocol_version, @@ -92,7 +92,7 @@ def _body(self) -> bytearray: class MessageSet(MessageFDBase): """FD message set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize FD message set.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/x13/message.py b/midealocal/devices/x13/message.py index dda2d813..da7b322e 100644 --- a/midealocal/devices/x13/message.py +++ b/midealocal/devices/x13/message.py @@ -1,6 +1,6 @@ """Midea local x13 device.""" -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -17,7 +17,7 @@ class Message13Base(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -37,7 +37,7 @@ def _body(self) -> bytearray: class MessageQuery(Message13Base): """X13 message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize X13 message query.""" super().__init__( protocol_version=protocol_version, @@ -53,7 +53,7 @@ def _body(self) -> bytearray: class MessageSet(Message13Base): """X13 message set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize X13 message set.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/x26/message.py b/midealocal/devices/x26/message.py index cc10d47a..2b3f0c70 100644 --- a/midealocal/devices/x26/message.py +++ b/midealocal/devices/x26/message.py @@ -3,7 +3,7 @@ from enum import IntEnum from typing import Any -from midealocal.const import MAX_BYTE_VALUE, DeviceType, ProtocolVersion +from midealocal.const import MAX_BYTE_VALUE, DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -32,7 +32,7 @@ class Message26Base(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -52,7 +52,7 @@ def _body(self) -> bytearray: class MessageQuery(Message26Base): """X26 message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize X26 message query.""" super().__init__( protocol_version=protocol_version, @@ -68,7 +68,7 @@ def _body(self) -> bytearray: class MessageSet(Message26Base): """X26 message set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize X26 message set.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/x34/message.py b/midealocal/devices/x34/message.py index 7837b1b3..a2eb74ed 100644 --- a/midealocal/devices/x34/message.py +++ b/midealocal/devices/x34/message.py @@ -1,6 +1,6 @@ """Midea local x34 message.""" -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -18,7 +18,7 @@ class Message34Base(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -38,7 +38,7 @@ def _body(self) -> bytearray: class MessageQuery(Message34Base): """X34 message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize X34 message query.""" super().__init__( protocol_version=protocol_version, @@ -54,7 +54,7 @@ def _body(self) -> bytearray: class MessagePower(Message34Base): """X34 message power.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize X34 message power.""" super().__init__( protocol_version=protocol_version, @@ -72,7 +72,7 @@ def _body(self) -> bytearray: class MessageLock(Message34Base): """X34 message lock.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize X34 message lock.""" super().__init__( protocol_version=protocol_version, @@ -90,7 +90,7 @@ def _body(self) -> bytearray: class MessageStorage(Message34Base): """X34 message storage.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize X34 message storage.""" super().__init__( protocol_version=protocol_version, diff --git a/midealocal/devices/x40/message.py b/midealocal/devices/x40/message.py index 33229e62..a6080563 100644 --- a/midealocal/devices/x40/message.py +++ b/midealocal/devices/x40/message.py @@ -2,7 +2,7 @@ from typing import Any -from midealocal.const import DeviceType, ProtocolVersion +from midealocal.const import DeviceType from midealocal.message import ( BodyType, MessageBody, @@ -19,7 +19,7 @@ class MessageX40Base(MessageRequest): def __init__( self, - protocol_version: ProtocolVersion, + protocol_version: int, message_type: MessageType, body_type: BodyType, ) -> None: @@ -39,7 +39,7 @@ def _body(self) -> bytearray: class MessageQuery(MessageX40Base): """X40 message query.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize X40 message query.""" super().__init__( protocol_version=protocol_version, @@ -55,7 +55,7 @@ def _body(self) -> bytearray: class MessageSet(MessageX40Base): """X40 message set.""" - def __init__(self, protocol_version: ProtocolVersion) -> None: + def __init__(self, protocol_version: int) -> None: """Initialize X40 message set.""" super().__init__( protocol_version=protocol_version,