-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat(ed): add new query01 msg for ed device #328
base: main
Are you sure you want to change the base?
Conversation
2b88e7a
to
725fb6b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to create another class and not to use the body_type parameter?
I prefer that you create the query message twice each one with a different body type.
@rokam please check the source code from device.py with refresh_status steps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it with suggestions to be clear. It will work.
return [MessageQuery(self._message_protocol_version, self._device_class)] | ||
return [ | ||
MessageQuery(self._message_protocol_version), | ||
MessageQuery01(self._message_protocol_version), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MessageQuery01(self._message_protocol_version), | |
MessageQuery(self._message_protocol_version, ListTypes.X01), |
"""Midea ED device build query.""" | ||
return [MessageQuery(self._message_protocol_version, self._device_class)] | ||
return [ | ||
MessageQuery(self._message_protocol_version), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MessageQuery(self._message_protocol_version), | |
MessageQuery(self._message_protocol_version, ListTypes.X00), |
assert isinstance(queries[0], MessageQuery) | ||
assert isinstance(queries[1], MessageQuery01) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check body_type value here.
@@ -14,6 +14,7 @@ | |||
MessageEDResponse, | |||
MessageNewSet, | |||
MessageQuery, | |||
MessageQuery01, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MessageQuery01, |
@@ -77,6 +81,26 @@ def _body(self) -> bytearray: | |||
return bytearray([0x01]) | |||
|
|||
|
|||
class MessageQuery01(MessageEDBase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class isn't needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, self._device_class = ListTypes.X00
isn't needed anymore.
@@ -77,9 +83,12 @@ def _use_new_set(self) -> bool: | |||
# if (self.sub_type > 342 or self.sub_type == 340) else False | |||
return True | |||
|
|||
def build_query(self) -> list[MessageQuery]: | |||
def build_query(self) -> list[MessageQuery | MessageQuery01]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def build_query(self) -> list[MessageQuery | MessageQuery01]: | |
def build_query(self) -> list[MessageQuery]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if device NOT support MessageQuery
and ONLY support MessageQuery01
, we only use MessageQuery
with the same name, when device send MessageQuery
with body 00, it will add MessageQuery
to self._unsupported_protocol
, so MessageQuery
with body 01 will be ignored and can't work anymore.
this is the reason why we need to add it with a different class name
add new query01 msg for ed devices
fix wuwentao/midea_ac_lan#352