DeebotUniverse / Deebot-4-Home-Assistant

Home Assistant integration for deebot vacuums
https://deebot.readthedocs.io/integrations/home-assistant/
GNU General Public License v3.0
180 stars 41 forks source link

Refreshing the map crashes Home-Assistant #421

Closed zevele closed 1 year ago

zevele commented 1 year ago

Checks

The problem

Not sure what exactly happening. I have a picture element with the map image from the integration (not on my main tab). If I switch to the tab containing the picture element while the robot is working the map is not refreshed and after a few seconds home-assistant restarts (as in the whole system crashes and restarts itself). It also happens sometimes when the robot is not running and I call the refresh service - but not always. I don't see anything related to that in the logs. I'm running HA 2023.9.1 in a docker container on RPI 2b.

Diagnostics information

{
  "home_assistant": {
    "installation_type": "Home Assistant Container",
    "version": "2023.9.1",
    "dev": false,
    "hassio": false,
    "virtualenv": false,
    "python_version": "3.11.5",
    "docker": true,
    "arch": "armv7l",
    "timezone": "**REDACTED**",
    "os_name": "Linux",
    "os_version": "6.1.21-v7+",
    "run_as_root": true
  },
    "deebot": {
      "version": "2.0.0",
      "requirements": [
        "deebot-client==3.0.0",
        "numpy>=1.23.2"
      ]
    },
    "hacs": {
      "version": "1.32.1",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
  "integration_manifest": {
    "domain": "deebot",
    "name": "Deebot 4 Home Assistant",
    "codeowners": [
      "@DeebotUniverse",
      "@edenhaus"
    ],
    "config_flow": true,
    "documentation": "https://deebot.readthedocs.io/integrations/home-assistant",
    "iot_class": "cloud_polling",
    "issue_tracker": "https://github.com/DeebotUniverse/Deebot-4-Home-Assistant/issues",
    "loggers": [
      "custom_components.deebot",
      "deebot_client"
    ],
    "requirements": [
      "deebot-client==3.0.0",
      "numpy>=1.23.2"
    ],
    "version": "2.0.0",
    "is_built_in": false
  },
  "data": {
    "config": {
      "entry_id": "**REDACTED**",
      "version": 4,
      "domain": "deebot",
      "title": "**REDACTED**",
      "data": {
        "username": "**REDACTED**",
        "password": "**REDACTED**",
        "country": "**REDACTED**",
        "continent": "**REDACTED**"
      },
      "options": {
        "devices": "**REDACTED**"
      },
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "user",
      "unique_id": null,
      "disabled_by": null
    },
    "device": {
      "did": "**REDACTED**",
      "name": "**REDACTED**",
      "class": "ucn2xe",
      "resource": "axWv",
      "nick": "**REDACTED**",
      "company": "eco-ng",
      "bindTs": "**REDACTED**",
      "service": {
        "jmq": "jmq-ngiot-as.dc.ww.ecouser.net",
        "mqs": "api-ngiot.dc-as.ww.ecouser.net"
      },
      "homeId": "**REDACTED**",
      "homeSort": 1,
      "deviceName": "DEEBOT T9",
      "icon": "https://portal-ww.ecouser.net/api/pim/file/get/603f510e3b03f50007b6c2c9",
      "ota": true,
      "UILogicId": "T9_PRO_G",
      "materialNo": "**REDACTED**",
      "pid": "**REDACTED**",
      "product_category": "DEEBOT",
      "model": "DEEBOT_OZMO_T9",
      "updateInfo": {
        "needUpdate": false,
        "changeLog": ""
      },
      "status": 1,
      "otaUpgrade": {}
    }
  }
}

Anything in the logs that might be useful for us?

No response

Additional information

No response

edenhaus commented 1 year ago

Please activate debug logs and analyze them. They persist a restart.

As written in the installation docs a RPi 3-4 should be used and I assume that your RPi has not enough power (CPU, RAM) to generate the image.

Do you have running other docker containers or addons?

zevele commented 1 year ago

To cause the crash I called the refresh service quickly few times then refreshed the browser (F5) - then Home-Assistant rebooted. I enabled debug logs for the device. I get a lot of messages from the integration. I hesitate to share the full log but in the last few lines I see: 2023-09-14 13:51:50.060 DEBUG (SyncWorker_1) [deebot_client.map] [get_base64_map] Begin 2023-09-14 13:51:50.081 DEBUG (MainThread) [deebot_client.mqtt_client.client] Received PUBLISH (d0, q0, r0, m0), '"**REDACTED**"', ... (149 bytes) 2023-09-14 13:51:50.127 DEBUG (MainThread) [deebot_client.mqtt_client.client] Received PUBLISH (d0, q0, r0, m0), '"**REDACTED**"', ... (149 bytes) 2023-09-14 13:51:50.143 DEBUG (MainThread) [deebot_client.mqtt_client.client] Received PUBLISH (d0, q0, r0, m0), '"**REDACTED**"', ... (149 bytes) 2023-09-14 13:51:50.147 DEBUG (MainThread) [deebot_client.mqtt_client] Got message: topic="**REDACTED**", payload=b'{"**REDACTED**"}' 2023-09-14 13:51:50.149 DEBUG (MainThread) [deebot_client.mqtt_client] Command getMapSet does not support p2p handling (yet) 2023-09-14 13:51:50.201 DEBUG (MainThread) [deebot_client.mqtt_client.client] Received PUBLISH (d0, q0, r0, m0), '"**REDACTED**"', ... (148 bytes) 2023-09-14 13:51:50.226 DEBUG (MainThread) [deebot_client.mqtt_client.client] Received PUBLISH (d0, q0, r0, m0), '"**REDACTED**"', ... (866 bytes) 2023-09-14 13:51:50.641 DEBUG (SyncWorker_4) [deebot_client.map] [_draw_map_pieces] Draw

The "Draw" is the last line in the log. Is there a specific thing to look for?

Could be that the RPI 2b is to blame, but - for what its worth, with the same system there wasn't any issues with the live view (of the older versions). Some times the map loads correctly (when the robot is not working and when I don't over do it).

The docker runs home assistant and portainer. There is also a mosquitto server running on this machine. Usually load is pretty low on the machine (2-3%) and free memory is around 0.5GiB.

edenhaus commented 1 year ago

The code for generating the map has not changed recently. Probably your HA or addons require more ressources as before and than there are not much ram left for generating the image.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

zevele commented 10 months ago

It seems that this issue was solved in the last update (to v3.1.0 and HA 2024.1.2). Now the map does not cause HA to crash. But now there is increased CPU load because the map is being polled every second (or am I doing something wrong?), even when the robot is idle.