Skip to content

Initial support for vacuums (clean module) #944

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

Merged
merged 43 commits into from
Jan 14, 2025
Merged

Initial support for vacuums (clean module) #944

merged 43 commits into from
Jan 14, 2025

Conversation

rytilahti
Copy link
Member

@rytilahti rytilahti commented Jun 2, 2024

Adds support for clean module:

  • Show current vacuum state
  • Start cleaning (all rooms)
  • Return to dock
  • Pausing & unpausing
  • Controlling the fan speed

@rytilahti rytilahti added the enhancement New feature or request label Jun 2, 2024
@rytilahti rytilahti force-pushed the feat/tokentransport branch 2 times, most recently from 69369f7 to 8886600 Compare November 28, 2024 17:01
@rytilahti rytilahti force-pushed the feat/vacuum branch 2 times, most recently from cee3933 to 72c9db3 Compare November 30, 2024 15:17
Base automatically changed from feat/tokentransport to master December 1, 2024 17:06
Copy link

codecov bot commented Dec 2, 2024

Codecov Report

Attention: Patch coverage is 96.58120% with 4 lines in your changes missing coverage. Please review.

Project coverage is 92.64%. Comparing base (be34dbd) to head (0e6fb77).
Report is 58 commits behind head on master.

Files with missing lines Patch % Lines
kasa/smart/modules/clean.py 96.26% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #944      +/-   ##
==========================================
+ Coverage   92.56%   92.64%   +0.07%     
==========================================
  Files         133      134       +1     
  Lines        8344     8459     +115     
  Branches      860      867       +7     
==========================================
+ Hits         7724     7837     +113     
- Misses        454      455       +1     
- Partials      166      167       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@devinsmith911
Copy link

Tested this initial PR with a Tapo RV30 Plus.

All functionality listed in the description seems to work fine, (start cleaning, pause, head home, status, fan speed control).

This model has the ability to empty the dust bin, which would be awesome to add here, but obviously not imperative for an initial implementation.

@vincep5
Copy link

vincep5 commented Jan 4, 2025

I've been testing with a RV30 Max machine (does not have the auto empty dock). Start, Pause, Head home, and adjusting the fan speed are all working great via the command line in my test environment. I was also able to throw some errors like the dustbin is missing and lidar was blocked.
Thanks

@rytilahti
Copy link
Member Author

Thanks for testing and reporting back!

I think this is getting close to be ready to get merged, after unit tests are added and after the irrelevant (klap support, ..) commits are extracted and removed.
Before merging, this module should be renamed to keep "Vacuum" reserved for an API that exposes different basic vacuum features (like speaker controls to locate the device, ref #1332).

This model has the ability to empty the dust bin, which would be awesome to add here, but obviously not imperative for an initial implementation.

Ask and you'll receive! #1423 adds initial implementation, feel free to test and report on that PR if it's working as expected :-)

@devinsmith911
Copy link

Thanks for testing and reporting back!

I think this is getting close to be ready to get merged, after unit tests are added and after the irrelevant (klap support, ..) commits are extracted and removed. Before merging, this module should be renamed to keep "Vacuum" reserved for an API that exposes different basic vacuum features (like speaker controls to locate the device, ref #1332).

This model has the ability to empty the dust bin, which would be awesome to add here, but obviously not imperative for an initial implementation.

Ask and you'll receive! #1423 adds initial implementation, feel free to test and report on that PR if it's working as expected :-)

Thanks for this, will test that out.
Ran into a situation today where the vacuum is returning status 8 which appears to me to be IDLE state, since it's not docked but also not cleaning or errored.
Have others confirmed that 0 is the correct status for IDLE, or is that perhaps not the case?

@KwFung7
Copy link

KwFung7 commented Jan 6, 2025

@rytilahti I have RV30 robot vacuum at home and I'm willing to help on testing at leisure.

I'm a software engineer but I'm not sure how I could point to specific branch of python-kass from HA, could I have some clues as Im quite new to HA community.

@devinsmith911
Copy link

Thanks for testing and reporting back!
I think this is getting close to be ready to get merged, after unit tests are added and after the irrelevant (klap support, ..) commits are extracted and removed. Before merging, this module should be renamed to keep "Vacuum" reserved for an API that exposes different basic vacuum features (like speaker controls to locate the device, ref #1332).

This model has the ability to empty the dust bin, which would be awesome to add here, but obviously not imperative for an initial implementation.

Ask and you'll receive! #1423 adds initial implementation, feel free to test and report on that PR if it's working as expected :-)

