lovelace-xiaomi-vacuum-map-card: Error for default vacuum platform with Neato bots

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

This line: https://github.com/PiotrMachowski/lovelace-xiaomi-vacuum-map-card/blob/f5e13cc0e2c26a2d0f52093cc03ac3955e37ca6d/src/model/generators/icon-list-generator.ts#L166

… assumes that there’s a fan_speed_list attribute on the vacuum, which is optional in the vacuum device type for HA. Neato botvacs, in particular, don’t have said attribute. Seems like checking for null and omitting the fan speed icon would be the safe thing here.

What version of a card has described problem?

2.0.8

What was the last working version card?

No response

What vacuum model do you have problems with?

Neato Botvac D7

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

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

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

All

What version of Home Assistant do you use?

2021.12.1

What type of installation are you running?

Home Assistant Container

Card’s configuration

No response

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

xiaomi-vacuum-map-card.js?hacstag=193372044208:557 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'length')
    at Function.generate (xiaomi-vacuum-map-card.js?hacstag=193372044208:557)
    at HTMLElement._setPresetIndex (xiaomi-vacuum-map-card.js?hacstag=193372044208:836)
    at HTMLElement._firstHass (xiaomi-vacuum-map-card.js?hacstag=193372044208:836)
    at HTMLElement.set hass [as hass] (xiaomi-vacuum-map-card.js?hacstag=193372044208:836)
    at HTMLElement.value (hui-masonry-view.ts:44)
    at hui-masonry-view.ts:44
    at Array.map (<anonymous>)
    at HTMLElement.value (hui-masonry-view.ts:44)
    at HTMLElement.value (hui-masonry-view.ts:44)
    at HTMLElement.value (hui-masonry-view.ts:44)

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 33 (19 by maintainers)

Most upvoted comments

My bad. Apparently you can’t just replace the file when it was installed with HACS. I had to delete the matching .gz file that HACS creates (and serves) when it installs a frontend component. Once I deleted the .gz, it started serving the .js file.

…aaaaaand… IT WORKS!

image

Thanks for all the help man. So stoked to have this working.

Here’s an example of a working config on Neato:

type: custom:xiaomi-vacuum-map-card
platform: default
title: Dusty (downstairs)
entity: vacuum.dusty
preset_name: Live Map
map_source:
  camera: camera.dusty_cleaning_map
calibration_source:
  calibration_points:
    - vacuum:
        x: 1
        'y': 1
      map:
        x: 1
        'y': 1
    - vacuum:
        x: 1562
        'y': 1916
      map:
        x: 1562
        'y': 1916
    - vacuum:
        x: 1
        'y': 1916
      map:
        x: 1
        'y': 1916
icons:
  - icon: mdi:play
    tap_action:
      action: call-service
      service: vacuum.start
      service_data:
        entity_id: vacuum.dusty
  - icon: mdi:pause
    tap_action:
      action: call-service
      service: vacuum.pause
      service_data:
        entity_id: vacuum.dusty
  - icon: mdi:stop
    tap_action:
      action: call-service
      service: vacuum.stop
      service_data:
        entity_id: vacuum.dusty
  - icon: mdi:home
    tap_action:
      action: call-service
      service: vacuum.return_to_base
      service_data:
        entity_id: vacuum.dusty
  - icon: mdi:map-marker
    tap_action:
      action: call-service
      service: vacuum.locate
      service_data:
        entity_id: vacuum.dusty
tiles:
  - label: Battery
    icon: mdi:battery
    entity: vacuum.dusty
    attribute: battery_level
    unit: '%'
  - label: Status
    icon: mdi:robot-vacuum-variant
    entity: vacuum.dusty
    attribute: status
  - label: Area Cleaned
    icon: mdi:view-grid-outline
    entity: vacuum.dusty
    attribute: clean_area
    precision: 0
    unit: ' sqft'
map_modes:
  - template: vacuum_clean_segment
    predefined_selections:
      - id: 1
        outline:
          - - 921
            - 1066
          - - 250
            - 1066
          - - 250
            - 750
          - - 921
            - 750
          - - 921
            - 1066
        label:
          text: Kitchen
          x: 580
          'y': 900
          offset_y: 30
        icon:
          name: mdi:fridge
          x: 580
          'y': 900
      - id: 2
        outline:
          - - 921
            - 1068
          - - 250
            - 1068
          - - 250
            - 1631
          - - 921
            - 1631
          - - 921
            - 1068
        label:
          text: Dining
          x: 580
          'y': 1300
          offset_y: 30
        icon:
          name: mdi:food
          x: 580
          'y': 1300

Note this doesn’t handle segment cleaning yet. It just shows the segments and allows selection.

Here’s the result: image