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

Unable to automatically generate rooms

MYanello opened this issue · comments

Checklist

  • I have updated the card to the latest version available
  • I have cleared the cache of my browser
  • I have checked if the problem is already reported

The problem

I have a roborock S4 and am trying to generate the room config through the UI. The map imports fine in the lovelace card and I can control the vacuum ok, however clicking on generate rooms config does nothing. Reviewing the logs I see this pop up after pressing the button:

Logger: frontend.js.latest.202302020
Source: components/system_log/__init__.py:254
First occurred: 4:34:50 PM (1 occurrences)
Last logged: 4:34:50 PM
http://192.168.1.4:8123/hacsfiles/lovelace-xiaomi-vacuum-map-card/xiaomi-vacuum-map-card.js?hacstag=193372044212:244:790 TypeError: 2 is read-only 

Any ideas what could be the issue here? I attempted a reinstall of the map card but got no change.

What version of a card has described problem?

2.1.2

What was the last working version card?

No response

What vacuum model do you have problems with?

roborock.vacuum.s4

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

https://www.home-assistant.io/integrations/xiaomi_miio/

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

Chrome and Firefox

What version of Home Assistant do you use?

2023.2.2

What type of installation are you running?

Home Assistant OS

Card's configuration

type: custom:xiaomi-vacuum-map-card
title: Test
preset_name: Live map
entity: vacuum.roborock_s4
map_source:
  camera: camera.xiaomi_cloud_map_extractor
calibration_source:
  camera: true
map_modes:
  - name: Zone cleanup
    icon: mdi:select-drag
    run_immediately: false
    coordinates_rounding: true
    selection_type: MANUAL_RECTANGLE
    max_selections: 5
    repeats_type: EXTERNAL
    max_repeats: 3
    service_call_schema:
      service: xiaomi_miio.vacuum_clean_zone
      service_data:
        zone: '[[selection]]'
        repeats: '[[repeats]]'
        entity_id: '[[entity_id]]'
    predefined_selections: []
    variables: {}
  - name: Path
    icon: mdi:map-marker-path
    run_immediately: false
    coordinates_rounding: true
    selection_type: MANUAL_PATH
    max_selections: 999
    repeats_type: NONE
    max_repeats: 1
    service_call_schema:
      service: script.vacuum_follow_path
      service_data:
        service: xiaomi_miio.vacuum_goto
        mode: individual
        path: '[[selection]]'
        entity_id: '[[entity_id]]'
    predefined_selections: []
    variables: {}
  - name: Rooms
    icon: mdi:floor-plan
    run_immediately: false
    coordinates_rounding: true
    selection_type: ROOM
    max_selections: 999
    repeats_type: REPEAT
    max_repeats: 3
    service_call_schema:
      service: xiaomi_miio.vacuum_clean_segment
      service_data:
        segments: '[[selection]]'
        entity_id: '[[entity_id]]'

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

None

Additional information

Tested using two different yaml's, one that I manually added some rooms to successfully, and one that is just using the 'generate static config' button. I also get the following warning in the logs but assume it is unimportant:

Source: helpers/entity_platform.py:822
Integration: Camera (documentation, issues)
First occurred: 4:36:10 PM (2 occurrences)
Last logged: 4:42:35 PM

Updating xiaomi_cloud_map_extractor camera took longer than the scheduled update interval 0:00:05```

Does camera.xiaomi_cloud_map_extractor entity has attribute rooms?

Yes, here's my config:


camera:
  - platform: xiaomi_cloud_map_extractor
    host: 192.168.5.2
    token: !secret xiaomi_vacuum_token
    username: !secret xiaomi_cloud_username
    password: !secret xiaomi_cloud_password
    draw: ['all']
    attributes:
      - calibration_points
      - rooms
      - room_numbers
    colors:
      color_path: [188, 84, 84]

Can you show attributes of camera.xiaomi_cloud_map_extractor entity?

Of course,

calibration_points: 
- vacuum:
    x: 25500
    'y': 25500
  map:
    x: 332
    'y': 211
- vacuum:
    x: 26500
    'y': 25500
  map:
    x: 352
    'y': 211
- vacuum:
    x: 25500
    'y': 26500
  map:
    x: 332
    'y': 191

room_numbers: 
'16': null
'17': null
'18': null
'19': null
'20': null
'21': null
'22': null
'23': null
'24': null
'25': null
'26': null

rooms: 
'16':
  x0: 17200
  y0: 14700
  x1: 23800
  y1: 21800
'17':
  x0: 20350
  y0: 21600
  x1: 27450
  y1: 27950
'18':
  x0: 20400
  y0: 26600
  x1: 23650
  y1: 31000
'19':
  x0: 23800
  y0: 16500
  x1: 28600
  y1: 22050
'20':
  x0: 23100
  y0: 14850
  x1: 28600
  y1: 17850
'21':
  x0: 13750
  y0: 14000
  x1: 18500
  y1: 20650
'22':
  x0: 14300
  y0: 19950
  x1: 18200
  y1: 24050
'23':
  x0: 18650
  y0: 22100
  x1: 21950
  y1: 23250
'24':
  x0: 18500
  y0: 23400
  x1: 20350
  y1: 25900
'25':
  x0: 14250
  y0: 23550
  x1: 18200
  y1: 25600
'26':
  x0: 20550
  y0: 24550
  x1: 21950
  y1: 26600

model: roborock.vacuum.s4
used_api: xiaomi
entity_picture: /api/camera_proxy/camera.xiaomi_cloud_map_extractor?token=
friendly_name: Xiaomi Cloud Map Extractor
supported_features: 1

Ok, everything looks ok. Have you tried to generate rooms on empty card (before adding map_modes)?

Ah that did the trick. Thank you!