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

`attribute` not working correctly #751

Closed veniplex closed 4 months ago

veniplex commented 4 months ago

Checklist

The problem

The attribute option in the config is not functioning.

For example, this config:

...
tiles:
  - label: Main Brush
    icon: mdi:brush-variant
    attribute: props.main_brush_work_time # This is not working
...

results in: image

What version of a card has described problem?

v2.2.4

What was the last working version card?

No response

What vacuum model do you have problems with?

roborock.vacuum.s5

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

What version of Home Assistant do you use?

core-2024.7.3

What type of installation are you running?

Home Assistant OS

Card's configuration

type: custom:xiaomi-vacuum-map-card
map_source:
  camera: camera.roborock_kamera
calibration_source:
  camera: true
entity: vacuum.roborock_s5
vacuum_platform: default
title: ''
two_finger_pan: true
map_locked: false
tiles:
  - label: Main Brush
    icon: mdi:brush-variant
    entity: vacuum.roborock_s5
    attribute: props.main_brush_work_time
    tooltip: Runned time
    unit: seconds
    multiplier: 1
    precision: 1
    order: 1

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

No response

Additional information

No response

PiotrMachowski commented 4 months ago

Does it work when you provide entity id?

...
tiles:
  - label: Main Brush
    icon: mdi:brush-variant
    entity: vacuum.roborock_s5
    attribute: props.main_brush_work_time
...
veniplex commented 4 months ago

Does it work when you provide entity id?

...
tiles:
  - label: Main Brush
    icon: mdi:brush-variant
    entity: vacuum.roborock_s5
    attribute: props.main_brush_work_time
...

No, then the status is just "unknown" 😞. image

PiotrMachowski commented 4 months ago

The tile appears, so it definitely works better.

What are attributes of vacuum.roborock_s5 entity? You can check them here: Open your Home Assistant instance and show your state developer tools.

veniplex commented 4 months ago

@PiotrMachowski here is the full list of attributes for vacuum.roborock_s5:

fan_speed_list:
  - Silent
  - Basic
  - Strong
  - Full Speed
battery_level: 100
battery_icon: mdi:battery-charging-100
fan_speed: Full Speed
model: roborock.vacuum.s5
lan_ip: [IP Address]
mac_address: [MAC Address]
entity_class: MiotRoborockVacuumEntity
home_room: Home Wohnzimmer
miot_type: urn:miot-spec-v2:device:vacuum:0000A006:roborock-s5:1
vacuum.status: 3
vacuum.mode: 104
battery.charging_state: 1
state_updater: lan
vacuum.status_desc: Charging
props:
  msg_ver: 3
  msg_seq: 851
  state: 8
  battery: 100
  clean_time: 0
  clean_area: 0
  error_code: 0
  map_present: 1
  in_cleaning: 0
  in_returning: 0
  in_fresh_state: 1
  lab_status: 1
  water_box_status: 0
  fan_power: 104
  dnd_enabled: 0
  map_status: 3
  lock_status: 0
  main_brush_work_time: 68769
  side_brush_work_time: 68769
  filter_work_time: 68769
  filter_element_work_time: 0
  sensor_dirty_time: 68765
  fan_mode: 104
clean_area: 0
clean_time: 0
sub_entities:
  - props:clean_area
  - props:clean_time
  - vacuum-2.status-1
  - battery-3.battery_level-1
  - battery-3.charging_state-2
friendly_name: Roborock
supported_features: 13308
PiotrMachowski commented 4 months ago

Ok, so it is a nested attribute. Map card do not support them at this moment.

By the way, why do you use custom Miot integration instead of built-in one? https://www.home-assistant.io/integrations/xiaomi_miio/

veniplex commented 4 months ago

That is indeed a good question. I just switched over to the built-in integration and I can now see all the needed attributes without manual configuration. I guess I no longer need the attribute option.

Initially I thought props.main_brush_work_time etc. would be supported like in https://github.com/denysdovhan/vacuum-card.

Thanks.