Vacuum Interactive Map Card

I don’t understand what you mean, what is not possible with HA? To have a map like this? Or to have zoned cleaning? Because if it is the latter, this works perfectly fine with HA. I have presets to clean my rooms but I also have this interactive map card.

Edit: about the scrolling @3_14 could you make it that it won’t scroll horizontally as well? I use swipe-card and that works nicely, until I want to draw zones. It is a bit harder within a swipe card as it will try to swipe left/right.

Otherwise this card is really great. Here is an example of what I made.

1 Like

If you check the post what I shared you see what I mean. Have you tried the multiple zoned cleaning with HA automation? Not only one room but 3-4 rooms one after another, without any interuption or without that the vacuum goes back to the dock after every finished zone.
Well I have a Node RED flow to manage it but I’d like to know the HA solution too.
I have a map like your and it is working fine but not able to manage the scheduled multiple room cleaning, (I guess maybe in the future :slight_smile: ).

Ah I understand now. But my bedroom consists of 3 zones and that works without a problem as far as I know. It is a single button yes, but it has 3 zones.

Honestly I haven’t really tried otherwise but to my knowledge the robot gets lost if you set up more than 5 zones at once. I have read that somewhere (can’t remember where though).
Could it be you are trying to clean more than 5 zones at once?

I will play around with this some more as I don’t use Node red and only use HA automations.

My robot can clean all of my zones even timed it, one of them contains 3 zones (the living room) if I use the Node RED flow:

but solution of @3_14 very elegant.

My Node-RED flow:

2 Likes

I give up, I have little knowledge to do this with HA automation or Node RED. I’ve tried lot of syntax but it is failed.

i am struggling with the map.png, what resolution does it needs to be?

i have an orginal floor plan from the architect, if i take a screenshot/png from it, the zones are just to big, seems it needs to be smaller resolution

how do you guys make the plan with a non-rooted device ?

thnx

Component should handle all resolutions, but each calibration is a separate case.
You can try to calculate coordinates of points using method described in this post, maybe it will help:
https://hackernoon.com/how-i-set-up-room-cleaning-automation-with-google-home-home-assistant-and-xiaomi-vacuum-cleaner-9149e0267e6d

Personally I have created map by first sending vacuum to desired points, then screenshotting it in Mi Home and finally cleaning up in Gimp.

Ok, gonna take the screenshot approach…

Now I have loaded a PDF, but the zone that I use for my kitchen, if I define it, it overlaps the whole plan :wink:

still struggling, with map, i have now idea how to set this up, my code is below, the zones there in the code, those coordinates are actually correct, i use them already now in my automations
but on the map itself, its so huge, seems to be resolution …
i think the red map, is like 1 zone for my kitchen or hallway, but its not that huge like its now in screenshot
the blue lines in pen, those are actual the zones, so the red zone should be like that

how can i adjust this?

for me also not clear what is the base and reference point?

see screenshot how it looks now :

code:

      - type: custom:xiaomi-vacuum-map-card
        entity: vacuum.xiaomi_vacuum
        map_image: '/local/custom_lovelace/xiaomi_vacuum_map_card/map1.png'
        base_position:
          x: 89
          y: 200
        reference_point:
          x: 1625
          y: 1336
        zones:
          - [[25500, 25500, 26500, 26500]]
          - [[24215, 28125, 29465, 32175]]

Base position - coordinates of a point (on a image) that maps to position [25500,25500] in vacuum coordinates. It is usually equal or very near to localization of base station.

Reference point - coordinates of a point (on a image) that maps to position [26500,26500] in vacuum coordinates. I should be about 1.5m from base station.

If you use screenshot approach you can first call service:

{
  "entity_id": "vacuum.xiaomi_vacuum",
  "zone": [[25500, 25500, 26500, 26500]],
  "repeats": 1
}

and then make a screenshot. In this case corners of a rectangle shown in Mi Home will mark desired points on a map: base position - near docking station, reference point - on a diagonal from base position.

ok, i know now what base and ref is
i called that service, so the 2 blue dots are my base and reference

but how to translate it to pixels?

You have to fire up Paint/Gimp/any other image editor and read pixel coordinates from it.

aha, more clear now, ok, gonna install those tools
if my screenshot above is like for example 1000 / 700
then base is around x : 800 , y 600 , ref = = like x 850 , y 650
so starting point x , y , is from left corner below, right?

Pixel (1,1) is in upper left corner.
Coordinates for attached picture:

base_position:
  x: 782
  y: 130
reference_point:
  x: 848
  y: 66

perfect, working now, thnx for the info!!

1 Like

2 more questions, in the combobox, there are 3 modes:
gototarget ,zoned cleanup, zones

i dont use gototarget , can i remove it from the selection and make 1 of the other 2 as default?

It is already answered above:

You can remove any item from <paper-listbox>

Ok, thnx for all info, appreciate it

anyone, got this working using the gui editor ??

cause when i pass the example configuration in yamllint, it won’t give the correct Y: position, for reference_point and the base_position.

see example:

views: 
  - 
    cards: 
      - 
        base_position: 
          x: 1889
          ? "y"
          : 1600
        entity: vacuum.xiaomi_vacuum
        map_image: /local/custom_lovelace/xiaomi_vacuum_map_card/map.png
        reference_point: 
          x: 1625
          ? "y"
          : 1336
        type: "custom:xiaomi-vacuum-map-card"

hi @3_14. i really like your project and installed it. Did make a pixel calc for base and reference, seems to be ok. map is loaded and can view the zones. Some strange thing here:

  1. Whatever action i try, go to target or zone cleanup, nothing happens when pressing start. But via the developer tool choosing vacuum_send_command is just working fine. Following logging appears when pressing start:
2019-08-11 21:34:16 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.139766057424880] None @ data['zone'][0]
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/components/websocket_api/commands.py", line 121, in handle_call_service
    connection.context(msg))
  File "/usr/src/app/homeassistant/core.py", line 1130, in async_call
    processed_data = handler.schema(service_data)
  File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 267, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 589, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 427, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: None @ data['zone'][0]
  1. The zones on the map are not places 100% correct.