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
71.13k stars 29.8k forks source link

Roborock selected map returns key error and stays unknown #123370

Open sophof opened 1 month ago

sophof commented 1 month ago

The problem

I eagerly wanted to start using the new selected map entity, but it appears to not be working. I've tried both selecting a map using the select and starting a cleaning session on the roborock app. In both situations, the select returns to unknown. It appears the code tries to retrieve a map name on a key that doesn't exist in the dictionary (see log below).

What version of Home Assistant Core has the issue?

core-2023.8.0

What was the last working version of Home Assistant Core?

NA

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Roborock

Link to integration documentation on our website

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

Diagnostics information

config_entry-roborock-01J211W9KB43RKV1VFDJ7NNY80.json

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant
Source: components/roborock/select.py:147
First occurred: 14:00:27 (2 occurrences)
Last logged: 14:00:57

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 453, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 533, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1005, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1130, in _async_write_ha_state
    self.__async_calculate_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1011, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/select/__init__.py", line 145, in state
    current_option = self.current_option
                     ^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/roborock/select.py", line 147, in current_option
    return self.coordinator.maps[current_map].name
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 62

Additional information

No response

home-assistant[bot] commented 1 month ago

Hey there @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. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


roborock documentation roborock source (message by IssueLinks)

sophof commented 1 month ago

Today I cleaned one of my floors and suddenly the select worked, it is unclear to me what made the difference from the day before sadly. I have noticed that it has returned to unknown now, even though the app clearly has a floor selected (the main floor where the dock is). Maybe something goes wrong syncing with the cloud?

MortenHannemose commented 1 month ago

👍 I have the same error. I'm not even trying to select a map, just to start cleaning. Same version of HA

styphonthal commented 1 month ago

I have same problem with the roborock Qrevo max, except when I clean the floors it never resets, just stays at unknown or unavailable.

Lash-L commented 3 weeks ago

Interesting - tested again on my 2024.8 instance and it is working for me. Perhaps it is a q revo specific issue?

I know some of the newer devices return a third key for room info - perhaps they also return something different for map info. Diagnostic logs help a bit but it would also help if you enable debug logging for robeoock -> reload -> change the map on your app -> wait a minute -> change to original map and post the logs that talk about "map" for roborock

MortenHannemose commented 3 weeks ago

I have the Roborock S6 MaxV. Along with this error I also occasionally get Platform roborock does not generate unique IDs. ID 5rjdus3ixwlgrdnasie1ko_map_ already exists - ignoring image.roborock_s6_maxv I suspect it's related to my error, so it would be helpful to know if the other people experiencing a similar issue also have the unique ID problem.

MortenHannemose commented 3 weeks ago

I have Roborock S6 MaxV. Along with the above error, I also sometimes get: Platform roborock does not generate unique IDs. ID 5rjdus3ixwlgrdnasie1ko_map_ already exists - ignoring image.roborock_s6_maxv It would be helpful to know if this is a separate issue or the other people in the thread also have this one.

Dis90 commented 3 weeks ago

I have same KeyError 62 problem. Here's log:

