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 253 forks source link

Unable to send command to the vacuum: {'code': -10000, 'message': 'data for segment is not a number'} #635

Closed linuxstony closed 1 year ago

linuxstony commented 1 year ago

Checklist

The problem

I updated HA to the latest version and after that the card sadly stopped working in one area. I am able to select the rooms I have configured and hit start. It reports "Succeeded" but in the logs the above mentioned error occurs.

I apologize if this is a simple error on my part, but it was ages ago that I configured the vacuum and it used to work flawlessly until now.

Sadly I am at a loss where to look or where to fix it. So i am taking the official route and hope you can help this noob with this problem.

Your help is deeply appreciated.

Stefan

P.S.: Every other features works as intended - I can start the cleaning for the hole floor, stop, send home etc. Only Room selection is broken somehow.

What version of a card has described problem?

2.2.2

What was the last working version card?

2.2.0?

What vacuum model do you have problems with?

roborock.vacuum.m1s

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?

Firefox/Homassistant App

What version of Home Assistant do you use?

Home Assistant 2023.7.2 Frontend 20230705.1 - latest

What type of installation are you running?

Home Assistant Container

Card's configuration

- type: custom:xiaomi-vacuum-map-card
        map_source:
          camera: camera.xiaomi_cloud_map_extractor
        calibration_source:
          camera: true
        entity: vacuum.roborock_vacuum_m1s
        vacuum_platform: default
        tiles:
          - tile_id: status
            entity: vacuum.roborock_vacuum_m1s
            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_vacuum_m1s
            label: Battery
            attribute: battery_level
            icon: mdi:battery-charging-100
            unit: '%'
          - tile_id: fan_speed
            entity: vacuum.roborock_vacuum_m1s
            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_vacuum_m1s
            entity: sensor.roborock_vacuum_m1s_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_vacuum_m1s
            entity: sensor.roborock_vacuum_m1s_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_vacuum_m1s
            entity: sensor.roborock_vacuum_m1s_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_vacuum_m1s
            entity: sensor.roborock_vacuum_m1s_side_brush_left
            icon: mdi:brush
            precision: 0
            translations: {}
        icons:
          - icon: mdi:play
            conditions:
              - entity: vacuum.roborock_vacuum_m1s
                value_not: cleaning
              - entity: vacuum.roborock_vacuum_m1s
                value_not: error
              - entity: vacuum.roborock_vacuum_m1s
                value_not: returning
            tooltip: Start
            tap_action:
              action: call-service
              service: vacuum.start
              service_data:
                entity_id: vacuum.roborock_vacuum_m1s
          - icon: mdi:pause
            conditions:
              - entity: vacuum.roborock_vacuum_m1s
                value_not: docked
              - entity: vacuum.roborock_vacuum_m1s
                value_not: idle
              - entity: vacuum.roborock_vacuum_m1s
                value_not: error
              - entity: vacuum.roborock_vacuum_m1s
                value_not: paused
            tooltip: Pause
            tap_action:
              action: call-service
              service: vacuum.pause
              service_data:
                entity_id: vacuum.roborock_vacuum_m1s
          - icon: mdi:stop
            conditions:
              - entity: vacuum.roborock_vacuum_m1s
                value_not: docked
              - entity: vacuum.roborock_vacuum_m1s
                value_not: idle
              - entity: vacuum.roborock_vacuum_m1s
                value_not: error
              - entity: vacuum.roborock_vacuum_m1s
                value_not: paused
            tooltip: Stop
            tap_action:
              action: call-service
              service: vacuum.stop
              service_data:
                entity_id: vacuum.roborock_vacuum_m1s
          - icon: mdi:home-map-marker
            conditions:
              - entity: vacuum.roborock_vacuum_m1s
                value_not: docked
              - entity: vacuum.roborock_vacuum_m1s
                value_not: returning
            tooltip: Return to base
            tap_action:
              action: call-service
              service: vacuum.return_to_base
              service_data:
                entity_id: vacuum.roborock_vacuum_m1s
          - icon: mdi:target-variant
            conditions:
              - entity: vacuum.roborock_vacuum_m1s
                value_not: docked
              - entity: vacuum.roborock_vacuum_m1s
                value_not: error
              - entity: vacuum.roborock_vacuum_m1s
                value_not: cleaning
              - entity: vacuum.roborock_vacuum_m1s
                value_not: returning
            tooltip: Clean spot
            tap_action:
              action: call-service
              service: vacuum.clean_spot
              service_data:
                entity_id: vacuum.roborock_vacuum_m1s
          - icon: mdi:map-marker
            tooltip: Locate
            tap_action:
              action: call-service
              service: vacuum.locate
              service_data:
                entity_id: vacuum.roborock_vacuum_m1s
          - icon: mdi:fan-remove
            conditions:
              - entity: vacuum.roborock_vacuum_m1s
                attribute: fan_speed
                value: Silent
            tooltip: Change fan speed
            tap_action:
              action: call-service
              service: vacuum.set_fan_speed
              service_data:
                entity_id: vacuum.roborock_vacuum_m1s
                fan_speed: Standard
          - icon: mdi:fan-speed-1
            conditions:
              - entity: vacuum.roborock_vacuum_m1s
                attribute: fan_speed
                value: Standard
            tooltip: Change fan speed
            tap_action:
              action: call-service
              service: vacuum.set_fan_speed
              service_data:
                entity_id: vacuum.roborock_vacuum_m1s
                fan_speed: Medium
          - icon: mdi:fan-speed-2
            conditions:
              - entity: vacuum.roborock_vacuum_m1s
                attribute: fan_speed
                value: Medium
            tooltip: Change fan speed
            tap_action:
              action: call-service
              service: vacuum.set_fan_speed
              service_data:
                entity_id: vacuum.roborock_vacuum_m1s
                fan_speed: Turbo
          - icon: mdi:fan-speed-3
            conditions:
              - entity: vacuum.roborock_vacuum_m1s
                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_vacuum_m1s
                fan_speed: Gentle
          - icon: mdi:waves
            conditions:
              - entity: vacuum.roborock_vacuum_m1s
                attribute: fan_speed
                value: Gentle
            tooltip: Change fan speed
            tap_action:
              action: call-service
              service: vacuum.set_fan_speed
              service_data:
                entity_id: vacuum.roborock_vacuum_m1s
                fan_speed: Auto
          - icon: mdi:fan-auto
            conditions:
              - entity: vacuum.roborock_vacuum_m1s
                attribute: fan_speed
                value: Auto
            tooltip: Change fan speed
            tap_action:
              action: call-service
              service: vacuum.set_fan_speed
              service_data:
                entity_id: vacuum.roborock_vacuum_m1s
                fan_speed: Silent
          - icon: mdi:fan-alert
            conditions:
              - entity: vacuum.roborock_vacuum_m1s
                attribute: fan_speed
                value_not: Silent
              - entity: vacuum.roborock_vacuum_m1s
                attribute: fan_speed
                value_not: Standard
              - entity: vacuum.roborock_vacuum_m1s
                attribute: fan_speed
                value_not: Medium
              - entity: vacuum.roborock_vacuum_m1s
                attribute: fan_speed
                value_not: Turbo
              - entity: vacuum.roborock_vacuum_m1s
                attribute: fan_speed
                value_not: Gentle
              - entity: vacuum.roborock_vacuum_m1s
                attribute: fan_speed
                value_not: Auto
            tooltip: Change fan speed
            tap_action:
              action: call-service
              service: vacuum.set_fan_speed
              service_data:
                entity_id: vacuum.roborock_vacuum_m1s
                fan_speed: Silent
        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: {}
          - template: vacuum_clean_segment
            predefined_selections:
              - id: '16'
                icon:
                  name: mdi:broom
                  x: 21775
                  'y': 25375
                label:
                  text: Eingang
                  x: 21775
                  'y': 25375
                  offset_y: 35
                outline:
                  - - 21250
                    - 24900
                  - - 22300
                    - 24900
                  - - 22300
                    - 25850
                  - - 21250
                    - 25850
              - id: '17'
                icon:
                  name: mdi:broom
                  x: 22000
                  'y': 19250
                label:
                  text: Kueche
                  x: 22000
                  'y': 19250
                  offset_y: 35
                outline:
                  - - 20850
                    - 18500
                  - - 23150
                    - 18500
                  - - 23150
                    - 20000
                  - - 20850
                    - 20000
              - id: '18'
                icon:
                  name: mdi:broom
                  x: 21700
                  'y': 22850
                label:
                  text: Flur
                  x: 21700
                  'y': 22850
                  offset_y: 35
                outline:
                  - - 20250
                    - 20800
                  - - 23150
                    - 20800
                  - - 23150
                    - 24900
                  - - 20250
                    - 24900
              - id: '19'
                icon:
                  name: mdi:broom
                  x: 24650
                  'y': 24025
                label:
                  text: Wohnzimmer
                  x: 24650
                  'y': 24025
                  offset_y: 35
                outline:
                  - - 22400
                    - 22100
                  - - 26900
                    - 22100
                  - - 26900
                    - 25950
                  - - 22400
                    - 25950
              - id: '20'
                icon:
                  name: mdi:broom
                  x: 28650
                  'y': 22550
                label:
                  text: Wintergarten
                  x: 28650
                  'y': 22550
                  offset_y: 35
                outline:
                  - - 26900
                    - 20500
                  - - 30400
                    - 20500
                  - - 30400
                    - 24600
                  - - 26900
                    - 24600
              - id: '21'
                icon:
                  name: mdi:broom
                  x: 24975
                  'y': 20075
                label:
                  text: Esszimmer
                  x: 24975
                  'y': 20075
                  offset_y: 35
                outline:
                  - - 23150
                    - 18050
                  - - 26800
                    - 18050
                  - - 26800
                    - 22100
                  - - 23150
                    - 22100
              - id: '23'
                icon:
                  name: mdi:broom
                  x: 26000
                  'y': 25350
                label:
                  text: Kamin
                  x: 26000
                  'y': 25350
                  offset_y: 35
                outline:
                  - - 25300
                    - 24700
                  - - 26700
                    - 24700
                  - - 26700
                    - 26000
                  - - 25300
                    - 26000
        map_locked: false
        two_finger_pan: false

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

