Primeiro que tudo há que extrair o TOKEN
Para extrair o token, basta seguir estas instruções (WIndows).
- Configure o aspirador com a APP Mi-Home.
- Fazer o download e extraia o MiToolKit.zip.
- Ativar o modo de desenvolvedor e depuração USB no telefone Android e conecte-o ao computador.
- Alterar o idioma do MiToolKit para inglês, se precisar.
- Clique em “Extrair token”
- No telefone, você deve confirmar o backup. NÃO insira nenhuma senha e pressione o botão para fazer o backup.
- Depois de confirmar o backup, a extração do token começará, ele deverá aparecer no MiToolKit.
Após isto, criei um xiaomi_vacuum.yaml dentro da pasta packages e inseri o seguinte codigo:
homeassistant:
vacuum:
- platform: xiaomi_miio
host: 192.168.1.73
token: 4ffeerer632rterergr4534jhhb34hvjtg3v4v
################################################
# SENSORES ASPIRADOR #
################################################
sensor:
- platform: template
sensors:
xiaomi_status:
value_template: >
{%- if states.vacuum.xiaomi_vacuum_cleaner.attributes.status == "Charging" %}
A carregar
{% elif states.vacuum.xiaomi_vacuum_cleaner.attributes.status == "Cleaning" %}
A limpar
{% elif states.vacuum.xiaomi_vacuum_cleaner.attributes.status == "Returning home" %}
A voltar à base
{% elif states.vacuum.xiaomi_vacuum_cleaner.attributes.status == "Idle" %}
Parado
{% else %}
{{ states.vacuum.xiaomi_vacuum_cleaner.attributes.status }}
{%- endif %}
friendly_name: Estado
xiaomi_battery_level:
value_template: >
{{ states.vacuum.xiaomi_vacuum_cleaner.attributes.battery_level }}
friendly_name: Bateria
unit_of_measurement: '%'
xiaomi_main_brush_left:
value_template: >
{{ states.vacuum.xiaomi_vacuum_cleaner.attributes.main_brush_left }}
friendly_name: Escova principal
unit_of_measurement: 'horas'
xiaomi_side_brush_left:
value_template: >
{{ states.vacuum.xiaomi_vacuum_cleaner.attributes.side_brush_left }}
friendly_name: Escova lateral
unit_of_measurement: 'horas'
xiaomi_filter_left:
value_template: >
{{ states.vacuum.xiaomi_vacuum_cleaner.attributes.filter_left }}
friendly_name: Filtro
unit_of_measurement: 'horas'
Façam reboot e já vão ter as entidades no menu “estados”… a ser assim é so adicionarem / organizarem o vosso groups.yaml
NOTA: o meu configuration.yaml está da seguinte forma:
homeassistant:
# Name of the location where Home Assistant is running
name: Home Assistant
# Location required to calculate the time the sun rises and sets
latitude: !secret key_lat
longitude: !secret key_lon
# Impacts weather/sunrise data (altitude above sea level in meters)
elevation: !secret key_ele
# metric for Metric, imperial for Imperial
unit_system: metric
# Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
time_zone: Europe/Lisbon
# Customization file
customize: !include customize.yaml
packages: !include_dir_named packages
Espero ter ajudado.