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).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ecovacs

bocchinofr opened this issue · comments

Integration repository

https://github.com/DeebotUniverse/Deebot-4-Home-Assistant

Supported features

  • Zone cleaning (using 4 coordinates)
  • Room cleaning (using room id/number)
  • Going to point (using 2 coordinates)
  • Cleaning a point (using 2 coordinates)
  • Others

Vacuum entity/entities

fan_speed_list:
  - quiet
  - normal
  - max
  - max+
battery_level: 81
battery_icon: mdi:battery-charging-80
fan_speed: normal
rooms:
  living_room: 2
  corridor: 1
  dining_room: 8
  kitchen: 3
  bedroom: 4
  bathroom: 5
  kids_room: 7
  laundry: 6
last_error: 'NoError: Robot is operational (0)'
friendly_name: Arturo
supported_features: 15228

Service calls

service: vacuum.send_command
data: {}
target:
  area_id: cucina
  device_id: 9b5fb2d6642fd7645b750a5e469654b8

Other info

Can you add the support for ecovacs?

Supported features

  • Zone cleaning (using 4 coordinates)
  • Room cleaning (using room id/number)
  • Going to point (using 2 coordinates)
  • Cleaning a point (using 2 coordinates)

@bocchinofr can you provide service calls for selected functionalities?

service: vacuum.send_command
data:
  command: spot_area
    params:
      rooms: 8
      cleanings: 1
target:
  entity_id: vacuum.arturo
service: vacuum.send_command
data:
  entity_id: vacuum.Arturo
  command: app_zoned_clean
  params: [22250,27500,29400,25000,1]
service: vacuum.send_command
data:
  entity_id: vacuum.arturo
  command: app_goto_target
  params: [29300, 27300]

I hadn’t use the command to clean a point

Are you sure about last two services? They look exactly the same like ones for Xiaomi vacuums

Sorry, the right command is :

service: vacuum.send_command
target:
  entity_id: vacuum.NOME_ROBOT
data:
  command: custom_area
  params:
    coordinates: -1339,-1511,296,-2587

i didn't find the command to going to point or clean a point

Is it possible to get map from Ecovacs vacuums?

yes, it is possible.
For example I created a picture entity like this :

show_state: true
show_name: false
camera_view: auto
type: picture-entity
entity: camera.arturo_live_map
aspect_ratio: 50%

which integration do you use?

thanks to the answer :)

I use "Deboot 4 home assistant" https://deebot.readthedocs.io/integrations/home-assistant/

@bocchinofr @luigistrauss @kotana

Could you provide me some info about entities created by Ecovacs integration?

  1. Open your main dashboard
  2. Open browser's dev tools (with F12 button)
  3. Open console
  4. Paste following code in the console:
    getDeviceData = async (entity) => {
        const hass = document.querySelector("home-assistant").hass;
        const vacuumDeviceId = (
            await hass.callWS({
                type: "config/entity_registry/get",
                entity_id: entity,
            })
        )["device_id"];
        const vacuumSensors = (
            await hass.callWS({
                type: "config/entity_registry/list",
            })
        ).filter(e => e.device_id === vacuumDeviceId);
        Promise.all(
            vacuumSensors.map(vs =>
                hass.callWS({
                    type: "config/entity_registry/get",
                    entity_id: vs.entity_id,
                }),
            ),
        ).then(v => console.log(v));
    }
  5. Retrieve entities related to the vacuum entity using following command:
    getDeviceData("vacuum.your_vacuum");
  6. Two entries should be printed, please copy content of the second one (click with right mouse button on it and choose "Copy object" option)
  7. Send me copied values to piotr.machowski.dev [at] gmail.com
commented

Hi Piotr Machowski

I get an invalid calibration message.
Probably I would have to do it via Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor
still calibrate the map?
Does that work? Or do I have to do something different?

image

image

@bocchinofr @luigistrauss @kotana

Can you check out v2.1.3-beta.3?

how can i use the beta version ?

@kotana Map Extractor won't work with your vacuum, so you have to manually figure out where are which coordinates (similarly to this approach). If you don't want to use custom_area cleaning you can use following config:

