-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: body_type default value is zero and not None (#271)
sorry for the delay to fix this bug, it should fix wuwentao/midea_ac_lan#176 and some other devies issue for boy_type value error when control devices. root cause from the debug log, just use power on device as example, **all the control message should be error** after this changes: current issue summary from the issue debug log: from `v0.4.1` to `v0.4.2` changes the `body_type` default value check condition casued this issue(the latest version is the same as v0.4.2) from the debug log we can found the issue root cause is : `v0.4.1`: `0000000001000000800000000000ff00000000` `v0.4.2`: `00000001000000800000000000ff00000000` > `v0.4.2` missed `00` in body message, after checked the source code, I found it should be `body_type` , and the default value should be `0x00`: midea_ac_lan `v0.4.1` using midealocal `v1.0.3` midea_ac_lan `v0.4.2` using midealocal `v1.1.2` code changes: in midealocal `v1.0.3`: https://github.com/rokam/midea-local/blob/46350f511ee0beceed8f8fb18be36a9f91378714/midealocal/message.py#L36 after changes to `v1.1.2`: https://github.com/rokam/midea-local/blob/2f53134cd051cac3ed69162878ce3846c14cbfba/midealocal/message.py#L117 so the default value chaged from `00` to `NONE`: in `v1.0.3`: https://github.com/rokam/midea-local/blob/46350f511ee0beceed8f8fb18be36a9f91378714/midealocal/message.py#L137 in `v1.1.2`: https://github.com/rokam/midea-local/blob/2f53134cd051cac3ed69162878ce3846c14cbfba/midealocal/message.py#L239 original code is `if self.body_type is not None:` and after changes is `if self.body_type != NONE_VALUE:` so there is no **body_type** default value `0x00` append to the body message and causes this issue. as this is a global message func, just rollback the code changes and it should append the body_type `0x00` to body message. in addition, also rename the `NONE_VALUE` to `ZERO_VALUE` as it's not none value, it should be zero value and still need to append to body message. please help to review and double confirm it. Thanks <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Updated the default value for the `body_type` parameter across multiple message classes from `NONE_VALUE` to `ZERO_VALUE`, enhancing clarity on how message body types are initialized. - **Bug Fixes** - Improved consistency in message handling by standardizing the representation of default values within the Message classes, potentially reducing issues related to uninitialized states. - **Documentation** - Clarified the intended use of the default value in the message initialization process, providing better understanding for developers working with message handling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information
Showing
7 changed files
with
22 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters