Skip to content

AlexKholodkov/homeassistant-aqara

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 

Repository files navigation

homeassistant-aqara

Home-Assistant implementation for the Xiaomi (Aqara) gateway Supported sensors:

  • Temperature / Humidity
  • Door / Window
  • Motion

INSTALLATION

  1. Install Home-Assistant,
  2. Enable the developer mode of the gateway.
  1. Download and place the Aqara.py file in the home-assistant folder like this:

    .homeassistant/custom_components/sensor/Aqara.py

  2. Add the new component in the configuration.yaml:

    sensor :
      platform: Aqara
      scan_interval: 1

CUSTOMIZATION

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.
  1. Add a line in the configuration.yaml:

homeassistant:

Name of the location where Home Assistant is running

name: Home ... time_zone: Europe/Paris customize: !include customize.yaml ```

Magnet Automation example

  • 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

TODO

  • 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.)

About

Home-Assistant custom component

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%