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

feat(db): add new attributes for db device #329

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

wuwentao
Copy link
Member

add new attributes for db device
fix wuwentao/midea_ac_lan#335

the remaining PR will be finished in midea_ac_lan with another PR later.

@github-actions github-actions bot added the enhancement New feature or request label Oct 16, 2024
@wuwentao wuwentao marked this pull request as draft October 16, 2024 09:11
midealocal/devices/db/__init__.py Show resolved Hide resolved
0x01: "Low",
0x02: "Mid",
0x03: "High",
0x04: "4",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be "translated" to a string: VeryHigh ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the origina value from lua script.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please share the LUA script

Comment on lines 243 to 248
if value in MideaDBDevice._status:
self._attributes[DeviceAttributes.status] = (
MideaDBDevice._status.get(value)
)
else:
self._attributes[DeviceAttributes.status] = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if value in MideaDBDevice._status:
self._attributes[DeviceAttributes.status] = (
MideaDBDevice._status.get(value)
)
else:
self._attributes[DeviceAttributes.status] = None
self._attributes[DeviceAttributes.status] = (
MideaDBDevice._status.get(value)
)

The purpose of get() is exactly to avoid the if

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value may not list in _status, just return None.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a very simple logic, if value not in list, we can't return error, just set the status to None.
so why you thinks the value always in _status ? we just list what we want to display, and it's not a full list with different sub modle for this device.
if there is any issue ,please add your comments, thanks

midealocal/devices/db/__init__.py Outdated Show resolved Hide resolved
midealocal/devices/db/__init__.py Outdated Show resolved Hide resolved
midealocal/devices/db/__init__.py Outdated Show resolved Hide resolved
midealocal/devices/db/__init__.py Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Oct 23, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 50 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
midealocal/devices/db/__init__.py 0.00% 35 Missing ⚠️
midealocal/devices/db/message.py 0.00% 15 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Files with missing lines Coverage Δ
midealocal/devices/db/message.py 0.00% <0.00%> (ø)
midealocal/devices/db/__init__.py 0.00% <0.00%> (ø)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature(DB): 希望能增加洗衣机中的洗衣液 柔顺剂的状态
3 participants