Skip to content

Instantly share code, notes, and snippets.

@ophilips
ophilips / xiaomi_fan_configuration.yaml
Last active June 1, 2023 21:34
Xiaomi Vacuum as "template fan" for Home Assistant/HomeKit. The fan slider (0-100) in HomeKit will be translated to the the corresponding vacuum presets or speeds (off, Silent, Standard, Medium, Turbo).
# Xiaomi HomeKit
fan:
- platform: template
fans:
xiaomi_fan:
friendly_name: "Xiaomi Vacuum"
value_template: "{%if states('vacuum.xiaomi_vacuum_cleaner') == 'cleaning' %}on{%elif states('vacuum.xiaomi_vacuum_cleaner') == 'paused' %}on{%else %}off{% endif %}"
speed_template: "{{ state_attr('vacuum.xiaomi_vacuum_cleaner', 'fan_speed') }}"
turn_on:
service: vacuum.start