home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.38k stars 30.64k forks source link

Not possible to use "segment cleaning" with the new Roborock integration on Roborock S7 Pro Ultra #92817

Closed plimajr closed 1 year ago

plimajr commented 1 year ago

The problem

The new integration "https://www.home-assistant.io/integrations/roborock/" does not support a send_command, for segment cleaning, like in the following script (example):

alias: Vacuum kitchen sequence:

What version of Home Assistant Core has the issue?

core-2023.5.2

What was the last working version of Home Assistant Core?

Home Assistant OS

What type of installation are you running?

Home Assistant Core

Integration causing the issue

Roborock

Link to integration documentation on our website

https://www.home-assistant.io/integrations/roborock

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @humbertogontijo, @lash-l, mind taking a look at this issue as it has been labeled with an integration (roborock) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `roborock` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign roborock` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


roborock documentation roborock source (message by IssueLinks)

Lash-L commented 1 year ago

Hey - For segment cleaning you should use the command 'app_segment_clean' you need to put in segment ids, not iot room ids. To get a mapping from iot room ids -> segment ids, you can run the command get_room_mapping with debugging on. (The result shows up in the logs)

As well, mode: is not how the vacuum expects the data, it is expecting an optional "repeats" and then a number 1->3 Here's an example that I just ran and tested.

service: vacuum.send_command
data:
  command: app_segment_clean
  params:
    - 18
    - 22
target:
  entity_id: vacuum.s7_roborock
plimajr commented 1 year ago

Spot on !!! Sorry for the confusion. For what it's worth, it actually works just fine and my shortcuts were updated to work with the new entity.

teklabania commented 1 year ago

it is expecting an optional "repeats" and then a number 1->3

@Lash-L, could you (or anyone) give an example with repeats usage? Segments cleaning works fine, but I can't figure out configuration for repetitions.

Lash-L commented 1 year ago

Hey @teklabania

A recent discovery was that our reverse engineering of segment cleaning currently has a bug. There are some instances when it work work. One of them is if you give a list of segments and repeats.

You can give a single segment and repeats and it should work. The bug will hopefully be fixed soon.

teklabania commented 1 year ago

One of them is if you give a list of segments and repeats.

You mean something like this:

service: vacuum.send_command
data:
  command: app_segment_clean
  params:
    - 18
    - 22
    - repeats: 2
target:
  entity_id: vacuum.s7_roborock

or

service: vacuum.send_command
data:
  command: app_segment_clean
  params:
    - 18
    - 22
  repeats: 2
target:
  entity_id: vacuum.s7_roborock

None of above works.

Lash-L commented 1 year ago

Theoretically this should work

service: vacuum.send_command
data:
  command: app_segment_clean
  params:
    - 18
  repeats: 2
target:
  entity_id: vacuum.s7_roborock

And so should this:

service: vacuum.send_command
data:
  command: app_segment_clean
  params:
    - 18
    - 22
target:
  entity_id: vacuum.s7_roborock
teklabania commented 1 year ago

Without repeats it just works as expected. When I use repeats as in your first example, I get API error (Node-RED):

Call-service error. Timeout after 4 seconds waiting for response
Lash-L commented 1 year ago

@home-assistant reopen

Lash-L commented 1 year ago

@teklabania i spent a decent bit of time today figuring out what was going on. I figured out the problem and the other developer was able to successfully implement it.

Reopening this issue so I can link the issue with the PR that will fix it

jhthompson12 commented 1 year ago

To get a mapping from iot room ids -> segment ids, you can run the command get_room_mapping with debugging on. (The result shows up in the logs)

Hi, @Lash-L! can you please quickly expound on this? Im new to the concept of debugging home assistant integrations and would like to see if I can grab the room ID --> segment ID mapping you're referring to.

Im running Home Assistant on Docker, but have no idea how to "run the command get_room_mapping with debugging on". I think I understand the "with debugging mode on" part as selecting "selecting debugging log" for the integration. But im clueless on how to "run the command get_room_mapping".

Is this something I can do from my Home Assistant container's bash shell? Is it even possible to briefly describe how to do this?

Some pointers on this would be greatly appreciated. Thanks for the great work!

plimajr commented 1 year ago

Or, you can simply try out a segment number, and check on the Roborock App which room is acrivated ...

On Tue, May 23, 2023, 04:05 jhthompson12 @.***> wrote:

To get a mapping from iot room ids -> segment ids, you can run the command get_room_mapping with debugging on. (The result shows up in the logs)

Hi, @Lash-L https://github.com/Lash-L! can you please quickly expound on this? Im new to the concept of debugging home assistant integrations and would like to see if I can grab the room ID --> segment ID mapping you're referring to.

Im running Home Assistant on Docker, but have no idea how to "run the command get_room_mapping with debugging on". Is this something I can do from my Home Assistant container's bash shell? Is it even possible to briefly describe how to do this?

Some pointers on this would be greatly appreciated. Thanks for the great work!

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/92817#issuecomment-1558386925, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6Y4TXA6RWNCDYE6C7YIALXHQLPXANCNFSM6AAAAAAX2G7RTA . You are receiving this because you modified the open/close state.Message ID: @.***>

jhthompson12 commented 1 year ago

Thanks, @plimajr. When I look at the available Roborock services, there are 8 options. The one closest to the app_segment_clean mentioned above is roborock.vacuum_clean_segment which sounds similar enough.

This is my service call:

service: roborock.vacuum_clean_segment
data:
   segments: 0
target:
  entity_id: vacuum.roborock_s7

I have 7 rooms segmented off in the Roborock app and "selective room cleaning" through the app works great. I've tried entering segment IDs in the range 0-13 and get the following behavior each time:

Is it possible that the segment IDs are numbers higher than 13? Or does this seem like erroneous behavior? Does this warrant a new issue?

Im using an S7.

Lash-L commented 1 year ago

@jhthompson12 seems like you are using the custom component and not the official one. Please make an issue there and not here and I will be happy to help you debug. But providing more information here will be confusing to users of the core integration.

But yes segment ids can and do go over 13.

jhthompson12 commented 1 year ago

Thanks, @Lash-L! I'm actually surprised to hear about this "custom" vs. "official" distinction. I'm not sure how I ended up with the custom version, but I would be happy to just try it the official one..

Any guesses on how I ended up here or how I could try the official version? Should i try removing and reinstalling the Roborock integration? I did upgrade home assistant to 20230503.3 within the last week. Idk if that would have anything to do with it

Lash-L commented 1 year ago

@jhthompson12 so if you installed it from HACS or as a custom component, then you would have the custom component version.

If you installed it before 2023.05 then you have the version that is actually the Xiaomi Mi integration and not the new Roborock integration(do you use the Mi Home app)?

jhthompson12 commented 1 year ago

@Lash-L Ahhh, I see what happened now. Thanks for the tips! Months ago I installed the "custom" roborock integration via HACS to try it out. I ended up not using it and forgot about it.

I recently found this page saying the Roborock integration was now part of core HA. Installed it again, but missed the fact that it was using the integration repo from HACS.

I'll remove that and give the official one a try. Thanks again!

jhthompson12 commented 1 year ago

@Lash-L Sorry, I am running in to one issue in the first step of installing the official Roborock integration.

The first step is to "select an authentication method" but it's just a blank text box.. Any idea what might be happening? I can open a separate issue if you'd prefer. Thanks!

image

humbertogontijo commented 1 year ago

@jhthompson12 after you removed the custom component have you restarted home assistant?

jhthompson12 commented 1 year ago

@humbertogontijo Yes, I performed a restart. Prior to restart it was apparent that your custom repo was still cached.

jhthompson12 commented 1 year ago

@Lash-L @humbertogontijo

It looks like HACS was causing the issue for some reason. After disabling HACS the official Roborock integration prompted for my email like it's supposed to. Thanks for your time!

jhthompson12 commented 1 year ago

Hi, @Lash-L! can you please quickly expound on this? Im new to the concept of debugging home assistant integrations and would like to see if I can grab the room ID --> segment ID mapping you're referring to.

The official integration is installed and I see the vacuum.send_command service! I would still love to hear more about how to do this if you're willing. Perhaps this is not the right forum, Im happy to take the conversations elsewhere.