core icon indicating copy to clipboard operation
core copied to clipboard

Roborock Map Image Error

Open mwb9aa opened this issue 1 year ago • 3 comments

The problem

The image entity used to be on the Roborock integration. After a few weeks, the entity became unavailable. I tried restarting HA and reloading the integration multiple times in various combinations, but nothing made the entity available. I finally deleted the integration, restarted HA, installed the integration again. The image/map entity is not showing up, not even as unavailable.

What version of Home Assistant Core has the issue?

core-2024.1.3

What was the last working version of Home Assistant Core?

a november core, I think

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Roborock

Link to integration documentation on our website

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

Diagnostics information

config_entry-roborock-f048dd37e1ed8a79e79a1ababdbeb420.json.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

024-01-14 11:34:55.964 ERROR (Thread-7 (_thread_main)) [roborock.cloud_api] [Roborock S7 MaxV] unpack requires a buffer of 24 bytes
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/roborock/api.py", line 314, in on_message_received
    [endpoint, _, request_id, _] = struct.unpack("<8s8sH6s", payload)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
struct.error: unpack requires a buffer of 24 bytes
2024-01-14 11:35:05.461 WARNING (MainThread) [homeassistant.components.image] Setup of image platform roborock is taking over 10 seconds.
2024-01-14 11:35:05.707 ERROR (MainThread) [homeassistant.components.image] Error while setting up roborock platform for image
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 360, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/roborock/image.py", line 38, in async_setup_entry
    await asyncio.gather(
  File "/usr/src/homeassistant/homeassistant/components/roborock/image.py", line 147, in create_coordinator_maps
    api_data: bytes = await coord.cloud_api.get_map_v1()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 210, in get_map_v1
    return await self.send_command(RoborockCommand.GET_MAP_V1)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/roborock/api.py", line 427, in send_command
    response = await self._send_command(method, params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 207, in _send_command
    return await self.send_message(roborock_message)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 185, in send_message
    (response, err) = await async_response
                      ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/roborock/api.py", line 358, in _wait_response
    raise RoborockTimeout(f"id={request_id} Timeout after {self.queue_timeout} seconds") from None
roborock.exceptions.RoborockTimeout: id=15911 Timeout after 10 seconds

Additional information

I have five robots (S6 Pure, S7, S7 MaxxV, and two S8's) and none of them display a map entity. Is there a file in HA where some information might be that I need to delete manually?

mwb9aa avatar Jan 14 '24 17:01 mwb9aa

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.
  • @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)

home-assistant[bot] avatar Jan 14 '24 17:01 home-assistant[bot]

Interesting.

Two things to try:

  1. Disable the integration for a few days and then re-enable
  2. Create a new roborock account - share your devices with yourself, and add those devices to Home assistant.

I do a lot to try to prevent getting rate limited, but perhaps having 5 vacuums is just too many for it to keep up with.

Lash-L avatar Jan 15 '24 00:01 Lash-L

@Lash-L, thank you for helping me with this issue. I disabled the integration. I will check that the image entities show after re-enabling it in a couple of days. Since I have five robots, I figure I will enable one robot at a time to figure out where limits are. Is there anything else you would like me to test?

mwb9aa avatar Jan 15 '24 22:01 mwb9aa

I have a single S7 Ultra Max and the map isn't working for my HAOS instance either. This is from the debug logs:


2024-01-18 18:03:25.381 WARNING (MainThread) [homeassistant.components.image] Setup of image platform roborock is taking over 10 seconds.
2024-01-18 18:03:25.582 ERROR (MainThread) [homeassistant.components.image] Error while setting up roborock platform for image
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 360, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/roborock/image.py", line 38, in async_setup_entry
    await asyncio.gather(
  File "/usr/src/homeassistant/homeassistant/components/roborock/image.py", line 147, in create_coordinator_maps
    api_data: bytes = await coord.cloud_api.get_map_v1()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 210, in get_map_v1
    return await self.send_command(RoborockCommand.GET_MAP_V1)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/roborock/api.py", line 427, in send_command
    response = await self._send_command(method, params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 207, in _send_command
    return await self.send_message(roborock_message)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/roborock/cloud_api.py", line 185, in send_message
    (response, err) = await async_response
                      ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/roborock/api.py", line 358, in _wait_response
    raise RoborockTimeout(f"id={request_id} Timeout after {self.queue_timeout} seconds") from None
roborock.exceptions.RoborockTimeout: id=24708 Timeout after 10 seconds


admn-monkey avatar Jan 19 '24 17:01 admn-monkey

@Lash-L, While the integration was disabled, I also removed the image entities at /homeassistant/.storage/core.entity_registration. After five days, I enabled the integration. The maps showed back after restarting home assistant.

mwb9aa avatar Jan 21 '24 16:01 mwb9aa

@Lash-L After a complete shutdown of HA and boot back up, the image is back on my instance as well. I didn't disable the integration, just a full shutdown / start up. Either way, all good now.

admn-monkey avatar Jan 21 '24 16:01 admn-monkey

Hi!

I just installed the integration and I'm having also issues with this for a Roborock S8. Shutdown / reboot of HA does not do the trick:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_setup_platform await asyncio.shield(task) File "/usr/src/homeassistant/homeassistant/components/roborock/image.py", line 38, in async_setup_entry await asyncio.gather( File "/usr/src/homeassistant/homeassistant/components/roborock/image.py", line 151, in create_coordinator_maps api_data: bytes = await coord.cloud_api.get_map_v1() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/roborock/cloud_api.py", line 210, in get_map_v1 return await self.send_command(RoborockCommand.GET_MAP_V1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/roborock/api.py", line 394, in send_command response = await self._send_command(method, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/roborock/cloud_api.py", line 207, in _send_command return await self.send_message(roborock_message) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/roborock/cloud_api.py", line 185, in send_message (response, err) = await async_response ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/roborock/api.py", line 325, in _wait_response raise RoborockTimeout(f"id={request_id} Timeout after {self.queue_timeout} seconds") from None roborock.exceptions.RoborockTimeout: id=29891 Timeout after 10 seconds

Any thoughts?

wauswaus avatar Mar 02 '24 11:03 wauswaus

having the same problem

Logger: homeassistant.components.image
Source: helpers/entity_platform.py:344
Integration: Image (documentation, issues)
First occurred: 11:06:18 (1 occurrences)
Last logged: 11:06:18

Error while setting up roborock platform for image
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/roborock/image.py", line 38, in async_setup_entry
    await asyncio.gather(
  File "/usr/src/homeassistant/homeassistant/components/roborock/image.py", line 151, in create_coordinator_maps
    api_data: bytes = await coord.cloud_api.get_map_v1()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/roborock/cloud_api.py", line 210, in get_map_v1
    return await self.send_command(RoborockCommand.GET_MAP_V1)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/roborock/api.py", line 394, in send_command
    response = await self._send_command(method, params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/roborock/cloud_api.py", line 207, in _send_command
    return await self.send_message(roborock_message)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/roborock/cloud_api.py", line 185, in send_message
    (response, err) = await async_response
                      ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/roborock/api.py", line 325, in _wait_response
    raise RoborockTimeout(f"id={request_id} Timeout after {self.queue_timeout} seconds") from None
roborock.exceptions.RoborockTimeout: id=27662 Timeout after 10 seconds

thibaultmol avatar Mar 08 '24 10:03 thibaultmol

@Lash-L as you mentioned-

I do a lot to try to prevent getting rate limited

I have a single robot but I'm seeing this failure in my logs, upwards of 24,000 times in under 30 minutes. Does this mean that the Roborock integration is sending requests at nearly 1,000 times per minute? This issue seems to be causing my entire Home Assistant to be unreliable- since this issue appeared for me a few days ago I've only been able to access it intermittently. Of course I could be getting cause and effect mixed up here- maybe something else is messing with my network and this is just a symptom. Appreciate any help with figuring this out.

My log info:

Logger: aiohttp.server
Source: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:421
First occurred: 5:09:02 PM (24733 occurrences)
Last logged: 5:35:06 PM
Expand for Traceback
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 88, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/image/__init__.py", line 296, in get
    return await self.handle(request, image_entity)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/image/__init__.py", line 303, in handle
    image = await _async_get_image(image_entity, IMAGE_TIMEOUT)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/image/__init__.py", line 89, in _async_get_image
    if image_bytes := await image_entity.async_image():
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/roborock/image.py", line 99, in async_image
    map_data: bytes = await self.cloud_api.get_map_v1()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/roborock/cloud_api.py", line 210, in get_map_v1
    return await self.send_command(RoborockCommand.GET_MAP_V1)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/roborock/api.py", line 397, in send_command
    response = await self._send_command(method, params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/roborock/cloud_api.py", line 207, in _send_command
    return await self.send_message(roborock_message)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/roborock/cloud_api.py", line 185, in send_message
    (response, err) = await async_response
                      ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/roborock/api.py", line 328, in _wait_response
    raise RoborockTimeout(f"id={request_id} Timeout after {self.queue_timeout} seconds") from None
roborock.exceptions.RoborockTimeout: id=23263 Timeout after 10 seconds

jason-curtis avatar Apr 21 '24 01:04 jason-curtis

@Lash-L as you mentioned-

I do a lot to try to prevent getting rate limited

I have a single robot but I'm seeing this failure in my logs, upwards of 24,000 times in under 30 minutes. Does this mean that the Roborock integration is sending requests at nearly 1,000 times per minute?

This issue seems to be causing my entire Home Assistant to be unreliable- since this issue appeared for me a few days ago I've only been able to access it intermittently. Of course I could be getting cause and effect mixed up here- maybe something else is messing with my network and this is just a symptom. Appreciate any help with figuring this out.

My log info:


Logger: aiohttp.server

Source: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:421

First occurred: 5:09:02 PM (24733 occurrences)

Last logged: 5:35:06 PM

Expand for Traceback

Traceback (most recent call last):

  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request

    resp = await request_handler(request)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle

    resp = await handler(request)

           ^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl

    return await handler(request)

           ^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware

    return await handler(request)

           ^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware

    return await handler(request)

           ^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware

    return await handler(request)

           ^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 88, in ban_middleware

    return await handler(request)

           ^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware

    return await handler(request)

           ^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware

    response = await handler(request)

               ^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle

    result = await handler(request, **request.match_info)

             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/src/homeassistant/homeassistant/components/image/__init__.py", line 296, in get

    return await self.handle(request, image_entity)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/src/homeassistant/homeassistant/components/image/__init__.py", line 303, in handle

    image = await _async_get_image(image_entity, IMAGE_TIMEOUT)

            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/src/homeassistant/homeassistant/components/image/__init__.py", line 89, in _async_get_image

    if image_bytes := await image_entity.async_image():

                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/src/homeassistant/homeassistant/components/roborock/image.py", line 99, in async_image

    map_data: bytes = await self.cloud_api.get_map_v1()

                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/roborock/cloud_api.py", line 210, in get_map_v1

    return await self.send_command(RoborockCommand.GET_MAP_V1)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/roborock/api.py", line 397, in send_command

    response = await self._send_command(method, params)

               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/roborock/cloud_api.py", line 207, in _send_command

    return await self.send_message(roborock_message)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/roborock/cloud_api.py", line 185, in send_message

    (response, err) = await async_response

                      ^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/roborock/api.py", line 328, in _wait_response

    raise RoborockTimeout(f"id={request_id} Timeout after {self.queue_timeout} seconds") from None

roborock.exceptions.RoborockTimeout: id=23263 Timeout after 10 seconds

What version of HA are you on?

Lash-L avatar Apr 21 '24 01:04 Lash-L

I'm running HAOS. Here's the output from http://homeassistant.local:8123/config/info:

Core: 2024.4.3 Supervisor: 2024.04.0 Operating System: 12.2 Frontend: 20240404.2

Let me know if there's anything I can do to help debug.

jason-curtis avatar Apr 21 '24 01:04 jason-curtis

Hi @jason-curtis I'm slowly working on this - but i've been very overwhelmed and have a lot i am trying to balance and this is a rather complicated issue (something is spawning new connection requests) but I haven't been able to recreate it very well myself.

My thought is I am just going to make a singleton that handles all of the mqtt connections that way even on failure, there's no way a second connection will be made. But that takes time

Lash-L avatar Jun 07 '24 17:06 Lash-L

I see something similiar:

Logger: roborock.cloud_api Source: /usr/local/lib/python3.12/site-packages/roborock/api.py:332 First occurred: 26 June 2024 at 09:36:25 (5182 occurrences) Last logged: 14:40:55

[Roborock S8 Pro Ultra] A network protocol error occurred when communicating with the broker.

&

Logger: roborock.cloud_api Source: /usr/local/lib/python3.12/site-packages/roborock/cloud_api.py:63 First occurred: 26 June 2024 at 09:36:25 (5182 occurrences) Last logged: 14:40:55

[Roborock S8 Pro Ultra] Failed to connect (Unknown error.)

Running this version: Core 2024.6.3 Frontend 20240610.1

Is there any info I can provide that can make it easier to troubleshoot?

Robot is working through HA despite those errors.

CarstenDennis avatar Jul 03 '24 12:07 CarstenDennis