Thanks for this, will test that out. Ran into a situation today where the vacuum is returning status 8 which appears to me to be IDLE state, since it's not docked but also not cleaning or errored. Have others confirmed that 0 is the correct status for IDLE, or is that perhaps not the case?

This was resolved by the latest commit adding the undocked state 👍

@rytilahti rytilahti force-pushed the feat/vacuum branch 2 times, most recently from a5cf10e to 1a24f57 Compare January 11, 2025 13:27
@rytilahti rytilahti marked this pull request as ready for review January 12, 2025 12:55
@rytilahti rytilahti force-pushed the feat/vacuum branch 2 times, most recently from 97fdf52 to 7315196 Compare January 12, 2025 14:03
Copy link
Collaborator

@sdb9696 sdb9696 left a comment

Choose a reason for hiding this comment

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

LGTM

@rytilahti rytilahti requested a review from sdb9696 January 13, 2025 15:38
Copy link
Collaborator

@sdb9696 sdb9696 left a comment

Choose a reason for hiding this comment

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

LGTM! Let's merge it!

@rytilahti rytilahti linked an issue Jan 14, 2025 that may be closed by this pull request
@rytilahti rytilahti merged commit 1be8767 into master Jan 14, 2025
18 checks passed
@rytilahti rytilahti deleted the feat/vacuum branch January 14, 2025 14:35
@sdb9696 sdb9696 mentioned this pull request Jan 22, 2025
sdb9696 added a commit that referenced this pull request Jan 26, 2025
## [0.10.0](https://github.com/python-kasa/python-kasa/tree/0.10.0) (2025-01-26)

[Full Changelog](0.9.1...0.10.0)

**Release summary:**

This release brings support for many new devices, including completely new device types:

- Support for Tapo robot vacuums. Special thanks to @steveredden, @MAXIGAMESSUPPER, and veep60 for helping to get this implemented!
- Support for hub attached cameras and doorbells (H200)
- Improved support for hubs (including pairing & better chime controls)
- Support for many new camera and doorbell device models, including C220, C720, D100C, D130, and D230

Many thanks to testers and new contributors - @steveredden, @DawidPietrykowski, @Obbay2, @andrewome, @ryenitcher and @etmmvdp!

**Breaking changes:**

- `uses_http` is now a readonly property of device config. Consumers that relied on `uses_http` to be persisted with `DeviceConfig.to_dict()` will need to store the value separately.
- `is_color`, `is_dimmable`, `is_variable_color_temp`, `valid_temperate_range`, and `has_effects` attributes from the `Light` module are deprecated, consumers should use `has_feature("hsv")`, `has_feature("brightness")`, `has_feature("color_temp")`, `get_feature("color_temp").range`, and `Module.LightEffect in dev.modules` respectively. Calling the deprecated attributes will emit a `DeprecationWarning` and type checkers will fail them.
-  `alarm_volume` on the `smart.Alarm` module is changed from `str` to `int`

**Breaking changes:**

