-
-
Save ophilips/116a2cda6d4e10825826af9640a92199 to your computer and use it in GitHub Desktop.
| # 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 | |
| entity_id: vacuum.xiaomi_vacuum_cleaner | |
| # turn_on: | |
| # service: xiaomi_miio.vacuum_clean_zone | |
| # data_template: | |
| # entity_id: vacuum.xiaomi_vacuum_cleaner | |
| # repeats: 1 | |
| # zone: [[18724,22506,25440,24620],[23758,20813,24906,22506]] | |
| turn_off: | |
| service: vacuum.return_to_base | |
| entity_id: vacuum.xiaomi_vacuum_cleaner | |
| set_speed: | |
| service: vacuum.set_fan_speed | |
| data_template: | |
| fan_speed: "{{ speed }}" | |
| entity_id: vacuum.xiaomi_vacuum_cleaner | |
| speeds: | |
| - 'off' | |
| - 'Silent' | |
| - 'Standard' | |
| - 'Medium' | |
| - 'Turbo' | |
| # - 'Gentle' | |
| sensor: | |
| - platform: template | |
| sensors: | |
| xiaomi_fan: | |
| unit_of_measurement: '%' | |
| value_template: "{{ state_attr('vacuum.xiaomi_vacuum_cleaner', 'battery_level') }}" | |
| homekit: | |
| entity_config: | |
| fan.xiaomi_fan: | |
| linked_battery_sensor: sensor.xiaomi_fan |
Ok, thanks and keep in touch!
Hi again,
the followings speed settings are not working for me. I only manage to make the vacuum use Gentle or standard mode with these settings. Did anybody managed?
speeds:
- 'off'
- 'Silent'
- 'Standard'
- 'Medium'
- 'Turbo'
- 'Gentle'
speeds:
- 'off'
- 'Silent'
- 'Standard'
- 'Medium'
- 'Turbo'
- 'Gentle'
Hello ophilips
my code is pretty basic but does the trick of showing the vacuum in the Homekit and having the on/off button:
#Xiaomi Mi Robot Vacuum
vacuum:
Hey @WLines84, by using your code (which is just the home assistant standard config) you only have access to the on/off switch in Apple Home. It is a new feature since version 0.110 https://www.home-assistant.io/blog/2020/05/20/release-110/#homekit
If you want to have more features like vacuum speed, zones etc. it is still necessary to add some more code to your config.
Hi @ophilips
Long time ago (-:
I wonder if you have updated the code since the fan.speed service seems not to be working anymore. It would be nice to share a new code if you can.
Thanks
Doesnt work anymore.
Deprecated services: fan.set_speed
source: https://www.home-assistant.io/integrations/fan/
Does anyone have a working config for Homekit with latest HA versions?

The charging status is not supported at the moment in home assistant. It just gets added when a battery value is linked to your device. So i couldn‘t use that feature.
I will check the pause function again because there were so many changes in the xiaomi integration like the speed settings.