Xiaomi Door/Window Sensors, A Follow Up.

I’ve had my Xiaomi Gateway for 7 or 8 months by now and have been very happy with its performance. The sensors are inexpensive and they integrate well with Home Assistant. The set I originally got, came with the Gateway, 2 Door/Window Sensors, and a Generation 1 Button. I’ve recently added some more sensors into the mix and have some more I still want to add. The first thing I did, however, was add another Door/Window Sensor. I really liked to use these to trigger automations by interacting with my environment. I currently have one on my front door, bedroom door, and one on the door that leads from the living room to the 3ft x 3ft “hall” that we refer to as the “airlock.” I’ve already provided set up instructions in a previous post, so here I will focus on my YAML and my uses for these sensors.

I use these sensors for my:

  • Bedtime Routine
  • Night Light
  • Night Living Room Automation
  • Morning Routine
  • Fan Auto Shutoff
  • Leave & Arrive Scripts
  • Front Door Alarm

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.


20180516_165741-COLLAGE.jpg

Bedtime Routine

My Bedtime script was one of my first and most useful scripts when I first started using Home Assistant. I seem to get to add to it the most often, since it controls most areas of the apartment. I call this script with Alexa, usually. This script turns off the AC and TV, turns on the bedroom devices. It turns on the bathroom night light, then turns off the rest of the living room devices, except for the main lamp. The lamp and fish tank are turned off when the door to the living room is closed, then the living room light’s night settings are turned on.

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

Night Light

The Night Light is just a pair of the most basic automations. If the bedroom door opens, turn on the bathroom night light, when the bedroom door is closed, turn it off. I use the Xiaomi Gateway in the Bathroom as the night light.

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

Nighttime Living Room

The Nighttime Living Room automation is very similar, but I tried something a little different. I created an automation to trigger a script, that turns itself off when it is finished running. The automation waits for the door to open, then turns on the script. The script turns the lamp on at 15%, then waits for the door to close, which turns off the light.

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

IMG_0032.jpg

 

Morning Routine

The morning routine is simple, but required the addition of the third Xiaomi Door/Window Sensor. This is in 2 parts, an automation and a script. The automation turns off the nighttime living room settings from above, and begins the morning script.

https://gist.github.com/smarthomehobby/1036103b23b459e8325326a542c0b5ca

Fan Auto Shutoff

This stupid little script is one of my favorites. We use a fan in front of the door to cool off the apartment when it’s cooler outside. Now, when closing up, the fan shuts off automatically.

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

Leave & Arrive Scripts

These next two are great for making sure everything is shut off and for coming home to a lit house. I execute the first script with Alexa, usually. I made routines so I can say “Alexa, I’m leaving,” “We’re leaving,” and, “I’m heading out”. This turns off the TV and AC, and waits for me to leave and close the door. Then the apartment shuts off and the Arrive script is activated. Now, when coming home, the light will turn on when the door is opened.

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

Front Door Alarm

Front door alarm

This last one I’m pretty proud of, but requires a little more work. I wanted to create an alarm that could make a sound, send me a text, or do both. This one uses input_select, scripts, & an automation. This creates a drop down box to set & silence the alarm. When the alarm is playing, choosing silence will stop the sound and switch the alarm to “Unarmed.” I used IFTTT to send the text alerts.

*This is not a replacement for an actual security system*

Alarm Image

https://gist.github.com/smarthomehobby/6180a62b9d46214d2eea17d4400c5ee1

All in all, these sensors are pretty damn awesome and I recommend them if you’re in the market for some sensors. Do you have sensors like these? 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