calibration_source:
  identity: true

After calibration you can retrieve coordinates to using this guide

The other way is to create a feature request in the Ecovacs integration to add calibration points to its map


@bocchinofr it's available in HACS when you enable "show beta versions"

After installing you can create a card using following config:

type: custom:xiaomi-vacuum-map-card
entity: vacuum.arturo
map_source:
  camera: camera.arturo_live_map
calibration_source:
  identity: true
vacuum_platform: "DeebotUniverse/Deebot-4-Home-Assistant"
map_modes:
  - template: vacuum_clean_segment
    predefined_selections:
      - id: 2
        outline: [[ 10, 10], [ 10, 100], [ 100, 100], [ 100, 10]]
        label:
          text: "living_room"
          x: 50
          y: 50
          offset_y: 35
        icon:
          name: "mdi:broom"
          x: 50
          y: 50
      - id: 1
        outline: [[ 110, 110], [ 110, 200], [ 200, 200], [ 200, 110]]
        label:
          text: "corridor"
          x: 150
          y: 150
          offset_y: 35
        icon:
          name: "mdi:broom"
          x: 150
          y: 150
      - id: 8
        outline: [[ 210, 210], [ 210, 300], [ 300, 300], [ 300, 210]]
        label:
          text: "dining_room"
          x: 250
          y: 250
          offset_y: 35
        icon:
          name: "mdi:broom"
          x: 250
          y: 250

Please check if room cleaning works

@bocchinofr you forgot to attach the error

Sorry, this is the error

9A161C34-7E78-411B-ADBD-2B7C5CAA8E0A

Are you sure you have the latest beta version? Can you try changing vacuum platform using visual editor?

@bocchinofr Have you tried to do it using HACS?

@kotana can you check if room cleaning and zone cleaning work for you?

@bocchinofr yes, I have configured only 3 rooms and I'm not able to calibrate your map for you.


I have created a feature request to add calibration points to Ecovacs integration:

DeebotUniverse/Deebot-4-Home-Assistant#321

@PiotrMachowski First of all your card looks amazing and thank you for sharing your work and time :) I must give it a try next week :)

I'm the maintainer of the integration and I can give you some feedback about the features.

I gave a look at the template file
I'm not sure if I understood everything correctly...

Ecovacs supports only cleaning in all modes twice, so probably max_repeat should be 2

Features:

  • MANUAL_RECTANGLE supported and already implemented in the template. Only one rectangle is supported
  • PREDEFINED_RECTANGLE: should be supported as it is the same as above on the integration perspective
  • MANUAL_POINT: Only supported on newer bots and currently not implemented by the integration. Would i leave it out of scope for now. Need to add some features map first in the integration
  • PREDEFINED_POINT: Same as manual point
  • ROOM: Supported also multiple at ones. You need to pass the id of the room defined by the bot.
    service: vacuum.send_command
    data:
      entity_id: "your bot"
      command: spot_area
      params:
        rooms: "1,2,3"
        cleanings: 1
    Not sure if this is correctly in the template.
  • MANUAL_PATH: Not supported

It is also possible to get the coordinates for each room (ex. -2700,-7450;-2700,-6750;-2550,-6650;...). If I expose this information to HA, would it possible to create the rooms automatically (use it like the outline property)?

Is there anything beside the DeebotUniverse/Deebot-4-Home-Assistant#321 that I can help to support my integration?

First of all your card looks amazing and thank you for sharing your work and time :) I must give it a try next week :)

@edenhaus Thank you! It took a lot of effort to get it to the current state

Ecovacs supports only cleaning in all modes twice, so probably max_repeat should be 2

Noted, I will update the template

ROOM: Supported also multiple at ones

It should work with current version of a template, but I have to add cleanings parameter

MANUAL_PATH: Not supported

I have made a script that sends a vacuum to a specific point one by one. It doesn't seem to be useful, I made it mostly just because I could 😃

It is also possible to get the coordinates for each room (ex. -2700,-7450;-2700,-6750;-2550,-6650;...). If I expose this information to HA, would it possible to create the rooms automatically (use it like the outline property)?

