Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@supar
Copy link
Contributor

@supar supar commented Nov 29, 2021

Support of the deerma.humidifier.jsqs

Model: deerma.humidifier.jsqs
Hardware version: esp8266
Firmware version: 2.1.3

Closes #1225

@supar
Copy link
Contributor Author

supar commented Nov 29, 2021

I need for the support of the "Mi Smart Humidifer S (deerma.humidifier.jsqs)". I'm not python developer at all so took example from airhumidifier_miot. I tested the code with my device.
I would be glad to get some feed back, or the help how to improve code if required.

@syssi
Copy link
Collaborator

syssi commented Nov 29, 2021

Could you try to add some tests? Some bullet points to simplify the job:

  1. Make a copy of https://github.com/rytilahti/python-miio/blob/master/miio/tests/test_airhumidifier_miot.py -> test_airhumidifier_jsqs.py
  2. Update the _INITIAL_STATE to the state of your device
  3. Drop useless tests. Add new ones / update the existing one to the methods of your device.

@manfred-mp
Copy link

Mi Smart Antibacterial Humidifier (deerma.humidifier.jsq5): https://home.miot-spec.com/spec?type=urn%3Amiot-spec-v2%3Adevice%3Ahumidifier%3A0000A00E%3Adeerma-jsq5%3A1

This is almost identical except SIID7;PIID 3 (overwet protect) is missing. Can this model be added at the same time, please?

@codecov-commenter
Copy link

codecov-commenter commented Dec 4, 2021

Codecov Report

Merging #1193 (7c22ff8) into master (17e713a) will increase coverage by 0.19%.
The diff coverage is 95.29%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1193      +/-   ##
==========================================
+ Coverage   82.34%   82.53%   +0.19%     
==========================================
  Files         106      109       +3     
  Lines       11404    11574     +170     
  Branches     1354     1367      +13     
==========================================
+ Hits         9391     9553     +162     
- Misses       1821     1825       +4     
- Partials      192      196       +4     
Impacted Files Coverage Δ
miio/discovery.py 49.33% <ø> (ø)
...tegrations/humidifier/deerma/airhumidifier_jsqs.py 92.13% <92.13%> (ø)
...humidifier/deerma/tests/test_airhumidifier_jsqs.py 98.73% <98.73%> (ø)
miio/__init__.py 100.00% <100.00%> (ø)
miio/integrations/humidifier/deerma/__init__.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 17e713a...7c22ff8. Read the comment docs.

@syssi
Copy link
Collaborator

syssi commented Dec 4, 2021

Thanks a lot! This is good to go. If you want to make it perfect you could check this visualization:

https://app.codecov.io/gh/rytilahti/python-miio/compare/1193/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr%20comments&utm_term=Teemu%20R.#diff-bWlpby9haXJodW1pZGlmaWVyX2pzcXMucHk=

And expand the miio/airhumidifier_jsqs.py coverage report at the bottom. Every line indicated with a red bar is untested. You could add additional tests to test additional code paths to increase the test coverage of your new implementation.

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.

Please create a new directory in under miio.integration and move all relevant code (incl. tests) under it. Perhaps miio/integration/humidifier/deerma/?

@fredronnv
Copy link

@supar I've got some time to work on this and would like to move this PR forward, as I'm testing it with deerma.humidifier.jsq5. @rytilahti I could submit a separate PR with the cleanups you've requested, if this is the best way forward?

@supar
Copy link
Contributor Author

supar commented Dec 15, 2021

@supar I've got some time to work on this and would like to move this PR forward, as I'm testing it with deerma.humidifier.jsq5. @rytilahti I could submit a separate PR with the cleanups you've requested, if this is the best way forward?

What is the difference between *.jsqs and jsq5

@fredronnv
Copy link

@supar I've got some time to work on this and would like to move this PR forward, as I'm testing it with deerma.humidifier.jsq5. @rytilahti I could submit a separate PR with the cleanups you've requested, if this is the best way forward?

What is the difference between *.jsqs and jsq5

As far as I can tell, the jsq5 does not include overwet protection, otherwise everything from the code for jsqs functions as expected.

@supar
Copy link
Contributor Author

supar commented Dec 19, 2021

@rytilahti i moved file to the separate directory as You suggested. But i'm not experienced how in one class keep support for two model which are different only in one property. Does it mean to make copy code of the properties, classes?

@rytilahti
Copy link
Owner

@supar you can either create a separate mapping and select the one to use for the query by checking the model (using model property), or better yet, have a single mapping and remove the unsupported property from the query just prior querying. The methods that set the state (actions or setters) for the unsupported property should raise an exception if the feature is not supported (based on that model information).

I'll take another review in the upcoming days but the code looks good on surface after the linting issues are solved. Btw, you can execute pre-commit run -a or tox -e lint on your local setup to perform the checks :-)

@tancou
Copy link

tancou commented Jan 19, 2022

Hi,
I've tested with my deerma.humidifier.jsq5 and it works great.
I've just the following warning

WARNING:miio.device:Found an unsupported model 'deerma.humidifier.jsq5' for class 'AirHumidifierJsqs'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/

I really hope this PR will be merged, and if @supar can take into consideration the jsq5 variant, it could be awesome !

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.

Please update the README.md and fix the export, and then this is good to go! 🎉

@rytilahti
Copy link
Owner

This is good to go, thanks @supar!

