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.48k stars 254 forks source link

Generate Rooms Config fails #612

Closed GrimReaper1908 closed 1 year ago

GrimReaper1908 commented 1 year ago

Checklist

The problem

When I try to generate the rooms config, nothing happens. I already tried removing and adding the robot again.

What version of a card has described problem?

v2.2.2

What was the last working version card?

No response

What vacuum model do you have problems with?

Roborock S7 MaxV Ultra

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

https://github.com/humbertogontijo/homeassistant-roborock

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

Chrome

What version of Home Assistant do you use?

2023.6.1

What type of installation are you running?

Home Assistant OS

Card's configuration

type: custom:xiaomi-vacuum-map-card
map_source:
  camera: camera.roborock_s7_maxv_map
calibration_source:
  camera: true
entity: vacuum.roborock_s7_maxv
vacuum_platform: send_command
map_locked: true
tiles:
  - tile_id: status
    entity: vacuum.roborock_s7_maxv
    label: Status
    attribute: status
    icon: mdi:robot-vacuum
    translations:
      starting: Starting
      charger disconnected: Charger disconnected
      idle: Idle
      remote control active: Remote control active
      cleaning: Cleaning
      returning home: Returning home
      manual mode: Manual mode
      charging: Charging
      charging problem: Charging problem
      paused: Paused
      spot cleaning: Spot cleaning
      error: Error
      shutting down: Shutting down
      updating: Updating
      docking: Docking
      going to target: Going to target
      zoned cleaning: Zoned cleaning
      segment cleaning: Segment cleaning
      emptying the bin: Emptying the bin
      charging complete: Charging complete
      device offline: Device offline
  - tile_id: battery_level
    entity: vacuum.roborock_s7_maxv
    label: Battery
    attribute: battery_level
    icon: mdi:battery-charging-100
    unit: '%'
  - tile_id: fan_speed
    entity: vacuum.roborock_s7_maxv
    label: Fan speed
    attribute: fan_speed
    icon: mdi:fan
    translations:
      silent: Silent
      standard: Standard
      medium: Medium
      turbo: Turbo
      auto: Auto
      gentle: Gentle
  - tile_id: sensor_dirty_left
    label: Sensors left
    unit: h
    multiplier: 0.0002777777777777778
    hold_action:
      action: call-service
      service: vacuum.send_command
      confirmation: true
      service_data:
        command: reset_consumable
        params: sensor_dirty_time
        entity_id: vacuum.roborock_s7_maxv
    entity: sensor.roborock_s7_maxv_sensor_dirty_left
    icon: mdi:eye-outline
    precision: 0
    translations: {}
  - tile_id: filter_left
    label: Filter left
    unit: h
    multiplier: 0.0002777777777777778
    hold_action:
      action: call-service
      service: vacuum.send_command
      confirmation: true
      service_data:
        command: reset_consumable
        params: filter_work_time
        entity_id: vacuum.roborock_s7_maxv
    entity: sensor.roborock_s7_maxv_filter_left
    icon: mdi:air-filter
    precision: 0
    translations: {}
  - tile_id: main_brush_left
    label: Main brush left
    unit: h
    multiplier: 0.0002777777777777778
    hold_action:
      action: call-service
      service: vacuum.send_command
      confirmation: true
      service_data:
        command: reset_consumable
        params: main_brush_work_time
        entity_id: vacuum.roborock_s7_maxv
    entity: sensor.roborock_s7_maxv_main_brush_left
    icon: mdi:brush
    precision: 0
    translations: {}
  - tile_id: side_brush_left
    label: Side brush left
    unit: h
    multiplier: 0.0002777777777777778
    hold_action:
      action: call-service
      service: vacuum.send_command
      confirmation: true
      service_data:
        command: reset_consumable
        params: side_brush_work_time
        entity_id: vacuum.roborock_s7_maxv
    entity: sensor.roborock_s7_maxv_side_brush_left
    icon: mdi:brush
    precision: 0
    translations: {}
  - tile_id: cleaning_count
    label: Cleaning count
    entity: sensor.roborock_s7_maxv_total_clean_count
    icon: mdi:counter
    precision: 0
    translations: {}