2024-08-21 19:30:22.080 DEBUG (MainThread) [roborock.api] [Carlos] id=13487 Requesting method get_multi_maps_list with []
2024-08-21 19:30:22.129 DEBUG (MainThread) [roborock.api] [Carlos] id=13487 Response from method get_multi_maps_list: {'max_multi_map': 4, 'max_bak_map': 0, 'multi_map_count': 2, 'map_info': [{'mapFlag': 0, 'add_time': 1724212927, 'length': 8, 'name': 'Alakerta', 'bak_maps': []}, {'mapFlag': 1, 'add_time': 1672848972, 'length': 9, 'name': 'Yläkerta', 'bak_maps': []}]}
2024-08-21 19:30:22.134 DEBUG (MainThread) [roborock.api] [Carlos] id=20096 Requesting method get_status with []
2024-08-21 19:30:22.136 DEBUG (MainThread) [roborock.api] [Carlos] id=30037 Requesting method get_clean_summary with []
2024-08-21 19:30:22.139 DEBUG (MainThread) [roborock.api] [Carlos] id=22648 Requesting method get_consumable with []
2024-08-21 19:30:22.145 DEBUG (MainThread) [roborock.api] [Carlos] id=20096 Response from method get_status: {'msg_ver': 2, 'msg_seq': 1032, 'state': 8, 'battery': 100, 'clean_time': 1800, 'clean_area': 24735000, 'error_code': 0, 'map_present': 1, 'in_cleaning': 0, 'in_returning': 0, 'in_fresh_state': 1, 'lab_status': 3, 'water_box_status': 0, 'fan_power': 101, 'dnd_enabled': 0, 'map_status': 3, 'is_locating': 0, 'lock_status': 0}
2024-08-21 19:30:25.804 DEBUG (MainThread) [roborock.cloud_api] [Carlos] id=29394 Response from get_map_v1: 22631 bytes
2024-08-21 19:30:25.859 DEBUG (MainThread) [roborock.cloud_api] [Carlos] id=24606 Requesting method load_multi_map with [0]
2024-08-21 19:30:25.859 DEBUG (MainThread) [roborock.cloud_api] [Carlos] Sending PUBLISH (d0, q0, r0, m5), 'b'rr/m/i/4keFwf9fpVBlRPXkmWpeeL/e19e118d/40LMP7IZg9A52oGVYRGj67'', properties=None, ... (215 bytes)
2024-08-21 19:30:26.146 DEBUG (Thread-3 (_thread_main)) [roborock.cloud_api] [Carlos] Received PUBLISH (d0, q0, r0, m0), 'rr/m/o/4keFwf9fpVBlRPXkmWpeeL/e19e118d/40LMP7IZg9A52oGVYRGj67', properties=[], ... (167 bytes)
2024-08-21 19:30:26.347 DEBUG (Thread-3 (_thread_main)) [roborock.cloud_api] [Carlos] Received PUBLISH (d0, q0, r0, m0), 'rr/m/o/4keFwf9fpVBlRPXkmWpeeL/e19e118d/40LMP7IZg9A52oGVYRGj67', properties=[], ... (167 bytes)
2024-08-21 19:30:26.457 DEBUG (Thread-3 (_thread_main)) [roborock.cloud_api] [Carlos] Received PUBLISH (d0, q0, r0, m0), 'rr/m/o/4keFwf9fpVBlRPXkmWpeeL/e19e118d/40LMP7IZg9A52oGVYRGj67', properties=[], ... (103 bytes)
2024-08-21 19:30:26.460 DEBUG (MainThread) [roborock.cloud_api] [Carlos] id=24606 Response from load_multi_map: ok
2024-08-21 19:30:26.658 DEBUG (Thread-3 (_thread_main)) [roborock.cloud_api] [Carlos] Received PUBLISH (d0, q0, r0, m0), 'rr/m/o/4keFwf9fpVBlRPXkmWpeeL/e19e118d/40LMP7IZg9A52oGVYRGj67', properties=[], ... (167 bytes)
2024-08-21 19:30:41.938 DEBUG (Thread-3 (_thread_main)) [roborock.cloud_api] [Carlos] Received PUBLISH (d0, q0, r0, m0), 'rr/m/o/4keFwf9fpVBlRPXkmWpeeL/e19e118d/40LMP7IZg9A52oGVYRGj67', properties=[], ... (439 bytes)
2024-08-21 19:30:44.943 DEBUG (Thread-3 (_thread_main)) [roborock.cloud_api] [Carlos] Received PUBLISH (d0, q0, r0, m0), 'rr/m/o/4keFwf9fpVBlRPXkmWpeeL/e19e118d/40LMP7IZg9A52oGVYRGj67', properties=[], ... (439 bytes)
2024-08-21 19:30:47.936 DEBUG (Thread-3 (_thread_main)) [roborock.cloud_api] [Carlos] Received PUBLISH (d0, q0, r0, m0), 'rr/m/o/4keFwf9fpVBlRPXkmWpeeL/e19e118d/40LMP7IZg9A52oGVYRGj67', properties=[], ... (439 bytes)
2024-08-21 19:30:50.935 DEBUG (Thread-3 (_thread_main)) [roborock.cloud_api] [Carlos] Received PUBLISH (d0, q0, r0, m0), 'rr/m/o/4keFwf9fpVBlRPXkmWpeeL/e19e118d/40LMP7IZg9A52oGVYRGj67', properties=[], ... (439 bytes)

After minute I switched back to original map but I can't find anything related to that from log. Only these

2024-08-21 19:32:21.697 DEBUG (MainThread) [roborock.api] [Carlos] id=22965 Requesting method get_room_mapping with []
2024-08-21 19:32:21.701 DEBUG (MainThread) [roborock.api] [Carlos] id=31987 Requesting method get_clean_summary with []
2024-08-21 19:32:21.703 DEBUG (MainThread) [roborock.api] [Carlos] id=22965 Response from method get_room_mapping: [[16, '7140391'], [17, '10099485'], [18, '10099497'], [19, '10099500'], [20, '7140401']]
sophof commented 2 weeks ago

I noticed I didn't give the make of my vacuum, it is a Roborock S7 MaxV. Just so it is clear that this appears to be not vacuum specific.

N3rdix commented 2 weeks ago

