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

Add additional mode of Air Purifier Super 2 #1054

Merged
merged 1 commit into from
Jun 4, 2021

Conversation

daxingplay
Copy link
Contributor

I got an error message when I try to add my Xiaomi Air Purifier Super 2(model: zhimi.airpurifier.sa2) into HA using this custom component.

xiaomi_miio_airpurifier: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 407, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 516, in async_device_update
    await task
  File "/config/custom_components/xiaomi_miio_airpurifier/fan.py", line 1400, in async_update
    {
  File "/config/custom_components/xiaomi_miio_airpurifier/fan.py", line 1401, in <dictcomp>
    key: self._extract_value_from_attribute(state, value)
  File "/config/custom_components/xiaomi_miio_airpurifier/fan.py", line 1250, in _extract_value_from_attribute
    value = getattr(state, attribute)
  File "/usr/local/lib/python3.8/site-packages/miio/airpurifier.py", line 154, in mode
    return OperationMode(self.data["mode"])
  File "/usr/local/lib/python3.8/enum.py", line 339, in __call__
    return cls.__new__(cls, value)
  File "/usr/local/lib/python3.8/enum.py", line 662, in __new__
    raise ve_exc
ValueError: 'low' is not a valid OperationMode

With this message, I found that the OperationModelow is not defined in python-miio. I added it into miio package file airpurifier.py directly on my HA server and it works. So I open this PR to make this work.

Signed-off-by: daxingplay <daxingplay@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Jun 4, 2021

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.43%. Comparing base (6453bfe) to head (7e55513).
Report is 384 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1054   +/-   ##
=======================================
  Coverage   75.42%   75.43%           
=======================================
  Files          73       73           
  Lines        8359     8360    +1     
  Branches      744      744           
=======================================
+ Hits         6305     6306    +1     
  Misses       1870     1870           
  Partials      184      184           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

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

Thanks! 👍

@rytilahti rytilahti merged commit 14652f6 into rytilahti:master Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants