Xiaomi Buttons & Switches Around The House

I’ve already told you how much I loved Xiaomi’s 1st Generation Button, and I’m happy to say that the others are just as great! In this post I’ll quickly cover…

  • How to connect the Xiaomi 2nd Generation Button to the Gateway.
  • How to connect the Xiaomi Wireless Double Key Switch to the Gateway.
  • Differences between the 1st and 2nd Generation Buttons.
  • How I use the 1st & 2nd Generation Buttons and the Wireless Double Key Switch around the house.

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.


Connecting the Devices to the Xiaomi Gateway

If you want to use a 1st Generation Button, I’ve already done a complete write up on how to set it up. The other button and switch are not much different.

Connecting the 2nd Generation Button

IMG_0147

  • The 2nd Generation Button no longer requires a SIM card tool to connect to the Gateway. It has a button on the top of the device.

bty

  • First, you will need to put the Gateway in pairing mode. To do this, simply press the button on the Gateway 3 times. You will receive an audio prompt.
  • Push and hold down the button on the 2nd Generation Button.
  • When the light on the button blinks, you can let go. The device will now pair.

After the light stops blinking on the button, you can restart Home Assistant and find the device in the Developer Tool’s States page. It will look like this.

Gen 2 States

Connecting the Wireless Double Key Switch

IMG_0140

The process for connecting the Wireless Double Key Switch is identical to the others, but there is no need for a SIM card tool or an extra button. To pair this switch you will use the left key.

  • First, put the Gateway in pairing mode by pressing the button on the Gateway 3 times. You will receive an audio prompt.
  • Push and hold down the left key on the Double Key Switch.

IMG_0142

  • The lights on the bottom of the switch will light up, now you can let go. The device will now pair.

Restart Home Assistant and you will be able to find the switch in the Developer Tool’s States page. It will come up as 3 separate binary sensory, one for each click option.

Wall Switch States

Now that you’re all connected, lets put them to use.

Using the Buttons and Switches

All of these devices are considered binary sensors in Home Assistant. The best way I’ve found to utilize them is to create automations based on the input of the sensor.

Gen 1 Buttons

The Xiaomi Gen 1 Buttons turned out to be the best devices to control the bedroom from bed. I got two of them so my SO and I each have one on our side of the bed. We use them to control the lamp, the bedroom fan, and the window fan. You can see that I made one automation that can use either button as the trigger.

IMG_0143

  • A single click toggles the bedroom lamp.
    • If my sunrise script is on, it turns off the lamp and snoozes for 5 minutes
  • A double click toggles the window fan.
  • A long click toggles the bedroom fan.

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

Gen 2 Button

The 2nd Generation Button has been turned into a smart(ish) doorbell. I live in an apartment that has a broken doorbell. When we moved in, we got a cheap RF doorbell and chime, but I thought this would be a worthwhile upgrade. I utilized an external speaker, the Audio Player add-on, and a doorbell mp3 file. The Gen 2 Button has 2 triggers; a single press and a double press. For this usage, I made both triggers call the same action.

IMG_0148

  • To put this together, first you will need to put your chosen mp3 file in the “www” file inside your config file.
  • Install the Audio Player add-on.
  • To make the doorbell smart(ish), I use it as a trigger to send me a text with IFTTT.

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

Wireless Double Key Switch

The Xiaomi Wireless Double Key Switch is probably my favorite Xiaomi device so far. It is solidly built and looks like a built in light switch, which is exactly how I use it. I use the left key to toggle the lamp in my living room (there is no light switch), the right key to toggle the light in the entryway, and both keys together toggles the fish tank’s light. I also use them to call my bedtime routine. If you’ve been here before, you’ll notice this is the same bedtime script that has evolved over time, as my house has gotten smarter. This makes it easy if I or my SO stay up late as we can get the bedroom ready without interfering with any of the living room devices.

This is how it works:

  • The input number stays at 0 until 15 minutes before I go to bed to read. At that point it is raised to 3.
  • If the input number is 3 or 2, the right key gets the bedroom ready for bed and lowers the input number by 2. After that it will continue to toggle the entry lamp.
  • If the input number is 3 or 1, the left key gets the living room ready for night and lowers the input number by 1. After that it will continue to toggle the entry lamp.

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

The Xiaomi buttons and switches are such a great way to control Home Assistant and they’re so affordable. They’re great quality also, every single one of them. If you’re looking for some devices to add on to your system, I definitely recommend looking into the Xiaomi line of smart home devices. It also seems like it’s a good time to pick up some devices at Gearbest, it looks like they’re having a sale this month! Do you have any of these devices? I’d be interested in how you use them! Share with us in the comments. 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!

Leave a Reply