PiotrMachowski / lovelace-xiaomi-vacuum-map-card

This card provides a user-friendly way to fully control map-based vacuums in Home Assistant. Supported brands include Xiaomi (Roborock/Viomi/Dreame/Roidmi/Valetudo/Valetudo RE), Neato, Wyze, Roomba, Ecovacs (and probably more).
MIT License
1.48k stars 253 forks source link

Suggestion: Background "temp" image while loading the map #693

Open thedmmatt opened 11 months ago

thedmmatt commented 11 months ago

Description

Since my vacuum map extractor is already set to auto_update: false to avoid bombarding Xiaomi's API server (which would block further connections to extract the map), I was wondering if the map card could be automated to show the last snapshot the extractor received.

I know this forum is for the map card, not the extractor, but I do believe it could be handled by the map card itself.

Solution

I managed to do this using some triggers (such as docking or cleaning), so the automation would take a snapshot whenever that state changed. Then in the map card, I used JS and CSS to identify whenever the camera was still loading to display the last snapshot over it.

The issue is that this approach starts to be faulty sometimes, especially when the device screen ratio dislocates the image. However, I noticed that the #shadow-root element can be tempered during a state refresh, so could you do that from the map card itself

Anyways, just an idea if anyone wants to discuss further. Should anyone be interested in that as well, I can start a pull for Piotr to take into consideration.

Alternatives

No response

Context

No response