python-miio icon indicating copy to clipboard operation
python-miio copied to clipboard

Added initial zhimi.humidifier.ca6 support

Open smmoroz opened this issue 1 year ago • 2 comments

See #1884 for more information.

smmoroz avatar Jan 09 '24 00:01 smmoroz

Codecov Report

Attention: Patch coverage is 91.97080% with 22 lines in your changes are missing coverage. Please review.

Project coverage is 81.58%. Comparing base (8643a57) to head (252e49c). Report is 3 commits behind head on master.

Files Patch % Lines
...ntegrations/zhimi/humidifier/airhumidifier_miot.py 86.70% 13 Missing and 8 partials :warning:
...mi/humidifier/tests/test_airhumidifier_miot_ca6.py 99.12% 0 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1885      +/-   ##
==========================================
+ Coverage   81.41%   81.58%   +0.16%     
==========================================
  Files         193      194       +1     
  Lines       18636    18857     +221     
  Branches     4045     4114      +69     
==========================================
+ Hits        15173    15384     +211     
- Misses       3180     3185       +5     
- Partials      283      288       +5     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jan 09 '24 01:01 codecov[bot]

Dear @rytilahti and @syssi , first of all, I have to say that I'm not a professional software developer for a long time. Thus please excuse me for my way of working with GitHub (branching, PR, etc.)

In addition to this PR I have implemented initial support of zhimi.humidifier.ca6 in home-assistant/core in this branch. All zhimi.humidifier.ca6 features work well. Below are a couple of screenshots.

But I can't make PR to home-assistant/core because of the manifest.json. I have to use custom requirements (see below), which I can't commit to home-assistant/core repo:

  "requirements": ["construct==2.10.68", "micloud==0.5", "git+https://github.com/smmoroz/python-miio.git#python-miio==0.6.0"],

So, I don't know how to proceed. Maybe you can backport my changes and release 0.5.13 of python-miio?

Here are a few screenshots from HA:

CleanShot 2024-01-13 at 11 12 11@2x CleanShot 2024-01-13 at 11 13 46@2x

smmoroz avatar Jan 13 '24 10:01 smmoroz

Sorry for the late reply, but instead of creating a new file to maintain, it would be better to either use genericmiot or adapt the airhumidifer_miot as necessary.

I moved CA6 support to airhumidifer_miot file. Please review.

I also noticed that in order to support status command of miiocli, I need to implement @sensor and @setting. This is not yet done. BTW, status doesn't work even for CA4 devices.

smmoroz avatar Feb 18 '24 21:02 smmoroz

I added @sensor and @setting to AirHumidifierMiot and its subclasses. But I'm not sure I did it in the most elegant way, because I had to use embed method in subclasses.

smmoroz avatar Feb 18 '24 21:02 smmoroz

+1

tomaszzmuda avatar Mar 11 '24 09:03 tomaszzmuda

+1

TB-SE avatar Mar 12 '24 11:03 TB-SE

Looks much better, thanks. I'm wondering, are these devices so different that they wouldn't fit in the same implementation class?

rytilahti avatar Mar 13 '24 14:03 rytilahti