-
-
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(db): add new attributes for db device #329
base: main
Are you sure you want to change the base?
Conversation
0x01: "Low", | ||
0x02: "Mid", | ||
0x03: "High", | ||
0x04: "4", |
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.
Should be "translated" to a string: VeryHigh
?
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 is the origina value from lua script.
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.
Please share the LUA script
midealocal/devices/db/__init__.py
Outdated
if value in MideaDBDevice._status: | ||
self._attributes[DeviceAttributes.status] = ( | ||
MideaDBDevice._status.get(value) | ||
) | ||
else: | ||
self._attributes[DeviceAttributes.status] = None |
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 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
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.
value may not list in _status, just return None.
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.
?
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.
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
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
|
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.