- Make uses\_http a readonly property of device config [\#1449](#1449) (@sdb9696)
- Allow passing alarm parameter overrides [\#1340](#1340) (@rytilahti)
- Deprecate legacy light module is\_capability checks [\#1297](#1297) (@sdb9696)

**Implemented enhancements:**

- Expose more battery sensors for D230 [\#1451](#1451)
- dumping HTTP POST Body for Tapo Vacuum \(RV30 Plus\) [\#937](#937)
- Add common alarm interface [\#1479](#1479) (@sdb9696)
- Add common childsetup interface [\#1470](#1470) (@sdb9696)
- Add childsetup module to smartcam hubs [\#1469](#1469) (@sdb9696)
- Add smartcam pet detection toggle module [\#1465](#1465) (@DawidPietrykowski)
- Only log one warning per unknown clean error code and status [\#1462](#1462) (@rytilahti)
- Add childlock module for vacuums [\#1461](#1461) (@rytilahti)
- Add ultra mode \(fanspeed = 5\) for vacuums [\#1459](#1459) (@rytilahti)
- Add setting to change carpet clean mode [\#1458](#1458) (@rytilahti)
- Add setting to change clean count [\#1457](#1457) (@rytilahti)
- Add mop module [\#1456](#1456) (@rytilahti)
- Enable dynamic hub child creation and deletion on update [\#1454](#1454) (@sdb9696)
- Expose current cleaning information [\#1453](#1453) (@rytilahti)
- Add battery module to smartcam devices [\#1452](#1452) (@sdb9696)
- Allow update of camera modules after setting values [\#1450](#1450) (@sdb9696)
- Update hub children on first update and delay subsequent updates [\#1438](#1438) (@sdb9696)
- Add support for doorbells and chimes [\#1435](#1435) (@steveredden)
- Implement vacuum dustbin module \(dust\_bucket\) [\#1423](#1423) (@rytilahti)
- Allow https for klaptransport [\#1415](#1415) (@rytilahti)
- Add smartcam child device support for smartcam hubs [\#1413](#1413) (@sdb9696)
- Add powerprotection module [\#1337](#1337) (@rytilahti)
- Add vacuum speaker controls [\#1332](#1332) (@rytilahti)
- Add consumables module for vacuums [\#1327](#1327) (@rytilahti)
- Add ADC Value to PIR Enabled Switches [\#1263](#1263) (@ryenitcher)
- Add support for cleaning records [\#945](#945) (@rytilahti)
- Initial support for vacuums \(clean module\) [\#944](#944) (@rytilahti)
- Add support for pairing devices with hubs [\#859](#859) (@rytilahti)

**Fixed bugs:**

- TP-Link HS300 Wi-Fi Power-Strip - "Parent On/Off" not functioning. [\#637](#637)
- Convert carpet\_clean\_mode to carpet\_boost switch [\#1486](#1486) (@rytilahti)
- Change category for empty dustbin feature from Primary to Config [\#1485](#1485) (@rytilahti)
- Report 0 for instead of None for zero current and voltage [\#1483](#1483) (@ryenitcher)
- Disable iot camera creation until more complete [\#1480](#1480) (@sdb9696)
- ssltransport: use debug logger for sending requests [\#1443](#1443) (@rytilahti)
- Fix discover cli command with host [\#1437](#1437) (@sdb9696)
- Fallback to is\_low for batterysensor's battery\_low [\#1420](#1420) (@rytilahti)
- Fix iot strip turn on and off from parent [\#639](#639) (@Obbay2)

**Added support for devices:**

- Add D130\(US\) 1.0 1.1.9 fixture [\#1476](#1476) (@sdb9696)
- Add D100C\(US\) 1.0 1.1.3 fixture [\#1475](#1475) (@sdb9696)
- Add C220\(EU\) 1.0 1.2.2 camera fixture [\#1466](#1466) (@DawidPietrykowski)
- Add D230\(EU\) 1.20 1.1.19 fixture [\#1448](#1448) (@sdb9696)
- Add fixture for C720 camera [\#1433](#1433) (@steveredden)

**Project maintenance:**

- Update ruff to 0.9 [\#1482](#1482) (@sdb9696)
- Cancel in progress CI workflows after new pushes [\#1481](#1481) (@sdb9696)
- Update test framework to support smartcam device discovery. [\#1477](#1477) (@sdb9696)
- Add error code 7 for clean module [\#1474](#1474) (@rytilahti)
- Enable CI workflow on PRs to feat/ fix/ and janitor/ [\#1471](#1471) (@sdb9696)
- Add commit-hook to prettify JSON files [\#1455](#1455) (@rytilahti)
- Add required sphinx.configuration [\#1446](#1446) (@rytilahti)
- Add more redactors for smartcams [\#1439](#1439) (@sdb9696)
- Add KS230\(US\) 2.0 1.0.11 IOT Fixture [\#1430](#1430) (@ZeliardM)
- Add tests for dump\_devinfo parent/child smartcam fixture generation [\#1428](#1428) (@sdb9696)
- Raise errors on single smartcam child requests [\#1427](#1427) (@sdb9696)
@IzSmithh
Copy link

IzSmithh commented Apr 1, 2025

Thank you for all the effort in adding this vacuum,
Id like to point out log entries that have been popping up since adding this vacuum. it comes as an error and warning.
the vacuum still works as indented.

Logger: kasa.smart.smartdevice
Source: components/tplink/coordinator.py:78
First occurred: 09:38:51 (9 occurrences)
Last logged: 10:01:16

Error processing Matter for device 192.168.1.50, module will be unavailable: get_matter_setup_info for Matter (error_code=UNKNOWN_METHOD_ERROR)

Hope this is the right place for this..
thanks .

@rytilahti
Copy link
Member Author

Please create a separate issue to track this. Iirc, the matter info should only be requested if the device reports to support it, but maybe there is something we can improve to avoid repeating warnings for cases where the device reports a query is failing with that error :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request no-stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dumping HTTP POST Body for Tapo Vacuum (RV30 Plus)
6 participants