No response

Additional information

No response

PiotrMachowski commented 1 year ago

Can you try to replace room IDs the following way: '16' -> 16

linuxstony commented 1 year ago

Thanks @PiotrMachowski for the swift response. I amended all IDs and removed the " ' " in the yaml-editor for the card configuration.

When I press "Go" the green status Popup with "Success!" appears but the error remains the same in the logs and the robot does not move.

PiotrMachowski commented 1 year ago

Can you try this config?

      - type: custom:xiaomi-vacuum-map-card
        map_source:
          camera: camera.xiaomi_cloud_map_extractor
        calibration_source:
          camera: true
        entity: vacuum.roborock_vacuum_m1s
        vacuum_platform: default
        map_modes:
          - template: vacuum_clean_zone
          - template: vacuum_goto
          - template: vacuum_clean_segment          
            service_call_schema:
              service: xiaomi_miio.vacuum_clean_segment
              service_data:
                segments: '[[selection]]'
                entity_id: '[[entity_id]]'
            predefined_selections:
              - id: 16
                icon:
                  name: mdi:broom
                  x: 21775
                  'y': 25375
                label:
                  text: Eingang
                  x: 21775
                  'y': 25375
                  offset_y: 35
                outline:
                  - - 21250
                    - 24900
                  - - 22300
                    - 24900
                  - - 22300
                    - 25850
                  - - 21250
                    - 25850
              - id: 17
                icon:
                  name: mdi:broom
                  x: 22000
                  'y': 19250
                label:
                  text: Kueche
                  x: 22000
                  'y': 19250
                  offset_y: 35
                outline:
                  - - 20850
                    - 18500
                  - - 23150
                    - 18500
                  - - 23150
                    - 20000
                  - - 20850
                    - 20000
              - id: 18
                icon:
                  name: mdi:broom
                  x: 21700
                  'y': 22850
                label:
                  text: Flur
                  x: 21700
                  'y': 22850
                  offset_y: 35
                outline:
                  - - 20250
                    - 20800
                  - - 23150
                    - 20800
                  - - 23150
                    - 24900
                  - - 20250
                    - 24900
              - id: 19
                icon:
                  name: mdi:broom
                  x: 24650
                  'y': 24025
                label:
                  text: Wohnzimmer
                  x: 24650
                  'y': 24025
                  offset_y: 35
                outline:
                  - - 22400
                    - 22100
                  - - 26900
                    - 22100
                  - - 26900
                    - 25950
                  - - 22400
                    - 25950
              - id: 20
                icon:
                  name: mdi:broom
                  x: 28650
                  'y': 22550
                label:
                  text: Wintergarten
                  x: 28650
                  'y': 22550
                  offset_y: 35
                outline:
                  - - 26900
                    - 20500
                  - - 30400
                    - 20500
                  - - 30400
                    - 24600
                  - - 26900
                    - 24600
              - id: 21
                icon:
                  name: mdi:broom
                  x: 24975
                  'y': 20075
                label:
                  text: Esszimmer
                  x: 24975
                  'y': 20075
                  offset_y: 35
                outline:
                  - - 23150
                    - 18050
                  - - 26800
                    - 18050
                  - - 26800
                    - 22100
                  - - 23150
                    - 22100
              - id: 23
                icon:
                  name: mdi:broom
                  x: 26000
                  'y': 25350
                label:
                  text: Kamin
                  x: 26000
                  'y': 25350
                  offset_y: 35
                outline:
                  - - 25300
                    - 24700
                  - - 26700
                    - 24700
                  - - 26700
                    - 26000
                  - - 25300
                    - 26000
        map_locked: false
        two_finger_pan: false
linuxstony commented 1 year ago

That config works !! I am on my way to bed so I cant tell you in all detail how thankful I am - so - THANKS !!! I don't know what you did (no time to compare) but it works like charm with a first test. <3

PiotrMachowski commented 1 year ago

Great! So this was a problem with a workaround that I have added to fix a bug within HA itself - it seems that it doesn't work for all vacuums. It should be fixed in next HA release