At this moment it's not possible to do it. I have included a room config generator, but right now it is made specifically for Map Extractor and handles just rectangular outlines. I might improve this functionality to handle outlines as well. Should I create a separate feature request in your repo?

Is there anything beside the DeebotUniverse/Deebot-4-Home-Assistant#321 that I can help to support my integration?

This comment helped a lot, it should be enough at this moment (beside room outlines)

It should work with current version of a template, but I have to add cleanings parameter

This is the parameter of the repeats. Possible values are 1 or 2

I have made a script that sends a vacuum to a specific point one by one. It doesn't seem to be useful, I made it mostly just because I could smiley

As my bot doesn't support go to point unfortunately I cannot use but nice idea.

At this moment it's not possible to do it. I have included a room config generator, but right now it is made specifically for Map Extractor and handles just rectangular outlines. I might improve this functionality to handle outlines as well. Should I create a separate feature request in your repo?

Not sure if I understood you correctly, but I think the "room config generator" is not the solution as it is a one time action. it would be cool that the card reads from a attribute, so the card is updated also when I make changes of the room via the ecovacs app.
Ecovacs supported multiple floors and if you move the robot to a new floor also your card would get automatically the new rooms.
Ecovacs supports only getting the current active map at least for now

Not sure if I understood you correctly, but I think the "room config generator" is not the solution as it is a one time action. it would be cool that the card reads from a attribute, so the card is updated also when I make changes of the room via the ecovacs app.
Ecovacs supported multiple floors and if you move the robot to a new floor also your card would get automatically the new rooms.
Ecovacs supports only getting the current active map at least for now

You are correct, but the card can store multiple room configs and automatically (or manually) switch between them, so it shouldn't be a problem (provided that room coordinates doesn't change after changing floor back and there's a sensor that will identify current floor).

There are some scenarios where the coordinates will be updated:

  • Changes made on the map via app
  • Map/room is updated by the bot
    • You move a furniture (ex. We move the bed of your dog sometimes so the bot is able to clean underneath). In my case keeping the old coordinates is not a problem, but if it is a permanent change it would be great to handle it automatically.
    • The bot recognizes a new room or part of the map (ex. During the summer the balcony door is often open and the laser sees it also if I have enabled a virtual wall). In this scenario the map will be extended and depends where it will be extended, it is possible that all coordinates will change. The room id will still clean the correct room, only the room is drawn incorrectly by the card.
    • Some older bots are updating the map on nearly each clean. I got some bugs reported, where the room id is changed randomly and therefore I suggest the user to take always the the room id from the attributes by name

The first 2-3 we could says the user must update the room config manually. But the last point without automatically update would be a pain.
To reduce work on your side, I will leave it with a custom room config for now, but I think a automatically way would be great for the future. What do you think?

@bocchinofr

the version and according to you definitive ? I don't see the map mode
options.

You don't see them because you have only one map mode configured. Changes specific to Ecovacs are mostly done, but there will be more changes in the upcoming release.

Can the stats be aligned in any other way?

I tried to prevent having too much empty space in the card, but I'll check out if it is doable to make it more regular.


@edenhaus
I would really like to make it happen, but it is not a trivial problem. I try to make this card as much universal as can be, so autogenerating things is a bit troublesome. Additionally user might want to adjust generated code - change room names, add different icons, etc. I have some ideas that might work, but need to think it through. I'll create a separate feature request for this functionality, ok? Below you can find data format supported by current version of rooms config generator. Data is taken from rooms attribute of camera entity.

{
  "room_1_id": {
    "name": "Room 1 name",
    "icon": "mdi:broom",
    "x": 1234,
    "y": 5678,
    "x0": 1000,
    "x1": 2000,
    "y0": 5000,
    "y1": 6000
  },
  "room_2_id": {
    "name": "Room 2 name",
    "icon": "mdi:broom",
    "x": 2234,
    "y": 4678,
    "x0": 2000,
    "x1": 3000,
    "y0": 4000,
    "y1": 5000
  },
  ...
}

