Up Your Smart-Home Game, on the cheap, with the Xiaomi Aqara Gateway & Home Assistant

In my search to add sensors to my budget Smart-Home set up, I wanted to find something that was affordable, easy to use, and had a good build quality. I thought about Z-Wave but the start up cost was off-putting. A Z-Wave stick and a couple of sensors would easily set me back $100. Plus, dropping $30-60 dollars for each additional sensor just can’t happen on my budget. There had to be a cheaper way. Then I stumbled on the Xiaomi Aqara Gateway. Xiaomi makes some great quality, affordable Smart-Home devices and their Gateway is the perfect place to start. This post will:

  • Introduce you to Xiaomi, the Xiaomi Aqara Gateway, and compatible sensors.
  • Show you how to set up your gateway.
  • Show you how to connect and control your Gateway with Home Assistant (Hass.io).
  • Show you the different Gateway kits available.

Notice:

This post has been marked as a legacy post and has been flagged to be updated.

If you would like to receive updates from Smart Home Hobby, please subscribe below.


Xiaomi

Pronounced “sh-ow-me” (Think of ‘show me’, and then pronounce the first word as if it was ‘shower.’), Xiaomi is a fast growing tech company in China and the 5th largest smartphone maker in the world. Xiaomi has been called the Chinese Apple and currently makes smartphones, computers, smart TVs, entertainment boxes, and most importantly for this post, affordable Smart-Home devices.

IMG_20171018_190754

The Xiaomi Gateway has a speaker that can replay ringtones (can be useful as a doorbell or alarm), a light that can be adjusted between 16 million different colors, and most importantly it works as a Zigbee hub to connect to other Xiaomi sensors. Be aware that currently the Zigbee communication protocol is all over the place and can vary from manufacturer to manufacturer. This means that many Zigbee devices can only connect to their own supported hub. So, while the Xiaomi Gateway uses Zigbee signals, it will not be compatible with non-Xiaomi Zigbee devices.  According to their documentation, Home Assistant currently supports these Xiaomi Gateway compatible devices and they’re all crazy affordable:

  1. Xiaomi Aqara Gateway.
  2. Temperature and Humidity Sensor (1st and 2nd generation)
  3. Motion Sensor (1st and 2nd generation)
  4. Door and Window Sensor (1st and 2nd generation)
  5. Button (1st and 2nd generation)
  6. Aqara Wireless Switch (Single)
  7. Aqara Wireless Switch (Double)
  8. Cube – Magic Controller
  9. Smoke Detector (reports alarm and density)
  10. Gateway (Light, Illumination Sensor, Ringtone play)
  11. Water Leak Sensor

So far, I am very impressed with the Xiaomi devices I have. I purchased the Gateway along with a Button and 2 Door/Window Sensors. The pieces feel well made and are very responsive. The app isn’t great, mostly due to the language barrier, but when using Home Assistant you will only need to use the app to set the Gateway up.

Set up the Gateway

  • First, you will need to download the MiHome App from the Play Store.

NOTES:

  1. You may have reoccurring notifications asking you to switch to the Singapore servers. Ignore these.
  2. After getting the gateway’s IP address, you should give it a static IP address on your router.

Connect & Control the Gateway with Home Assistant

Connect the Gateway

  • Open up your configuration.yaml file.

Screen Shot 2017-10-12 at 9.15.57 AM

  • Add the xiaomi_aqara component to your configuration.

https://gist.github.com/smarthomehobby/7019359bc678ba93fcacabe4f166be95

  • Only the mac and key are required, but adding the host will make Home Assistant find the Gateway at that location instead of trying to discover it on its own.
  • After adding the component be sure to save, check your configuration, and restart Home Assistant.
  • After Home Assistant restarts, you will find 2 new devices. The gateway light and the gateway light sensor.

Screen Shot 2017-10-12 at 9.19.50 AM

Screen Shot 2017-10-12 at 9.30.15 AM

  • Currently, the light sensor is not very quick to update. It seems to only update when the Gateway light is turned on or off and occasionally in between.
  • Now that the Gateway is connected, you can give it a friendly name in your customize.yaml file and add it to a group.

Screen Shot 2017-10-12 at 10.03.28 AM

https://gist.github.com/smarthomehobby/ca14923e56ba4582528ea812dc220a5e

Screen Shot 2017-10-12 at 10.03.15 AM

  • Remember to check your configuration before restarting Home Assistant.

Controlling the Gateway Light

Screen Shot 2017-10-12 at 10.00.20 AM

  • Now you should see the Gateway Light in your front end.
  • You can turn the Gateway light on and off by using the switch, or you can click on the bulb icon to change the brightness or color of the light.

