Vacuum Interactive Map Card

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.

@Dorzel107 according to my quick experiment card should be able to work with following configuration:

        base_position:
          x: 1889
          'y': 1600
        reference_point:
          x: 1625
          'y': 1336

@Martinvdm I have seen that you have created an issue on github. Could you try to fix your config and confirm if everything is working?

The problem with zoned cleanup is that zones you have defined have 5 parameters instead of 4 (additional 1 ).

I didn’t know where you prefer the issue. I will continue on github. Thanks

@3_14 you are absolutly right, this was my mistake, by misconfiguring the base and reference point.
so my first thought was, that the linting wasn’t right.
i got it right now, so thanks for making such nice integration.

In yaml this is not possible, because the component does not include the zone template.
However it is possible with .js (example: your card) or python script

ps: sorry for the bad code :0)

Is it possible to implement in Node-RED?

I don’t use nodeRed, but if in node red you can run a python_script.xxxx service why not

Unfortunately I’m not an expert at all but I guess the js code maybe works.

Need an advise. I installed this card and it worked well.
After a while I tried to translate titles to Russian and it didn’t work.
Script works with English titles even after I translated all text in texts.js.
It looks like I need to clean some js cash or something. But I don’t know where to search for it.
Could you help, please?

Yes, you have to clear browser cache for whole HA page or add ?v=1 to url in resources.
Guide for clearing cache: https://www.refreshyourcache.com

Can anyone offer advice on how to define the preconfigured zones? Is it [x1, y1, x2, y2], where point 1 is the top left corner of a zone and point 2 is the bottom right? And are the numbers still corresponding to the pixels in the image, or something else?

Preconfigured zones use the same coordinate system as a vacuum. The easiest way to get values for them is to use FloleVac App for Android. Instructions are available here: https://www.home-assistant.io/components/vacuum.xiaomi_miio/#retrieving-the-zone-coordinates

I have used FloleVac in the passed to get the coordinates but it doesn’t seem to work anymore. Anyone else trouble connecting?

No… but…
Also on the mihome app? try turning off the robot and turning it back on

Mihome works fine; it’s just FloleVac that cannot connect anymore. Rebooten robot but same result.

My app works just fine…

I have never been able to connect flovac to my bot… tried most of every method starting with bluestacks, then android phone. I do however think this may be a network issue, but unfortunately I don’t know too much, just that they all on the same ip and subnet range. I run unifi and a number of ap’s. It could also do with possibly the location of the server you select on the mihome app as well as flovac. For me, i select Jersey for server option in mihome, but in flovac, there is only eu. Again, i dont know if this is it. Just that i can’t connect, but all that I can think of is what I have mentioned above…

Does any one find a way to update map?Like Mi app.

To get map from vacuum it have to be rooted. I haven’t rooted mine yet, so I haven’t added this feature to my card so far.