name -> room name (optional)
icon -> room icon (optional)
x, y -> coordinates of a room center point - used for icon and label placement (optional)
x0, x1, y0, y1 -> coordinates of a bounding rectangle of a room (mandatory)

I think that x0, x1, y0, y1 parameters can be replaced with a single outline parameter. With such config I might be able to make dynamic autoconfiguration work in the future (maybe not so distant one).

@PiotrMachowski I will for now create the map calibration data.
For the outline of the rooms, I need a analysis on my side as the given values are sometime strange and we leave this for something later.

@bocchinofr @edenhaus I have added a new feature to the card: v2.2.0-beta.4 version should display the water amount icon with a menu, could you check if it works on a real data?

@edenhaus I want to release the new version soon, are able to estimate the time that you will need to add calibration points to your integration?

@bocchinofr can you please test with this manual calibration points

[
  {
    "vacuum": {
      "x": 0,
      "y": 0
    },
    "map": {
      "x": 400,
      "y": 400
    }
  },
  {
    "vacuum": {
      "x": 6400,
      "y": 0
    },
    "map": {
      "x": 528,
      "y": 400
    }
  },
  {
    "vacuum": {
      "x": 0,
      "y": 6400
    },
    "map": {
      "x": 400,
      "y": 528
    }
  }
]

@PiotrMachowski Implementing the code would be quick, only I have currently no time to test it. If @bocchinofr can test it, I can implement it. Another question: The values are static and valid foreach model. Can we add it directly in the template?

Yes, if they are static I can include them in the card's code

@edenhaus do the coordinates somehow map to the real-world dimensions?

@edenhaus added the hard-coded calibration in v2.2.0-beta.6

@edenhaus added the hard-coded calibration in v2.2.0-beta.6

Hi @PiotrMachowski i tried to update but now i see installed the v2.2.0 beta 6.
How can i install the beta 2 ? In the HACS i not see the beta version

thanks

@bocchinofr Just install the latest beta version, it doesn't make much sense to try previous betas, as the later the closer to the final version

@bocchinofr have you found some time to perform a test of a beta version?

@bocchinofr you don't have to do any calibration now, the card should do everything by itself. Can you try it zone cleaning works for you?

Hey @PiotrMachowski
I've an ecovacs deebot N8 pro, which i integrated using Deebot 4 Home assistant, and working fine. I found about your really good looking UI integration but sadly some of the features doesn't work:

  • number of cleans cycles in Room cleaning (x1 - x2) does nothing.

  • zone cleaning doesn't work, so drawning a rectangle on the map, creates an (outside the map) rectangle in the deebot official app, and deebot returns to base.

  • Predefined zone cleaning also doesn't work, whether i get the coordinates using your integration or according to Deebot 4 home assistant docs @edenhaus , i get this error:

Failed to call service xiaomi_miio/vacuum_clean_zone. Service not
found.

Versions tried:

Configurations:

type: custom:xiaomi-vacuum-map-card
entity: vacuum.windy
vacuum_platform: DeebotUniverse/Deebot-4-Home-Assistant
map_source:
  camera: camera.windy_live_map
map_locked: true
two_finger_pan: true
map_modes:
  - template: vacuum_clean_zone
  - template: vacuum_clean_segment
    predefined_selections:
      - id: 5
        icon:
          name: mdi:sofa
          x: -5900
          'y': -8000
      - id: 0
        icon:
          name: mdi:sofa
          x: -5800
          'y': 2500
      - id: 1
        icon:
          name: mdi:bed
          x: -15200
          'y': 2000
      - id: 4
        icon:
          name: mdi:toilet
          x: -12500
          'y': -7500
      - id: 2
        icon:
          name: mdi:knife
          x: -12000
          'y': -17500
      - id: 3
        icon:
          name: mdi:door
          x: -3900
          'y': -15500
  - template: vacuum_clean_zone_predefined
    predefined_selections:
      - zones:
          - - 239
            - 184
            - 1336
            - 665
        icon:
          name: mdi:rectangle
          x: -5800
          'y': 2500

@Anashost can you create a new bug for your problems?

@PiotrMachowski ok i will open new issue.