Screen Shot 2017-10-12 at 10.00.27 AM

  • At this point, you can tell Alexa to discover devices.
  • Alexa can turn the Gateway light on and off, on command. You will need to change the color manually.

Different Gateway Kits Available

IMG_20171018_190537

  • I purchased my Gateway with the Smart Home Aqara Security Kit. This came with the Gateway, a Button, and 2 Door/Window Sensors (as pictured above), but there are other kits available.
    Gearbest 5 in 1 Xiaomi
  • The Xiaomi 5 in 1 Smart Home Security Kit includes the Gateway, a Button, a Door/Window Sensor, a Motion Sensor, and the Outlet (Zigbee Version).Gearbest 6 in 1 Xiaomi
  • Lastly, there’s the Xiaomi mijia 6 in 1 Smart Home Security Kit, which includes The Gateway, a Button, a Door/Window Sensor, a Motion Sensor, an Outlet (Zigbee Version), and a Temperature Humidity Sensor.

All of the parts can also be purchased individually. I recommend starting with a kit. It was very satisfying to receive all of my devices at once since the shipping from China took a couple of weeks to arrive.

IMG_20171021_103418

I made the mistake of adding an adapter (on the left) to my order from GearBest. It was shipped separately and took an extra week to arrive. It also broke as soon as I tried to use it. The insides bent and I wasn’t even able to plug the Gateway all the way into it. I couldn’t find any adapters near me besides the $14 full fledged worldwide adapters, so if you’re going to need a US adapter and have Amazon Prime, I recommend grabbing the one on the right (be sure to pick up 2 if you’re getting a kit with a Zigbee outlet).

14 thoughts on “Up Your Smart-Home Game, on the cheap, with the Xiaomi Aqara Gateway & Home Assistant

  • October 24, 2017 at 12:45 pm
    Permalink

    Hi Alex,

    Thanks for the great post and step-by-step guidance. You mention the outlet adapters for the US. Have you seen any Xiaomi products with (grounded) US plug patterns? I’d like some smart outlets but I would prefer not to have large adapters sticking out of the wall.

    Reply
  • October 24, 2017 at 12:45 pm
    Permalink

    Hi Alex,

    Thanks for the great post and step-by-step guidance. You mention the outlet adapters for the US. Have you seen any Xiaomi products with (grounded) US plug patterns? I’d like some smart outlets but I would prefer not to have large adapters sticking out of the wall.

    Reply
  • October 24, 2017 at 2:54 pm
    Permalink

    I peeked on Taobao and Xiaomi’s US site but didn’t see US versions. The prices look great, but I worry some of them (e.g., switches) won’t work with US voltage.

    Other than Xiaomi, have you tried any other brands in your set up? I only have two Wemo outlets but I’m looking to build out a system this year and trying to decide what standard to use.

    Reply
    • October 24, 2017 at 4:49 pm
      Permalink

      This site shows my whole setup right now. I use the Broadlink RM Pro to control RF outlets. I don’t feel strongly about picking one standard to use because Home Assistant can stitch them all together. There are some places I’d like a Z-Wave switch, like my kitchen’s florescent light. I’m also considering using some of the Wireless Xiaomi Switches and some Ikea Trafdri bulbs would work well, but even then I will still use the RF outlets for most devices.

      Reply
  • November 30, 2017 at 8:31 am
    Permalink

    Hey, do you know how to fix this error: ERROR (Thread-3) [PyXiaomiGateway] Unknown gateway ip 192.168.XX.XXX
    this happens to once per day even after i changed the ip adress and tried to give it a stack adress

    Reply
  • November 30, 2017 at 11:46 pm
    Permalink

    yes it stops working till i change the ip adress

    Reply
  • December 7, 2017 at 6:06 pm
    Permalink

    Are you using the temperature/humidity sensors much? do they seem to integrate into home assistant well? The sensors are less than $10 a piece (and I want to put one in each room) and is the only reason I am even considering buying the hub.

    Reply
    • December 7, 2017 at 7:26 pm
      Permalink

      I don’t have any yet. I’m planning to order a bunch of the sensors very soon. When I do, I’ll post about my experiences with them all.

      Reply
  • February 7, 2018 at 10:08 am
    Permalink

    can this work with google assistant just as it works with alexa??

    Reply
  • June 21, 2018 at 12:15 pm
    Permalink

    Hi,
    My Xiaomi Gateway just arrived today. I haven’t played around with it yet and I haven’t used Home Assistant before. Was intending upon getting a Raspberry Pi next week and see what I can do… What I can’t work out is whether, if I install Xiaomi Gateway to work with Home Assistant, can I then get it to work with other connected devices (such as SmartThings for example)?

    Reply

Leave a Reply to Francis OpokuCancel reply