Home-Assistant implementation for the Xiaomi (Aqara) gateway Supported sensors:
- Temperature / Humidity
- Door / Window
- Motion
- Install Home-Assistant,
- Enable the developer mode of the gateway.
- Please follow the steps in this thread: http://bbs.xiaomi.cn/t-13198850 (translated version: https://goo.gl/gEVIrn).
-
Download and place the Aqara.py file in the home-assistant folder like this:
.homeassistant/custom_components/sensor/Aqara.py -
Add the new component in the configuration.yaml:
sensor : platform: Aqara scan_interval: 1
Since until now there is no way to retrieve the configured names from the gateway, Home-Assistant will display each sensor like that:
- sensor.temperature_SENSORID
- sensor.humidity_SENSORID
- sensor.magnet_SENSORID
- sensor.motion_SENSORID
- etc.
To make it readable again, create a customize.yaml file in the home-assistant folder. You can use step 7 https://goo.gl/gEVIrn to identify the sensors.
-
Example
sensor.temperature_158d0000fa3793: friendly_name: Living-Room T sensor.humidity_158d0000fa3793: friendly_name: Living-Room H icon: mdi:water-percent sensor.temperature_158d000108164f: friendly_name: Bedroom 1 T sensor.humidity_158d000108164f: friendly_name: Bedroom 1 H icon: mdi:water-percent ... etc.
-
Add a line in the configuration.yaml:
homeassistant:
name: Home ... time_zone: Europe/Paris customize: !include customize.yaml ```
- Example configuration.yaml
binary_sensor:
- platform: template
sensors:
door:
friendly_name: Frontdoor
value_template: "{{ states.sensor.magnet_158d0001179ae9.state == 'open' }}"
sensor_class: opening
entity_id:
- sensor.magnet_158d0001179ae9
automation:
- alias: FrontDoorClosed
trigger:
platform: state
entity_id: binary_sensor.door
to: 'off'
action:
service: notify.TelegramNotifier
data:
message: Door closed
- alias: FrontDoorOpened
trigger:
platform: state
entity_id: binary_sensor.door
to: 'on'
action:
service: notify.TelegramNotifier
data:
message: Door opened- create a custom component as Hub to manage gateway devices.
- include some options in the configuration file : IP, refresh frequency, etc.
- generate a yaml file with discovered devices
- integrate wireless switch, light switches, cube, plug, gateway itself (turn on light / radio / etc.)