Same for me with a Roborock S7. When changing the value to the first one in the list (in my example "Erdgeschoss") the entity goes unavailable after some seconds (I assume after the roundtrip.

The related error I see in the logs in the case, and only when choosing the first value from the list:

Logger: homeassistant.components.websocket_api.http.connection
Quelle: components/websocket_api/commands.py:283
Integration: Home Assistant WebSocket API ([Dokumentation](https://www.home-assistant.io/integrations/websocket_api), [Probleme](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
Erstmals aufgetreten: 14:44:23 (1 Vorkommnisse)
Zuletzt protokolliert: 14:44:23

[547329658448] Option is not valid for entity select.robocop_ausgewahlte_karte, valid options are: Erdgeschoss, 1. OG, Keller, Dachgeschoss

Debug log:

2024-08-29 14:57:07.283 DEBUG (MainThread) [roborock.api] [Robocop] id=31539 Requesting method get_status with []
2024-08-29 14:57:07.404 DEBUG (MainThread) [roborock.api] [Robocop] id=31539 Response from method get_status: {'msg_ver': 2, 'msg_seq': 872, 'state': 8, 'battery': 100, 'clean_time': 2184, 'clean_area': 37642500, 'error_code': 0, 'map_present': 1, 'in_cleaning': 0, 'in_returning': 0, 'in_fresh_state': 1, 'lab_status': 3, 'water_box_status': 1, 'fan_power': 103, 'dnd_enabled': 0, 'map_status': 3, 'is_locating': 0, 'lock_status': 0, 'water_box_mode': 203, 'water_box_carriage_status': 0, 'mop_forbidden_enable': 0, 'adbumper_status': [0, 0, 0], 'water_shortage_status': 0, 'dock_type': 0, 'dust_collection_status': 0, 'auto_dust_collection': 1, 'mop_mode': 300, 'debug_mode': 0, 'dock_error_status': 0, 'unsave_map_reason': 0, 'unsave_map_flag': 0}
2024-08-29 14:57:08.760 DEBUG (MainThread) [roborock.api] [Robocop] id=13172 Requesting method get_consumable with []
2024-08-29 14:57:08.818 DEBUG (MainThread) [roborock.api] [Robocop] id=13172 Response from method get_consumable: {'main_brush_work_time': 747037, 'side_brush_work_time': 24403, 'filter_work_time': 285555, 'filter_element_work_time': 0, 'sensor_dirty_time': 24403, 'dust_collection_work_times': 0}
2024-08-29 14:57:12.823 DEBUG (MainThread) [roborock.api] [Robocop] id=32102 Requesting method get_child_lock_status with []
2024-08-29 14:57:12.878 DEBUG (MainThread) [roborock.api] [Robocop] id=32102 Response from method get_child_lock_status: {'lock_status': 0}
2024-08-29 14:57:12.979 DEBUG (MainThread) [roborock.api] [Robocop] id=16780 Requesting method get_dnd_timer with []
2024-08-29 14:57:13.034 DEBUG (MainThread) [roborock.api] [Robocop] id=16780 Response from method get_dnd_timer: {'start_hour': 21, 'start_minute': 0, 'end_hour': 8, 'end_minute': 0, 'enabled': 1}
2024-08-29 14:57:13.497 DEBUG (MainThread) [roborock.api] [Robocop] id=21072 Requesting method get_room_mapping with []
2024-08-29 14:57:13.504 DEBUG (MainThread) [roborock.api] [Robocop] id=26335 Requesting method get_clean_summary with []
2024-08-29 14:57:13.590 DEBUG (MainThread) [roborock.api] [Robocop] id=21072 Response from method get_room_mapping: [[16, '2178245'], [17, '2178243'], [18, '18889207'], [19, '18889212'], [20, '18889213']]
2024-08-29 14:57:13.591 DEBUG (MainThread) [roborock.api] [Robocop] id=26335 Response from method get_clean_summary: {'clean_time': 746835, 'clean_area': 11970515000, 'clean_count': 470, 'dust_collection_count': 0, 'records': [1721549802, 1718863696, 1718860832, 1717780341, 1713705110, 1713702335, 1713690454, 1712498791, 1712480819, 1711036017, 1710580315, 1709380894, 1709368827, 1708769760, 1708765970, 1708764997, 1707582686, 1707574124, 1707056492, 1705743321]}
2024-08-29 14:57:13.594 DEBUG (MainThread) [roborock.api] [Robocop] id=24606 Requesting method get_clean_record with [1721549802]
2024-08-29 14:57:13.738 DEBUG (MainThread) [roborock.api] [Robocop] id=24606 Response from method get_clean_record: {'begin': 1721549802, 'end': 1721551986, 'duration': 2184, 'area': 37642500, 'error': 0, 'complete': 1, 'start_type': 1, 'clean_type': 1, 'finish_reason': 52, 'dust_collection_status': 0}
2024-08-29 14:57:13.743 DEBUG (MainThread) [homeassistant.components.roborock.coordinator] Finished fetching roborock data in 0.250 seconds (success: True)
2024-08-29 14:57:13.764 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547329658448] Option  is not valid for entity select.robocop_ausgewahlte_karte, valid options are: Erdgeschoss, 1. OG, Keller, Dachgeschoss
sophof commented 1 week ago

Ok, that is interesting, it is the same for me (although in my case it is called "begane grond" 😄). I just checked and it was fine for the entire duration of a cleaning session on the second floor, but became unavailable after putting it back on the ground floor. I couldn't find any error messages in the log though, but I still expect this is somehow a zero indexing error (it appears to only happen for the first map).

dhoeben commented 1 week ago

Same issue on my Roborock S8 Pro Ultra. I only have one floor, but I have selected multiple floors in the options. Just haven´t found the time yet to set it up upstairs :-)

udoersam commented 1 week ago

Hello,

just have the same issue. I can load the maps with id 1 or 2. But if I try to load the map with id 0 I will get the answer, that the selected map is not a valid entry. So I think, that this is an issue with the zero id.