Adding Xiaomi Door and Window Sensors to SmartThings

One of the initial reasons I chose to invest in SmartThings was the ability to keep an eye on my house via my phone, making sure it was secure. The initial starter box included 1 door and window sensor and 1 motion sensor. These were positioned in the most effective places protecting the front and back doors.

However, this did not cover all doors and parts of my house were still accessible without triggering SmartThings. This made me a little worried, especially with a newborn child.

The problem with SmartThings sensors is the expense. Each additional sensor was coming out at around £30 (this was until a recent price drop on the 6th December to £20.99). I had 4 doors which I needed to secure which at the time was looking at £120 (now £84).

I needed a cheaper solution!

Through research and a couple of posts on the facebook SmartThings user group, I discovered the Xiaomi door and window sensors. At £6.11 per sensor, it seemed like the ideal solution to add to my smart home. In total for 4 sensors with delivery and customs protection, it came to £31.40 (working out at £7.85 each). The initial delivery said 3-5 working days, it turned out to be 15 days before their arrival.

How to connect Xiaomi Door and Window Sensors to SmartThings

Creating a Device Handler

The first step to adding the door sensors was to add a custom device handler to the SmartThings control hub. This allows us to recognise the devices when adding them to the SmartThings app. To do this login to your control panel at https://graph.api.smartthings.com/ and go to my device handlers at the top menu.

Click the ‘+ Create New Device Handler’, select the tab ‘From Code’, copy code from https://github.com/a4refillpad/Xiaomi/blob/master/devicetypes/a4refillpad/xiaomi-door-window-sensor.src/xiaomi-door-window-sensor.groovy and paste in the box. At the bottom underneath the code click ‘create’ and then back at the top click ‘publish’.

xiaomi door and window sensor device handler

Your device handler is now added and you should be able to connect your Xiaomi Door and Window Sensors in SmartThings.

 

Adding the Xiaomi door and window Sensors

Once you’ve added the custom code. The next step is to add the devices to SmartThings. To do this go on to your SmartThings app, got to my home and click the + button in the top right corner. The app will immediately start looking for new devices. Now on your sensors, there is a small hole at the bottom, you’ll need something small like a pin to press it (I used an earring). There is no pattern (unless someone has found one), you simply need to alternate between clicking the button and holding it.

SmartThings device search

Once it’s picked up it should show Xiaomi Door sensor and it will allow you to change the name.

xiaomi door and window sensor device foundXiaomi door and window sensor paired

Repeat the same process for all of the sensors.

XIAOMI Door and window Sensors Afterthoughts

The Xiaomi door and window sensors proved a useful addition to my smart home at a fantastic price. Although they’re not as easy to connect or as feature-packed (such as temperature readings) as the SmartThings sensors they prove to be reliable and work extremely well.

One of the sensors did drop out after 12 hours (the first time I added it), however, after reinstalling it, there has been no further issues.

If you are looking for affordable door sensors to add to SmartThings, we’d highly recommend them!

1 thought on “Adding Xiaomi Door and Window Sensors to SmartThings”

  1. I would highly recommend using the updated device handlers from bspranger/Xiaomi on GitHub.

    The battery voltage is now reported correctly, and the date of battery replacement can be stored to help remember when it was last replaced.

    For the Xiaomi Door/Window sensors, the direct link to the code is https://raw.githubusercontent.com/bspranger/Xiaomi/master/devicetypes/bspranger/xiaomi-door-window-sensor.src/xiaomi-door-window-sensor.groovy

    Also note there is another kind of Xiaomi Door/Window sensor, called the Aqara sensor, which is more rectangular shaped. The device drivers for those can be copied from https://raw.githubusercontent.com/bspranger/Xiaomi/master/devicetypes/bspranger/xiaomi-aqara-door-window-sensor.src/xiaomi-aqara-door-window-sensor.groovy

    Personally, I use 4 of each kind of the Door/Window sensors and they are great, especially considering the price!

Leave a Reply

Your email address will not be published. Required fields are marked *