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.42k stars 246 forks source link

Ecovacs Deebot issues #600

Open Anashost opened 1 year ago

Anashost commented 1 year ago

Checklist

The problem

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:

What version of a card has described problem?

v2.2.0

What was the last working version card?

None

What vacuum model do you have problems with?

Ecovacs Deebot N8 Pro

Which integration do you use to control your vacuum (link)?

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

What browser (browsers/apps) does have this problem?

All

What version of Home Assistant do you use?

2023.5.4

What type of installation are you running?

Home Assistant OS

Card's configuration

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

Javascript errors shown in the browser's console (if applicable)

No response

Additional information

No response

PiotrMachowski commented 1 year ago

Can you also add a snapshot (created using camera.snapshot service - to keep the same resolution as original map image) of camera and a screenshot from the app with an invalid zone and its coordinates?

Anashost commented 1 year ago

Never done something like that 😅 i will try once I'm on my PC.

Anashost commented 1 year ago

snapshot


Screenshot_20230603_173035_ECOVACS HOME


Screenshot_20230603_181402_ECOVACS HOME

This is how it looks in the vacuum card: Screenshot_20230603_182621_Home Assistant

I hope that can help debugging the issues.

PiotrMachowski commented 1 year ago

Great, thank you!

PiotrMachowski commented 1 year ago

I have investigated your problems and:

Anashost commented 1 year ago

Thanks, i will wait for the next release/beta to test predefined zone cleaning. But zone cleaning is what i really care about, as i use it a lot, so it would be nice if it works.

PiotrMachowski commented 1 year ago
  • This is the entity_id for repeats: number.VACUUM-NAME_clean_count Which works in @edenhaus integration.

According to the documentation cleanings parameter should work as well

  • When i use the coordinates that i generate...

Does this version work as well?

service: vacuum.send_command
target:
  entity_id: vacuum.windy
data:
  command: custom_area
  params:
    coordinates: 198, 781, 1332, 1911

You can try to use following cofig (you have to adjust coordinates of icons/zones):

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
calibration_source:
  calibration_points:
    - vacuum:
        x: 198
        y: 781
      map:
        x: 240
        y: 401
    - vacuum:
        x: 198
        y: 1991
      map:
        x: 240
        y: 469
    - vacuum:
        x: 1332
        y: 1991
      map:
        x: 310
        y: 469
map_modes:
  - template: vacuum_clean_zone
  - template: vacuum_clean_segment
    ...
PiotrMachowski commented 1 year ago

Predefined zone cleaning fixed in v2.2.1

Anashost commented 1 year ago

Thanks boss, will try in the morning, otherwise the neighbors will call the police.

Anashost commented 1 year ago

Sorry @PiotrMachowski if I'm becoming a little bit of a headache 😅, so here we go.

Does this version work as well?

service: vacuum.send_command
target:
  entity_id: vacuum.windy
data:
  command: custom_area
  params:
    coordinates: 198, 781, 1332, 1911

Yes it worked like this too.

Predefined Zone cleaning now works 👌🏻 but as Zone cleaning still doesn't create zones correctly, still can't use it.

Current issues:


PiotrMachowski commented 1 year ago

