Fix mop set_waterlevel sending setCleanAttr without type field#1667
Fix mop set_waterlevel sending setCleanAttr without type field#1667rytilahti merged 1 commit intopython-kasa:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1667 +/- ##
==========================================
- Coverage 93.22% 93.22% -0.01%
==========================================
Files 157 157
Lines 9817 9815 -2
Branches 1003 1003
==========================================
- Hits 9152 9150 -2
Misses 472 472
Partials 193 193 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Read the docs failed but may succeed on retriggering? Not sure what happened |
| if mode not in name_to_value: | ||
| raise ValueError("Invalid waterlevel %s, available %s", mode, name_to_value) | ||
|
|
||
| settings = self._settings.copy() |
There was a problem hiding this comment.
I verified on a real RV30 that setCleanAttr treats the payload as a partial update. Sending only {"cistern": 3, "type": "global"} changes the water level without affecting suction or clean_number, so there's no need to include all params.
There was a problem hiding this comment.
IIRC, I tested that this works as it is right now, but the behavior may have changed in the newer firmwares. I cannot test this myself right now, but accepting partial updates agrees with my mental model of how these devices commony work, so let's merge it.
Thanks @davidefiocco, if you do not mind contributing a fixture file for your device & firmware combination, please consider checking out https://python-kasa.readthedocs.io/en/stable/contribute.html#contributing-fixture-files for another PR!
Hey @rytilahti thanks! Hopefully I addressed it OK in #1665 ! |
|
Great, thanks! The doc update is irrelevant for this change (it's about the codecov badge), so I will just merge this. |
Fixes #1666 by having set_waterlevel support an amended payload, and updating the test.