Xiaomi Gateway

Xiaomi Gateway

You can find the package in several versions. In my installation I have used the gateway (aqara), temperature sensors, motion detectors, window sensors and the multi-purpose button.

The gateway plugs into the classic power socket and connects to the router via wifi. All the sensors connect to the gateway via zigbee. The sensors run on batteries, which have a lot of autonomy. For example the temperature sensor in my room, with 2032 battery is after 16 months at 20% (battery level).

In my opinion it is one of the most beautiful devices I use in the automation of my house. I use temperature sensors to measure temperature and humidity from each room, living room and kitchen. I use door / window sensors to detect the operation of the air conditioner when it does not have wifi, placing them on the blinds of the air conditioner. I use motion sensor in the WC to turn on the light automatically. Finally the multi-function switch to turn on and off important lights used on a daily basis several times.

The installation and connection to the home assistant is easy. For start, connect it to the wifi network with the help of your mobile application, Xiaomi home.

Mi Control Hub
mi button

Next add the following code to configuration.yaml

xiaomi_aqara:
  discovery_retry: 10
  gateways:
    - mac: xx:xx:xx:xx:xx:xx #<-- replace mac address
      key: BE1E75EF4F6D45A5 #<-- replace key

You can find the key from the xiaomi home app on your mobile. Detailed instructions can be found here.

Save and restart Home Assistant. All connected sensors in the gateaway will appear automatically. Υou will find the sensors in the following format:

  • Door/window sensors
    binary_sensor.door_window_sensor_xxxxxxxxxxxxx
  • Temperature/Humidity sensors
    sensor.temperature_xxxxxxxxxxxxx
    sensor.humidity_xxxxxxxxxxx
  • Motion sensors
    binary_sensor.motion_sensor_xxxxxxxxxxxx
  • Switch
    binary_sensor.switch_xxxxxxxxxxxx
  • Light at the gateaway
    light.gateway_light_xxxxxxxxxxx
  • Illumination sensor at the gateaway
    sensor.illumination_xxxxxxxxxx

You can create an extra sensor for each device to monitor its battery. Add to sensor.yaml

  - platform: template
    sensors:
      battery_level_motion_sensor:
        friendly_name: Battery Motion Sensor
        value_template: "{{ states.binary_sensor.motion_sensor_xxxxxxxxxxxxxx.attributes.battery_level|default(-1)|int if states.binary_sensor.motion_sensor_xxxxxxxxxxxxxx is not none }}"
        unit_of_measurement: '%'

Leave a Reply

Your email address will not be published.