Repeats (which still doesn't work) can be specified only in Room cleaning, as you can see:

Zone cleaning doesn't have a "cleanings" parameter in the service call, so it is not available to select here.

Ok, so what I need are 4 sets of coordinates made for the same zone (marked on the map):

Such data should make it possible to create a calibration for you (and possibly all other Ecovacs vacuums)

Anashost commented 1 year ago

OK:

  • one retrieved from the vacuum - the "correct" ones

[[358, 3388, 1890, 2508]]

  • one retrieved from the card with calibration points I have sent above

[[361, -778, 1850, 145]]

  • one retrieved from the card with no calibration_source config

[[-7539, -4372, -2899, -1738]]

  • one retrieved from the card with following calibration_source config:
    calibration_source:
    identity: true

    [[249, 312, 342, 365]]

PiotrMachowski commented 1 year ago

Can you try these ones?

        - vacuum:
            x: 358
            y: 3388
          map:
            x: 249
            y: 312
        - vacuum:
            x: 358
            y: 2508
          map:
            x: 249
            y: 365
        - vacuum:
            x: 1890
            y: 2508
          map:
            x: 342
            y: 365
Anashost commented 1 year ago

@PiotrMachowski very very nice, it's creating Zones perfectly now, really big Thanks for your work.

Final question 😅 is there an easy way to create outlines for the rooms, as getting the coordinates from the card gives me something like this: [[-611, -307, 1873, 3376]]

While i need something like this for the outlines to work: [[1900, -805],[-700, -805],[-700, 3550],[1900, 3550]]

and, what about if the room not a rectangle, but a more complex shape 🤔

PiotrMachowski commented 1 year ago

To get outline you have to change vacuum platform to "Setup integer", choose "Path" mode, mark an outline of the room and click "Copy selection"

Anashost commented 1 year ago

I've just tried it, works perfectly. Thanks a lot.

edenhaus commented 1 year ago
  • zone cleaning: it looks like the calibration is incorrect (@edenhaus are you sure about static calibration you have sent?)

Sorry for the late answer. But the calibration data was only meant for testing purposes by others as I currently don't have time to do it.

edenhaus commented 1 year ago
  • This is the entity_id for repeats: number.VACUUM-NAME_clean_count Which works in @edenhaus integration.

According to the documentation cleanings parameter should work as well

@PiotrMachowski please use as described in the docs the cleanings parameter as this parameter is supported by all models and the clean count sensor only for a few newer models. For example my model is also not supporting it

PiotrMachowski commented 1 year ago

Sorry for the late answer.

@edenhaus No problem, I was aware that this might not be the final solution, but I have released it to be able to get more feedback about this functionality. Please don't treat this issue/discussion as pushing you to implement changes, I'm just trying to investigate the problem and maybe find the solution that will work for everyone.


But the calibration data was only meant for testing purposes by others as I currently don't have time to do it.

During calculation of calibration points I have found out following differences compared to your calibration:


@PiotrMachowski please use as described in the docs the cleanings parameter as this parameter is supported by all models and the clean count sensor only for a few newer models. For example my model is also not supporting it

The card uses this approach and it seems that it doesn't work (you can check out the code here)

@Anashost could you provide the service call with repeats set to 2 (using card's "copy service call" functionality)?

In my case it looks the following way:

{
  "domain": "vacuum",
  "service": "send_command",
  "serviceData": {
    "entity_id": "vacuum.test",
    "command": "spot_area",
    "params": {
      "rooms": "0,1",
      "cleanings": 2
    }
  }
}
Anashost commented 1 year ago

@Anashost could you provide the service call with repeats set to 2 (using card's "copy service call" functionality)?

In my case it looks the following way:

{
  "domain": "vacuum",
  "service": "send_command",
  "serviceData": {
    "entity_id": "vacuum.test",
    "command": "spot_area",
    "params": {
      "rooms": "0,1",
      "cleanings": 2
    }
  }
}

it looks the same as yours, but nothing happen as the entity id value stay 1 number.VACUUM-NAME_clean_count

{
  "domain": "vacuum",
  "service": "send_command",
  "serviceData": {
    "entity_id": "vacuum.windy",
    "command": "spot_area",
    "params": {
      "rooms": "5",
      "cleanings": 2
    }
  }
}
tantai251295 commented 1 year ago

@Anashost how you get "one retrieved from the vacuum - the "correct" ones" without app ?

tantai251295 commented 1 year ago

@PiotrMachowski i have calibration my map to work correctly, but after I open the door and recleaning, images of map to change and my calibration not work correctly ?? how do i calibrate correctly no matter the size of the image ??

PiotrMachowski commented 1 year ago

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

edenhaus commented 1 year ago

The calibration data should be static. At least I use a static formula to generate the map.

During calculation of calibration points I have found out following differences compared to your calibration:

* The "resolution" (vacuum diff/map diff) turned out to be 0.06 (compared to 0.02)

* The (0,0) point in vacuum coordinates maps to ~(230, 520) point in map coordinates (compared to 400, 400)

* The y axis is inverted - in the card if you're getting closer to the bottom then the y value increases, it seems to be the other way in the case of calibration that seems to work for @Anashost

Hopefully I have time next week to give it a look.

@tantai251295 Can you please share me some screenshot with before/after