Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: body_type NONE_VALUE checks #84

Merged
merged 2 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion midealocal/devices/e6/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
MessageRequest,
MessageResponse,
MessageType,
NONE_VALUE,
)


Expand All @@ -12,7 +13,7 @@ def __init__(self, protocol_version, message_type):
device_type=0xE6,
protocol_version=protocol_version,
message_type=message_type,
body_type=None,
body_type=NONE_VALUE,
)

@property
Expand Down
4 changes: 2 additions & 2 deletions midealocal/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __str__(self) -> str:
"body": self.body.hex(),
"message type": "%02x" % self._message_type,
"body type": (
("%02x" % self._body_type) if self._body_type is not None else "None"
("%02x" % self._body_type) if self._body_type is not NONE_VALUE else "None"
),
}
return str(output)
Expand Down Expand Up @@ -144,7 +144,7 @@ def _body(self) -> bytearray:
@property
def body(self) -> bytearray:
body = bytearray([])
if self.body_type is not None:
if self.body_type is not NONE_VALUE:
body.append(self.body_type)
if self._body is not None:
body.extend(self._body)
Expand Down
Loading