icons:
  - icon: mdi:play
    conditions:
      - entity: vacuum.roborock_s7_maxv
        value_not: cleaning
      - entity: vacuum.roborock_s7_maxv
        value_not: error
      - entity: vacuum.roborock_s7_maxv
        value_not: returning
    tooltip: Start
    tap_action:
      action: call-service
      service: vacuum.start
      service_data:
        entity_id: vacuum.roborock_s7_maxv
  - icon: mdi:pause
    conditions:
      - entity: vacuum.roborock_s7_maxv
        value_not: docked
      - entity: vacuum.roborock_s7_maxv
        value_not: idle
      - entity: vacuum.roborock_s7_maxv
        value_not: error
      - entity: vacuum.roborock_s7_maxv
        value_not: paused
    tooltip: Pause
    tap_action:
      action: call-service
      service: vacuum.pause
      service_data:
        entity_id: vacuum.roborock_s7_maxv
  - icon: mdi:stop
    conditions:
      - entity: vacuum.roborock_s7_maxv
        value_not: docked
      - entity: vacuum.roborock_s7_maxv
        value_not: idle
      - entity: vacuum.roborock_s7_maxv
        value_not: error
      - entity: vacuum.roborock_s7_maxv
        value_not: paused
    tooltip: Stop
    tap_action:
      action: call-service
      service: vacuum.stop
      service_data:
        entity_id: vacuum.roborock_s7_maxv
  - icon: mdi:home-map-marker
    conditions:
      - entity: vacuum.roborock_s7_maxv
        value_not: docked
      - entity: vacuum.roborock_s7_maxv
        value_not: returning
    tooltip: Return to base
    tap_action:
      action: call-service
      service: vacuum.return_to_base
      service_data:
        entity_id: vacuum.roborock_s7_maxv
  - icon: mdi:target-variant
    conditions:
      - entity: vacuum.roborock_s7_maxv
        value_not: docked
      - entity: vacuum.roborock_s7_maxv
        value_not: error
      - entity: vacuum.roborock_s7_maxv
        value_not: cleaning
      - entity: vacuum.roborock_s7_maxv
        value_not: returning
    tooltip: Clean spot
    tap_action:
      action: call-service
      service: vacuum.clean_spot
      service_data:
        entity_id: vacuum.roborock_s7_maxv
  - icon: mdi:map-marker
    tooltip: Locate
    tap_action:
      action: call-service
      service: vacuum.locate
      service_data:
        entity_id: vacuum.roborock_s7_maxv
  - icon: mdi:fan-alert
    conditions:
      - entity: vacuum.roborock_s7_maxv
        attribute: fan_speed
        value: 'off'
    tooltip: Change fan speed
    tap_action:
      action: call-service
      service: vacuum.set_fan_speed
      service_data:
        entity_id: vacuum.roborock_s7_maxv
        fan_speed: quiet
  - icon: mdi:fan-alert
    conditions:
      - entity: vacuum.roborock_s7_maxv
        attribute: fan_speed
        value: quiet
    tooltip: Change fan speed
    tap_action:
      action: call-service
      service: vacuum.set_fan_speed
      service_data:
        entity_id: vacuum.roborock_s7_maxv
        fan_speed: balanced
  - icon: mdi:fan-alert
    conditions:
      - entity: vacuum.roborock_s7_maxv
        attribute: fan_speed
        value: balanced
    tooltip: Change fan speed
    tap_action:
      action: call-service
      service: vacuum.set_fan_speed
      service_data:
        entity_id: vacuum.roborock_s7_maxv
        fan_speed: turbo
  - icon: mdi:fan-alert
    conditions:
      - entity: vacuum.roborock_s7_maxv
        attribute: fan_speed
        value: turbo
    tooltip: Change fan speed
    tap_action:
      action: call-service
      service: vacuum.set_fan_speed
      service_data:
        entity_id: vacuum.roborock_s7_maxv
        fan_speed: max
  - icon: mdi:fan-alert
    conditions:
      - entity: vacuum.roborock_s7_maxv
        attribute: fan_speed
        value: max
    tooltip: Change fan speed
    tap_action:
      action: call-service
      service: vacuum.set_fan_speed
      service_data:
        entity_id: vacuum.roborock_s7_maxv
        fan_speed: custom
  - icon: mdi:fan-alert
    conditions:
      - entity: vacuum.roborock_s7_maxv
        attribute: fan_speed
        value: custom
    tooltip: Change fan speed
    tap_action:
      action: call-service
      service: vacuum.set_fan_speed
      service_data:
        entity_id: vacuum.roborock_s7_maxv
        fan_speed: max_plus
  - icon: mdi:fan-alert
    conditions:
      - entity: vacuum.roborock_s7_maxv
        attribute: fan_speed
        value: max_plus
    tooltip: Change fan speed
    tap_action:
      action: call-service
      service: vacuum.set_fan_speed
      service_data:
        entity_id: vacuum.roborock_s7_maxv
        fan_speed: 'off'
  - icon: mdi:fan-alert
    conditions:
      - entity: vacuum.roborock_s7_maxv
        attribute: fan_speed
        value_not: 'off'
      - entity: vacuum.roborock_s7_maxv
        attribute: fan_speed
        value_not: quiet
      - entity: vacuum.roborock_s7_maxv
        attribute: fan_speed
        value_not: balanced
      - entity: vacuum.roborock_s7_maxv
        attribute: fan_speed
        value_not: turbo
      - entity: vacuum.roborock_s7_maxv
        attribute: fan_speed
        value_not: max
      - entity: vacuum.roborock_s7_maxv
        attribute: fan_speed
        value_not: custom
      - entity: vacuum.roborock_s7_maxv
        attribute: fan_speed
        value_not: max_plus
    tooltip: Change fan speed
    tap_action:
      action: call-service
      service: vacuum.set_fan_speed
      service_data:
        entity_id: vacuum.roborock_s7_maxv
        fan_speed: 'off'
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: Pin & Go
    icon: mdi:map-marker-plus
    run_immediately: false
    coordinates_rounding: true
    selection_type: MANUAL_POINT
    max_selections: 999
    repeats_type: NONE
    max_repeats: 1
    service_call_schema:
      service: xiaomi_miio.vacuum_goto
      service_data:
        x_coord: '[[point_x]]'
        y_coord: '[[point_y]]'
        entity_id: '[[entity_id]]'
    predefined_selections: []
    variables: {}

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

Uncaught TypeError: Cannot add property 2, object is not extensible
    at Array.push (<anonymous>)
    at qs._handleRoomConfig (xiaomi-vacuum-map-card.js?hacstag=193372044222:261:969)
    at wc._handleRoomsConfigGet (xiaomi-vacuum-map-card.js?hacstag=193372044222:1222:5028)
    at qs._generateRoomsConfig (xiaomi-vacuum-map-card.js?hacstag=193372044222:163:1144)
    at qs.<anonymous> (xiaomi-vacuum-map-card.js?hacstag=193372044222:250:42)
    at ee.handleEvent (xiaomi-vacuum-map-card.js?hacstag=193372044222:17:7351)

Additional information

No response

PiotrMachowski commented 1 year ago

Remove the card, create a new one, select a correct vacuum platform and click "generate rooms config". Do not click "generate static config"

GrimReaper1908 commented 1 year ago

Oh I see. This did the trick, thank you!