@rytilahti rytilahti changed the title Add support of the deerma.humidifier.jsqs Add support for deerma.humidifier.jsq{s,5} Jan 22, 2022
@rytilahti rytilahti merged commit 7daa6e1 into rytilahti:master Jan 22, 2022
rytilahti added a commit that referenced this pull request Feb 17, 2022
This release adds support for several new devices (see details below, thanks to @PRO-2684, @peleccom, @ymj0424, and @supar), and contains improvements to Roborock S7, yeelight and gateway integrations (thanks to @starkillerOG, @Kirmas,>

Python 3.6 is no longer supported, and Fan{V2,SA1,ZA1,ZA3,ZA4} utility classes are now removed in favor of using Fan class.

[Full Changelog](0.5.9.2...0.5.10)

**Breaking changes:**

- Split fan.py to vendor-specific fan integrations [\#1304](#1304) (@rytilahti)
- Drop python 3.6 support [\#1263](#1263) (@rytilahti)

**Implemented enhancements:**

- Improve miotdevice mappings handling [\#1302](#1302) (@rytilahti)
- airpurifier\_miot: force aqi update prior fetching data [\#1282](#1282) (@rytilahti)
- improve gateway error messages [\#1261](#1261) (@starkillerOG)
- yeelight: use and expose the color temp range from specs [\#1247](#1247) (@Kirmas)
- Add Roborock S7 mop scrub intensity [\#1236](#1236) (@shred86)

**New devices:**

- Add support for zhimi.heater.za2 [\#1301](#1301) (@PRO-2684)
- Dreame F9 Vacuum \(dreame.vacuum.p2008\) support [\#1290](#1290) (@peleccom)
- Add support for Air Purifier 4 Pro \(zhimi.airp.va2\) [\#1287](#1287) (@ymj0424)
- Add support for deerma.humidifier.jsq{s,5} [\#1193](#1193) (@supar)

**Merged pull requests:**

- Add roborock.vacuum.a23 to supported models [\#1314](#1314) (@rytilahti)
- Move philips light implementations to integrations/light/philips [\#1306](#1306) (@rytilahti)
- Move leshow fan implementation to integrations/fan/leshow/ [\#1305](#1305) (@rytilahti)
- Split fan\_miot.py to vendor-specific fan integrations [\#1303](#1303) (@rytilahti)
- Add chuangmi.remote.v2 to chuangmiir [\#1299](#1299) (@rytilahti)
- Perform pypi release on github release [\#1298](#1298) (@rytilahti)
- Print debug recv contents prior accessing its contents [\#1293](#1293) (@rytilahti)
- Add more supported models [\#1292](#1292) (@rytilahti)
- Add more supported models [\#1275](#1275) (@rytilahti)
- Update installation instructions to use poetry [\#1259](#1259) (@rytilahti)
- Add more supported models based on discovery.py's mdns records [\#1258](#1258) (@rytilahti)
@rytilahti rytilahti mentioned this pull request Feb 17, 2022
rytilahti added a commit that referenced this pull request Feb 17, 2022
This release adds support for several new devices (see details below, thanks to @PRO-2684, @peleccom, @ymj0424, and @supar), and contains improvements to Roborock S7, yeelight and gateway integrations (thanks to @starkillerOG, @Kirmas, and @shred86).
Thanks also to everyone who has reported their working model information, we can use this information to provide better discovery in the future and this release silences the warning for known working models.

Python 3.6 is no longer supported, and Fan{V2,SA1,ZA1,ZA3,ZA4} utility classes are now removed in favor of using Fan class.

[Full Changelog](0.5.9.2...0.5.10)

**Breaking changes:**

- Split fan.py to vendor-specific fan integrations [\#1304](#1304) (@rytilahti)
- Drop python 3.6 support [\#1263](#1263) (@rytilahti)

**Implemented enhancements:**

- Improve miotdevice mappings handling [\#1302](#1302) (@rytilahti)
- airpurifier\_miot: force aqi update prior fetching data [\#1282](#1282) (@rytilahti)
- improve gateway error messages [\#1261](#1261) (@starkillerOG)
- yeelight: use and expose the color temp range from specs [\#1247](#1247) (@Kirmas)
- Add Roborock S7 mop scrub intensity [\#1236](#1236) (@shred86)

**New devices:**

- Add support for zhimi.heater.za2 [\#1301](#1301) (@PRO-2684)
- Dreame F9 Vacuum \(dreame.vacuum.p2008\) support [\#1290](#1290) (@peleccom)
- Add support for Air Purifier 4 Pro \(zhimi.airp.va2\) [\#1287](#1287) (@ymj0424)
- Add support for deerma.humidifier.jsq{s,5} [\#1193](#1193) (@supar)

**Merged pull requests:**

- Add roborock.vacuum.a23 to supported models [\#1314](#1314) (@rytilahti)
- Move philips light implementations to integrations/light/philips [\#1306](#1306) (@rytilahti)
- Move leshow fan implementation to integrations/fan/leshow/ [\#1305](#1305) (@rytilahti)
- Split fan\_miot.py to vendor-specific fan integrations [\#1303](#1303) (@rytilahti)
- Add chuangmi.remote.v2 to chuangmiir [\#1299](#1299) (@rytilahti)
- Perform pypi release on github release [\#1298](#1298) (@rytilahti)
- Print debug recv contents prior accessing its contents [\#1293](#1293) (@rytilahti)
- Add more supported models [\#1292](#1292) (@rytilahti)
- Add more supported models [\#1275](#1275) (@rytilahti)
- Update installation instructions to use poetry [\#1259](#1259) (@rytilahti)
- Add more supported models based on discovery.py's mdns records [\#1258](#1258) (@rytilahti)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mijia Smart Sterilization Humidifier - deerma.humidifier.jsq5

7 participants