I’ve fallen in love with my Xiaomi Smart Home kit. It really is an affordable, quality product. After connecting the Xiaomi Gateway to Home Assistant and the rest of my Smart-Home set up, I spent some time thinking about how I wanted to use it with the different sensors. I started with the Button. The lamps in my living room do not have light switches, so using the Button as a light switch was a pretty obvious choice. The Gateway also has a couple more trick up its sleeve, that I’ll show you here.
This guide will teach you:
- How to control the Gateway’s light with Home Assistant.
- How to use the Gateway’s sound effects.
- How to set up and use the (1st Gen) Xiaomi Button.
The Xiaomi Gateway
By the end of the Xiaomi Gateway post, you should have been able to turn on and off the Gateway with the Home Assistant front end, as well as Alexa using your Echo device. The light can also be controlled using scripts.
- When utilizing a script, you can set the RGB Color, and the Brightness (0-255).
- I recommend finding a color you like, by using the Home Assistant front end, then checking the light’s state in the Developer’s Tools section of the menu.
- Note the min_mireds and max_mireds parameters. These appear to be related to color temperature. I have not learned, yet, how or if these can be utilized.
- I’ve found [255,103,23] to be a pretty good “Warm White” color.
- This site has some helpful RGB codes for different types of lighting.
- The Gateway also has built in sound effects that can help the Gateway be used as a security alarm, an alarm clock, or a doorbell.
- You can test/hear the different sounds within the MiHome App.
- From the Gateway page, choose Devices
- Choose the Gateway
- Here are some more of the Gateway’s settings
- I recommend changing the volume settings before testing the sound effects, it can be pretty loud.
- I turn off the Radio and Notification volumes. The Radio stations are all in Chinese, and the Notification volume refers to the Chinese voice prompts.
- Now, you can go the Ringtone settings
- Go ahead and give them a go!
- To reference these sounds in Home Assistant, you’ll need to use a ringtone_id. Home Assistant’s docs has them ID’d like this:
- 0 – Police car 1
- 1 – Police car 2
- 2 – Accident
- 3 – Countdown
- 4 – Ghost
- 5 – Sniper rifle
- 6 – Battle
- 7 – Air raid
- 8 – Bark
- 10 – Doorbell
- 11 – Knock at a door
- 12 – Amuse
- 13 – Alarm clock
- Alarm clock
- 20 – MiMix
- 21 – Enthusiastic
- 22 – GuitarClassic
- 23 – IceWorldPiano
- 24 – LeisureTime
- 25 – ChildHood
- 26 – MorningStreamLiet
- 27 – MusicBox
- 28 – Orange
- 29 – Thinker
- The services you can use are xiaomi_aqara.play_ringtone and xiaomi_aqara.stop_ringtone.
- Note that the sound effects will stop playing once it has ended, the stop ringtone service will just stop the sound effect earlier.
- Pushing the button on the Gateway will also stop the sound. This would work really well for an alarm clock.
- This configuration can be added to a trigger for an automation.
- This can alse be configured as a script.
- Remember to add the script to a group so you can access it.
- gw_mac is the Gateway’s mac address and is required along with the ringtone_id.
- ringtone_vol is not required.
Setting up & Using the (1st Gen) Xiaomi Button
Setting up the Button
The Smart-Home kit I purchased came with a 1st Gen Button. There is also a 2nd Gen Button available. I think the 1st Gen works well for general usage, though I am interested in getting a 2nd Gen Button to use as a Doorbell.
The first thing you’ll need to do is connect the Button to the Gateway, which is really easy.
- Push the button on the Gateway 3 times.
- Be careful, holding the Gateway button down for 5 seconds will reset the Gateway.
- If the Notification volume is still on, the Gateway will prompt you to connect the sensor.
- Use a pin or sim card tool to push into the hole on the back of the Button.
- It should now be connected.
- You can confirm the connection within the App or by restarting Home Assistant searching for it in the Developer Tool’s States page.
- Now that the button is set up, you can check that its connection still works wherever you put it by pushing the hole with a pin again. This will make the Gateway confirm if it’s still connected.
Using the Button
- The docs state that this Button has 5 separate click types:
- The 2nd Gen Button has 2 separate click types
- You will use the click types as automation triggers, but can connect them to do anything you want.
- You can also use the automation to set off a script.
The Xiaomi Gateway and Button are great devices for anyone who wants to add more versatility to their Smart-Home set up. They work well, look great, and are a fraction of the price of their competitors. I highly recommend them. 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!
If you’re interested in getting started with the Xiaomi Gateway, I recommend starting with one of the kits.
Different Gateway Kits Available
- 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.
- There is also the 4 in 1 Original Xiaomi Launch Sensors Suite, which includes the Gateway, a Button, a Door/Window Sensor, and a Motion Sensor.
- 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).
- 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:
- Temperature and Humidity Sensor (1st and 2nd generation)
- Motion Sensor (1st and 2nd generation)
- The 1st generation Motion Sensor is available with this Gateway kit
- Door and Window Sensor (1st and 2nd generation)
- Button (1st and 2nd generation)
- Plug aka Socket (Zigbee version only, reports power consumed, power load, state and if device in use)
- Wall Plug (reports power consumed, power load and state)
- Aqara Wall Switch (Single)
- Aqara Wall Switch (Double)
- Aqara Wireless Switch (Single)
- Aqara Wireless Switch (Double)
- Cube – Magic Controller
- Smoke Detector (reports alarm and density)
- Gateway (Light, Illumination Sensor, Ringtone play)
- Intelligent Curtain
- Water Leak Sensor