Adding New Xiaomi Aqara Sensors - a quick trick I didn't know (without using the app, post-setup)

Press the button on the Aqara hub 3 times (quick presses), you’ll hear some Chinese.

Then press the little button on the sensor, success will prompt another Chinese sentence that begins with “Bei …”

A quick restart of Hass and they’re connected :slight_smile:

Tested with the Mini temperature sensor, and the window sensor.

I’ll try tomorrow with the Smoke Detector.

edit This method works with the Smoke detector too.

Does someone know Chinese?

Unsurprisingly, there is a different message when the connection fails but I didn’t catch it.

This proved very useful today when I couldn’t reconnect to the app for some reason to add them that way.


The chinese voice coming from my Xiaomi Gateway scares the living daylights out of my 5 year old, I have to be sure she’s out of the house if I’m adding any new sensors


The Xiaomi gateway is in a separate VLAN/SSID in my network, along with IPCams or WiFi plugs. This network is filtered, it can’t access any internet service.
Though the gateway works perfectly well that way (only have to open the broadcast to the HA server VLAN), it can’t add devices : my phone with Mi App in the same SSID, add fails. It needs an HTTP access “outside”.
Have you tried your method with gateway not accessing internet ? I’d love to be able to forbid it to “phone home” anytime !

Instead of pushing the gateway button three times you can also call the xiaomi_aqara.add_device service once:



Since we are talking about the xiaomi gateway, let me ask something related. I’d like to change the wifi config of my gateway and move it to a new SSID. I’m a little afraid of reseting the device (long press of the gateway button) and lose all the config of all the devices already paired (about 20). I read somewhere that the reset is not a “full” reset but still… Does anyone had already did that? Any hints? ty.

I use Pi Hole to do this, and there’s a Hassio Addon for it!!

Once you’ve it set up, you can block Xiaomi links with this command:

pihole -b


Quite a few hits are blocked per day, all the devices work perfectly nonetheless :slight_smile:


Thanks a mill, I’d no idea that was there. I’ll have to read that section more thoroughly!

Very handy!

I did that reset yesterday while I tried to get the phone app to reconnect, thankfully none of the settings were changed or messed up in anyway.

Home Assistant carried on working with them as before :slight_smile:

there are volume settings to completely turn that off :wink: have to go hunting its part of the gateway settings itself. You’ll see 3 different types of volumes to adjust lol


Great, may you explain what you did? Hold the reset button for 5 seconds, and then? What you did in the app?

After the reset, the app on my phone still wouldn’t connect to the gateway. I’d turned off HA, but the app still didn’t work :frowning:

Nevertheless, when I turned back on HA - all returned to normal.

I still haven’t solved how to get the app on my phone to talk to the Xiaomi gateway, it worked perfectly the first time. That’s when I discovered the trick to add new devices without the app.

I plan on getting another gateway at some point, so I’ll have to solve the app issue.

I can confirm that resetting the gateway won’t ruin what you have so far with HA :slight_smile:

I have already isolated this VLAN, I use a firewall behind my DSL boxes. I have a fortinet because I’m used of those at work. So in basic operation, IoT VLAN is closed except for HA, Zoneminder access to a local server.
I just can’t add a Xiaomi sensor to the gateway in this configuration. I have to authorize HTTP to Internet in order to make it work. With the Xiaomi app, even if the android device running MiHome is in the same VLAN. I don’t know if it’s a MiHome requirement or a gateway requirement ?

1 Like

Ty. Just did it and everything is ok.

1 Like

Well…I’ve an Asus router .I just block internet for well so far

But same issue with the shows all devices offline .either it needs to call China to get state which is blocked but also unblock internet access doesn’t solve this issue.I don’t mind as long as I can add them either with hass or manually

1 Like

I’m not familiar with the type of setup you have, though when I added the Smoke Detector I had the Pi Hole block up & running, though not the Hub itself specifically blocked from all internet connections.

If I get the chance later I’ll see how they all behave when I block the hub completely from the outside world.

When I was trying to get the app reconnected to the hub, I turned off HA & Pi Hole but still no luck.

I’ll try out some more combinations later, and see if I can get the phone app connected.

Ok so this should work ! I’ll remember that when adding my next device (what is bad with Xiaomi, is that there’s always a next device to buy :wink: ) and tell you if that worked.

I too haven’t the status of sensors in the mihome app, I guess it’s because HA is connected in ‘developper mode’ ? Anyway, as long as it sends the updates to HA, I’m fine and I don’t care about the app.

Thanks again for the tip !

1 Like

I learnt this from reddit! It’s really useful when you block the gateway’s internet access. Is there anyway to unpair a device without using the mi home app? Do you have to keep the sensor’s button pressed for X amount of time?

There’s this from the Hass component:

Service xiaomi_aqara.remove_device

1 Like

Cool trick, but I wouldn’t recommend these motion sensors (Aquara) with Home Assistant. They work, sometimes and most of the time are unreachable and never trigger. And this isn’t from far away, 5 feet or so.