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 Roborock S7 mop scrub intensity #1236

Merged
merged 5 commits into from
Dec 26, 2021

Conversation

shred86
Copy link
Contributor

@shred86 shred86 commented Dec 12, 2021

The Roborock S7 has the option to control the scrub intensity with four different settings:

  • Close (raised position)
  • Mild
  • Moderate
  • Intense

The way to control these settings is actually identical to the current waterflow code using self.send("get_water_box_custom_mode") and self.send("set_water_box_custom_mode"). My initial thought was to just add a new MopIntensity class since the names of the settings are different and add a case to the existing waterflow and set_waterflow methods, so if it's an S7 it uses the new MopIntensity. However, the method names don't really make sense (which I'm assuming we don't want to change to prevent breaking apps relying on this library) so my thought is the better option is just to duplicate the methods with a new name.

Addresses #1215

@rytilahti
Copy link
Owner

My initial thought was to just add a new MopIntensity class since the names of the settings are different and add a case to the existing waterflow and set_waterflow methods, so if it's an S7 it uses the new MopIntensity. However, the method names don't really make sense (which I'm assuming we don't want to change to prevent breaking apps relying on this library) so my thought is the better option is just to duplicate the methods with a new name.

I think it makes sense to have a separate method as it makes the API cleaner. That being said, there's nothing that prevents us changing the method names if necessary, we can always deprecate the old name and make it a wrapper to call the new functionality prior to removing it.

@shred86
Copy link
Contributor Author

shred86 commented Dec 13, 2021

Ah, good point. Well, I do think having it separate would probably be better for future considerations anyways. I wouldn't be surprised to see robot vacuums start being released with both a water and scrub intensity setting.

@codecov-commenter
Copy link

codecov-commenter commented Dec 13, 2021

Codecov Report

Merging #1236 (740a2ac) into master (4342e3d) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1236      +/-   ##
==========================================
+ Coverage   79.26%   79.30%   +0.04%     
==========================================
  Files          90       90              
  Lines        9729     9748      +19     
  Branches     1130     1171      +41     
==========================================
+ Hits         7712     7731      +19     
  Misses       1825     1825              
  Partials      192      192              
Impacted Files Coverage Δ
.../integrations/vacuum/roborock/tests/test_vacuum.py 98.31% <100.00%> (+0.23%) ⬆️
miio/integrations/vacuum/roborock/vacuum.py 62.84% <100.00%> (+1.52%) ⬆️
miio/gateway/alarm.py 55.55% <0.00%> (-15.18%) ⬇️
miio/gateway/light.py 27.27% <0.00%> (-13.03%) ⬇️
miio/gateway/zigbee.py 57.14% <0.00%> (-10.72%) ⬇️
miio/gateway/radio.py 52.50% <0.00%> (-6.20%) ⬇️
miio/gateway/gatewaydevice.py 66.66% <0.00%> (-4.77%) ⬇️
miio/waterpurifier_yunmi.py 65.34% <0.00%> (-0.66%) ⬇️
miio/integrations/yeelight/__init__.py 87.22% <0.00%> (-0.56%) ⬇️
miio/cooker.py 58.30% <0.00%> (-0.19%) ⬇️
... and 16 more

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 4342e3d...740a2ac. Read the comment docs.

@rytilahti
Copy link
Owner

Would you mind adding a couple of tests to make sure this also stays working in case this gets refactored in the future? This is otherwise good to go 👍

@shred86
Copy link
Contributor Author

shred86 commented Dec 13, 2021

Will do! Any ideas how I can change self._model within a test method? It's been a while since I've messed with tests and after about an hour of searching, I'm a bit stumped. The DummyVacuum test class is initialized with self._model = "missing.model.vacuum" but I basically need to change that to "roborock.vacuum.a15" to be able to test everything else besides raising an exception.

@rytilahti
Copy link
Owner

For the time being, I'd just change the _model inside your test for the dummy. The test code is messy and should be refactored, but it's not a small effort so..

@shred86
Copy link
Contributor Author

shred86 commented Dec 26, 2021

Sorry for the delay - hopefully this will work.

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.

LGTM, thanks @shred86 and happy holidays!

@rytilahti rytilahti merged commit fd98051 into rytilahti:master Dec 26, 2021
@rytilahti rytilahti changed the title Add S7 mop scrub intensity Add Roborock S7 mop scrub intensity Dec 26, 2021
@shred86 shred86 deleted the s7_scrub_intensity branch December 26, 2021 18:40
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.

3 participants