Hypfer / lovelace-valetudo-map-card

Display the map from a valetudo-enabled robot in a home assistant dashboard card.
MIT License
252 stars 35 forks source link

High CPU usage with live map #52

Closed alceasan closed 2 years ago

alceasan commented 4 years ago

Whenever starts a clean from my vacuum, CPU usage on homeassistant container goes up to 100% inmediatly when viewing the card.

I'm not sure if it's the same problem as this issue on another live map for vacuum project: Live map camera loads CPU #66, it seems that the browser tries to get an updated image every 10-15 milliseconds.

TheLastProject commented 4 years ago

The CPU usage of the container itself? That doesn't sound like it could be related to the card at all, as it's purely JavaScript so purely runs in the browser.

Does the problem really go away if you remove the card? Or does it go away if you remove the parts in configuration.yml? And do you use MQTT or not?

alceasan commented 4 years ago

Here are some stats, they all are from the homeassistant container itself, for the record I'm using two vaccums with valetudo:

This is my current config of MQTT sensor for mapping:

ntcong commented 4 years ago

I think it's just HA collect data from mqtt sensor. I tried to increase scan_interval from the default 5 to 15 and it does lower the system load a bit (load from 5->3).

rainer-geiger commented 4 years ago

Hi! First of all I want to say that I find this project fantastic!

But unfortunately I can confirm what @alceasan said. I use a Core i5 server with Hassio and libvirt. When I have the live map in Lovelace the CPU usage of both the VM and the host increases to 80-100%. If I close the browser, the load drops to 60 to 80%. If I remove the card (MQTT map-sensor still present), the utilization is at normal values around 0-5%. I also excluded the sensor from the recorder via exclude.

My configuration:

sensor:
[...]
- platform: mqtt
  state_topic: "valetudo/rockrobo/state"
  json_attributes_topic: "valetudo/rockrobo/map_data"
  name: rockrobo_map
  value_template: 'OK'
  scan_interval: 10

recorder:
  [...]
  exclude:
    entities:
      - sensor.rockrobo_map

lovelace:
- crop:
      bottom: -113
      left: 110
      right: -120
      top: 120
   entity: sensor.rockrobo_map
   map_scale: 1.5
   min_height: 0
   rotate: 0
   title: Reinigungskarte
   type: 'custom:valetudo-map-card'
   vacuum_entity: vacuum.rockrobo
forast3r commented 3 years ago

Hi, recently rooted my gen1 and installed valetudo. Have noticed similar behaviour when vacuuming and the live map is updated. In my case I used HA's autodiscovery. I guess that I should manually create the sensors to modify the scan interval, right?

oystermon commented 2 years ago

Hi I'm running HA in a docker on an i3 mini pc with a gen1 vacuum - just did a test and don't get this issue. Using MQTT.