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 "cycles" option from Roborock S7 and older models #1034

Closed
Dielee opened this issue May 6, 2021 · 11 comments
Closed

Add "cycles" option from Roborock S7 and older models #1034

Dielee opened this issue May 6, 2021 · 11 comments

Comments

@Dielee
Copy link

Dielee commented May 6, 2021

Is your feature request related to a problem? Please describe.
I have already tried with wireshark and bluestacks to sniff the new function of "cycles". Unfortunately no UDP packets arrive on the miio port 54321. Maybe someone can help ?

Describe the solution you'd like
I would like to implement the "cycles" option form newer roborock vaccums into python-miio.I can't manage to capture the traffic of the miio protocol.

Device information:
If the enhancement is device-specific, please include also the following information.

  • Name(s) of the device: Roborock S7 (roborock.vacuum.a15) and maybe some more
@rytilahti
Copy link
Owner

What does the cycles do? If you execute miiocli vacuum --help it will print you a list of already supported features (some of which may not be implemented in homeassistant, if you are using it).

I'm not sure why you are not seeing related packets using wireshark or bluestacks, so I cannot really help you there, but it seems to indicate that the communication is not done locally but over the cloud..

@Dielee
Copy link
Author

Dielee commented May 7, 2021

Cycles cleans the same a room for X times. This is very useful for mopping.

This feature looks like this:
Screenshot_20210507-095252__01.jpg

Maybe communication ist working over cloud, but python-miio works local.
S7 works with python-miio, so there has to be a way to start this feature locally.
@fettlaus implemented the S7 integration, maybe he can help ?

Thank you!

@Dielee
Copy link
Author

Dielee commented May 8, 2021

Looks like S7 is using the new miotspec protocol, which does not work locally, but supports the "old" miio protocol also.
Maybe I will take a look into the https connection with miotspec tomorrow.

@fettlaus
Copy link
Contributor

fettlaus commented May 8, 2021

To be fair: all I did was some trial and error. I didn't even need to sniff network traffic.

@Dielee
Copy link
Author

Dielee commented May 8, 2021

Do you think it is possible to find the cycles feature for app_segment_clean by trial and error ?

@fettlaus
Copy link
Contributor

fettlaus commented May 8, 2021

I currently don't want to start my vacuum, but please try something like this: miiocli vacuum --ip 192.168.x.x --token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx segment_clean '[{"segments":[18],"repeat":2}]
If it works there is no code change necessary maybe only a hint in the docs. (got the code from marcelrv/XiaomiRobotVacuumProtocol/issues/44)

@rytilahti
Copy link
Owner

If that works, the segment_clean could be improved to take those as parameters instead of passing a raw json array (and marking the repeat feature only to be usable for specific models) :-)

If the other start commands also accept the repeat keyword, they could also be revised accordingly!

@Dielee
Copy link
Author

Dielee commented May 9, 2021

This works:
miiocli vacuum --ip 192.168.x.x --token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx segment_clean '[{"segments":[18],"repeat":2}]

And this works, too:
miio protocol call 192.168.x.x app_segment_clean '[{"segments":[16],"repeat":2}]'

So, we don't need to modify anything as app_segment_clean takes the Json parameters.

@Dielee
Copy link
Author

Dielee commented May 9, 2021

Got this working in HA like this:

input_select:

  clean_cycles:
    options:
      - '1'
      - '2'
      - '3'
    initial: '1'

script:

service: vacuum.send_command
data:
  command: app_segment_clean
  params:
    - segments:
        - 20
      repeat: |
        {% set timesToClean = states('input_select.clean_cycles') %}
        {{ timesToClean }}
target:
  entity_id: vacuum.xiaomi

@schmieeed
Copy link

schmieeed commented Nov 2, 2021

Got this working in Openhab like this:
Openhab version openHAB 3.1.0 Release Build
Roborock S7: Firmware: 4.1.5_1320
Channel: miio:vacuum:1X4XXXXa7e:actions#commands (String) - - > app_segment_clean [{"segments":[22],"repeat":3}]

@Schwebebahn
Copy link

Thanks for the informations here, they helped me a lot. For those who are locking on how to do it in an openhab rule, here is mine (using the cloud connection):
Roborock_ExecuteRPCcloudCommand.sendCommand("app_segment_clean[{segments:[19],repeat:2}]")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants