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.

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)
    1. The 1st generation Motion Sensor is available with this Gateway kit
  4. Door and Window Sensor (1st and 2nd generation)
  5. Button (1st and 2nd generation)
  6. Plug aka Socket (Zigbee version only, reports power consumed, power load, state and if device in use)
  7. Wall Plug (reports power consumed, power load and state)
  8. Aqara Wall Switch (Single)
  9. Aqara Wall Switch (Double)
  10. Aqara Wireless Switch (Single)
  11. Aqara Wireless Switch (Double)
  12. Cube – Magic Controller
  13. Smoke Detector (reports alarm and density)
  14. Gateway (Light, Illumination Sensor, Ringtone play)
  15. Intelligent Curtain
  16. 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

Screen Shot 2017-10-12 at 9.15.57 AM

  • Add the xiaomi_aqara component to your configuration.

 

 

  • 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

 

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

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

I’ll be putting out more information on the Gateway and some of the different sensors as I spend more time with them and learn what they’re capable of. Be sure to come back and check those out. I will also be giving away a Xiaomi Smart-Home kit! If these guides have been helpful to you, please share them! If you have any questions, please reach out to me in the comments. Thanks for visiting!

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

  1. 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.

    Like

  2. 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.

    Like

  3. 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.

    Like

    1. 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.

      Like

  4. 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

    Like

  5. 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.

    Like

  6. 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)?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s