Xiaomi vacuum details as separate sensors

Hi

I am trying to add information about Xiaomi Vacuum battery percentage, current status and fan speed as a separate sensors.

I tried using templated_sensors, but I cannot get it working correctly. In developer tab I can see entity vacuum.xiaomi_vacuum_cleaner with attribues:

supported_features: 2047
icon: mdi:google-circles-group
cleaned_area: 37.13
fan_speed: Max
fan_speed_list: Quiet,Balanced,Turbo,Max
do_not_disturb: off
cleaning_time: 0:56:17
battery_level: 100
friendly_name: Xiaomi Vacuum cleaner
battery_icon: mdi:battery-charging-100
status: Chargin
  - platform: template
    sensors:
      vacuumbattery:
        value_tempate: '{{ vacuum.xiaomi_vacuum_cleaner.off.attributes.battery_level }}'

Anyone managed to configure it properly?

1 Like

Try:

{{ states.vacuum.xiaomi_vacuum_cleaner.attributes.battery_level }}

1 Like

Worked. Thank you.

Hey, I’m also trying to get this to work. Bram’s solution worked for me but I can’t figure out where to put that.

That depends on what you want to do with the data. Display on Lovelace? use in an automation? For the latter, that method is no longer required as you can create automations using the attribute data directly, not needing a template sensor

Display on Lovelace. I’d like to show a history graph for the robot battery.
This is what I did but it doesn’t work:

 #roborock battery level
sensor:
   - platform: template
     sensors:
       vacuumbattery:
         value_tempate: "{{ states.vacuum.xiaomi_vacuum_cleaner.attributes.battery_level }}"

Getting:
Invalid config for [sensor.template]: [value_tempate] is an invalid option for [sensor.template]. Check: sensor.template->sensors->vacuumbattery->value_tempate. (See ?, line ?).

You have a typo in the spelling of value_template (missing ‘l’).

Just in case you don’t know of this too:

image

Lovelace custom card

entity: vacuum.george
image: /local/images/vacuum.png
type: 'custom:xiaomi-vacuum-card'
1 Like

Damn it that did it.
Thanks @sparkydave