-
-
Notifications
You must be signed in to change notification settings - Fork 44
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 support for set/getWashInfo commands and onWashInfo message #387
base: dev
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #387 +/- ##
==========================================
+ Coverage 83.30% 83.83% +0.53%
==========================================
Files 74 78 +4
Lines 2977 3075 +98
Branches 531 541 +10
==========================================
+ Hits 2480 2578 +98
Misses 443 443
Partials 54 54 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently I created 2 distinct commands (and thus two capabilities), one to set the only the mode
and another to set only the hot_wash_amount
, in order to mimic the app which handles them distinctly, but they could be merged into a single command that, however, should then send only one parameter between mode
and hot_wash_amount
when executed.
Also, due this asymmetry between get command (which returns 3 attributes) and set one (which support only 1, or 2 in case of merging), I had difficulties implementing set command tests. Any help is welcome :) .
Additionally, I used an Enum for |
UPDATE: I did some additional tests and I can tell that, when |
UPDATE: I just found that the library does not support multiple command classes mapped to the same MQTT command in p2p commands handling: client.py/deebot_client/mqtt_client.py Lines 259 to 270 in bb19d12
As it can be seen, the code look for a command class mapped to the MQTT command topic, but in the PR there are 2 classes, client.py/deebot_client/command.py Lines 274 to 284 in bb19d12
@edenhaus I don't know how to proceed... It seems that to support this setWashInfo command with different parameters it is required some sort of refactor on other parts of the library which are currently quite complex for me to identify, and that will also depend on how this command handling will be implemented, between using two command classes vs using a single command class that, however, will have two mutually exclusive parameters... Maybe we should talk about it on discord to identify how this can be managed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay. It was a long month by porting the custom integration to core
I think by merging both commands together I solved some issues you had. |
Co-authored-by: Robert Resch <[email protected]>
Co-authored-by: Robert Resch <[email protected]>
7e59994
to
225ac58
Compare
@edenhaus I refactored the code to work with a single command class, and thus I added a couple of tests for command execution, but it seems that the standard test |
I fixed it for you. |
On T20 Omni it is possible to control mops washing mode (with cold or hot water) and level (standard or deep washing).
These features are handled by getWashInfo and setWashInfo commands, with a push onWashInfo message which is sent when settings are changed.
The
getWashInfo
returns 3 different information:mode[int]
: this is the wash mode; it corresponds to "hot water cleaning" setting in the app, which can be disabled (value0
) or enabled (value1
)hot_wash_amount[int]
: this is the washing level of mops, as cycles of 3 water charges and discharges on the station; the app allows to select only 2 values, one for "standard" washing (value1
- 3 water charges and discharges) and one for deep washing (value3
- 9 water charges and discharges).interval[int]
: this is the interval between two mop washings while mopping.The app uses the
setWashInfo
command to distrincly set mops washing mode and level, passing onlymode
orhot_wash_amount
with the desired value. The interval, instead, is set using a different commandsetWashInterval
(handled in the PR #376).Performing a
setWashInfo
command results in aonWashInfo
message to be received from the MQTT server (with all the information of thegetWashInfo
command), regardless ifsetWashInfo
is invoked passing onlymode
or onlyhot_wash_amount
. TheonWashInfo
message is sent also when is performd asetWashInterval
command.