Skip to content

Commit fdbe25d

Browse files
committed
added post
1 parent f2b095f commit fdbe25d

3 files changed

Lines changed: 275 additions & 111 deletions

File tree

config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ privacy:
1313

1414
params:
1515
env: production
16+
defaultTheme: dark
1617
description: I'm Wuguang, a architect / software engineer / site reliability engineer based in Singapore. I write about tech including topics in software engineering.
1718
homeInfoParams:
1819
Title: Hi there, I'm Wuguang

content/posts/2025/11/home-automations/index.md

Lines changed: 0 additions & 111 deletions
This file was deleted.
Lines changed: 274 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,274 @@
1+
---
2+
title: "Top Smart Home Automations That Make Life Easier 🏖️"
3+
summary: "Simplify daily tasks with smart home automations"
4+
showToc: true
5+
tocOpen: true
6+
date: 2025-12-14
7+
tags:
8+
- HomeAutomation
9+
cover:
10+
image: "home-automations.png"
11+
alt: "Home automations"
12+
caption: "Simplify daily tasks with smart home automations"
13+
---
14+
Having a smart home has been a game changer for me.
15+
It's not just about cool gadgets; it's about making your life more convenient, more efficient (think lower utility bills) and secure (notifications when I'm away from home).
16+
While the sky is the limit with automating your smart home, I've found a number of core automations that have become indispensable in my smart home.
17+
18+
Here are some of my favourite home automations that I use and love.
19+
20+
> [!NOTE]
21+
> My smart home is powered by [Home Assistant](https://www.home-assistant.io/) (HA) so any blueprint, automation or script shared here are based on that platform.
22+
> If you are using other platforms (Apple Homekit, Google Home, etc.), you won't be able to use my automation code.
23+
> However, you can still create similar automations since they have the same *triggers-conditions-actions* structure.
24+
25+
---
26+
27+
## 💡 Motion Activated Lighting
28+
29+
Let's start off with the most basic and most commonly used automation - motion activated lighting.
30+
31+
This automation is particularly a life-saver for me as I have a toddler at home.
32+
I have strategically placed a motion sensor near her bedroom to ensure that if she needs a nighttime trip to the toilet,
33+
the lights will turn on automatically which eliminates the need for me to fumble for distant light switches.
34+
35+
> [!TASK] What you'll need
36+
> 1. Motion sensor
37+
> 2. Smart bulb, switch or light
38+
39+
**How the automation works**:
40+
Most motion sensors are operated with a button battery and provide 2 attributes: a binary on-off state for motion and a numerical value for illuminance.
41+
These 2 values are used to activate the automation.
42+
43+
**Triggers**: Motion is detected.
44+
45+
**Conditions**: The illuminance is below the given threshold (we only want to execute the automation if it's too dark).
46+
47+
**Actions**:
48+
1. Turn on the light.
49+
2. Wait for the motion sensor to clear (i.e. no movement detected).
50+
3. Turn off the light.
51+
52+
> [!CODE] Automation: Motion activated lights
53+
> ```yaml
54+
> triggers:
55+
> - trigger: state
56+
> entity_id:
57+
> - binary_sensor.motion_sensor_motion
58+
> to:
59+
> - "on"
60+
> conditions:
61+
> - condition: numeric_state
62+
> entity_id: sensor.motion_sensor_illuminance
63+
> below: 20
64+
> actions:
65+
> - action: light.turn_on
66+
> target:
67+
> entity_id: light.ceiling
68+
> - wait_for_trigger:
69+
> - trigger: state
70+
> entity_id:
71+
> - binary_sensor.motion_sensor_motion
72+
> to:
73+
> - "off"
74+
> - action: light.turn_off
75+
> target:
76+
> entity_id: light.ceiling
77+
>```
78+
79+
> [!TIP] Tip: Improving the accuracy of your motion sensor
80+
> 1. Shadows, reflections, and movement caused by wind (e.g. fluttering curtains) may trigger motion sensors.
81+
> 2. Motion sensors have a cone-shaped detection zone and typically have an optimal range where it can detect movement reliably.
82+
> Too close, you will be in its blind spot; too far, you will be out of the detection zone.
83+
> 3. Continue to fine-tune by re-positioning your motion sensor or adjusting its sensitivity and detection interval for the best results.
84+
85+
## 🛋️ Adaptive Lighting
86+
87+
This quality-of-life improvement can be used in conjunction with other lighting automations such as the motion activated lighting mentioned above.
88+
Its main purpose is to set up warm lighting and dimming the light during nighttime to reduce eye strain and for a cozy ambience as you wind down for the day.
89+
90+
> [!TASK] What you'll need
91+
> 1. Smart bulb or light
92+
93+
**How the automation works**:
94+
It's self-explanatory given the triggers and actions below.
95+
96+
**Triggers**:
97+
1. By scheduled time.
98+
2. The light is turned on.
99+
100+
**Actions**:
101+
1. Determine the brightness and color temperature based on the current time.
102+
2. Set the brightness and color temperature of the light.
103+
104+
> [!NOTE]
105+
> I don't have any automation code to share here since I am using HA's [Adaptive Lighting](https://github.com/basnijholt/adaptive-lighting) custom integration to set this up.
106+
107+
## ❄️ Turn Off the Air-conditioner When Doors/Windows Are Open
108+
109+
This is an energy-saving automation which switches off your air-conditioner when your door (or windows) is open.
110+
111+
> [!TASK] What you'll need
112+
> 1. Contact sensor
113+
> 2. <abbr title="Infrared / Radio Frequency">IR/RF</abbr> blaster (for controlling your air-conditioner)
114+
115+
**Setting up the contact sensor**
116+
117+
The contact sensor consists of 2 parts: the sensor body and a small magnet.
118+
1. Mount the sensor body on to the door frame.
119+
2. Mount the magnet on to the edge of the door. It should be positioned so that it is aligned with the sensor body when the door closes.
120+
121+
**Setting up the IR/RF blaster**
122+
123+
Most air-conditioners do not have smart home capabilities, so an IR/RF blaster is used for control.
124+
To set up the IR/RF blaster for use with your air-conditioner,
125+
1. Execute the `remote.learn_command` action on the IR/RF blaster:
126+
```yaml
127+
action: remote.learn_command
128+
target:
129+
entity_id: remote.ir_rf_remote
130+
data:
131+
command_type: ir
132+
device: air-conditioner # a user-friendly name describing the device
133+
command: "off" # a user-friendly name describing what the command does
134+
```
135+
2. The IR/RF blaster will wait for the IR signal. Point the remote of your air-conditioner at the IR/RF blaster and press the corresponding "off" button.
136+
3. The IR/RF blaster captures the IR signal and saves it for future use with the `remote.send_command` action.
137+
138+
**How the automation works**:
139+
The automation is triggered by the contact sensor's state change after 2 minutes (or any amount of time you have configured).
140+
The IR/RF blaster sends the "off" command by mimicking the IR signal from air-conditioner's remote, turning off the device.
141+
142+
**Triggers**: Door is opened for more than 2 minutes.
143+
144+
**Actions**: Send "off" command using remote.
145+
(Possible variations include playing a chime on smart speakers as a reminder.)
146+
147+
> [!CODE] Automation: Turn off air-conditioner when door is opened for 2 minutes
148+
> ```yaml
149+
> triggers:
150+
> - trigger: state
151+
> entity_id:
152+
> - binary_sensor.contact_sensor_contact
153+
> to:
154+
> - "on"
155+
> for:
156+
> hours: 0
157+
> minutes: 2
158+
> seconds: 0
159+
> actions:
160+
> - action: remote.send_command
161+
> target:
162+
> entity_id: remote.ir_rf_remote
163+
> data:
164+
> num_repeats: 1
165+
> delay_secs: 0.4
166+
> hold_secs: 0
167+
> command: "off"
168+
> device: air-conditioner
169+
> ```
170+
171+
## 🔊 Announcements for Home Appliances
172+
173+
For the ultimate relaxation, announcements beat notifications since they provide information to you without you having to grab your phone.
174+
For example, play an announcement when the washing machine has completed its cycle.
175+
Take a load off your mind - no more worries about mildew and musty odor!
176+
177+
> [!TASK] What you'll need
178+
> 1. Smart speaker
179+
> 2. Smart appliances (for example, washing machine and dryer)
180+
181+
**How the automation works**:
182+
When the washing machine has finished running, play an announcement every 15 minutes
183+
(or any amount of time depending on how frequent you want to be reminded) until the dryer starts running.
184+
185+
**Trigger**: The washing machine has finished running.
186+
187+
**Actions**:
188+
1. Repeat until the dryer is running.
189+
2. Say "The washing machine has finished running" on speaker.
190+
3. Wait until the dryer starts to run with a timeout of 15 minutes.
191+
192+
> [!CODE] Automation: Announce "washing machine has finished running"
193+
> ```yaml
194+
> triggers:
195+
> - trigger: state
196+
> entity_id:
197+
> - binary_sensor.washing_machine_wash_completed
198+
> to:
199+
> - "on"
200+
> actions:
201+
> - repeat:
202+
> until:
203+
> - condition: state
204+
> entity_id: sensor.dryer_process_state
205+
> state:
206+
> - Dry
207+
> sequence:
208+
> - action: tts.cloud_say
209+
> data:
210+
> message: The washing machine has finished running.
211+
> cache: true
212+
> entity_id: media_player.all_speakers
213+
> - wait_for_trigger:
214+
> - trigger: state
215+
> entity_id:
216+
> - sensor.dryer_process_state
217+
> to:
218+
> - Dry
219+
> timeout:
220+
> hours: 0
221+
> minutes: 15
222+
> seconds: 0
223+
> milliseconds: 0
224+
> ```
225+
226+
## 🚨 Network Video Recorder (NVR) Notifications
227+
228+
This automation utilizes a NVR to monitor for movement or persons in IP camera streams.
229+
When there is a detection, it sends a notification containing a sample video of the event.
230+
231+
> [!TASK] What you'll need
232+
> 1. NVR
233+
> 2. IP camera
234+
235+
For the NVR, I choose [Frigate](https://frigate.video/), a free open source solution since my hardware has a supported integrated GPU (iGPU) required to perform the detection.
236+
237+
**Setting up the NVR and IP camera**
238+
239+
The set-up for IP cameras varies based on the manufacturer, but the typical steps will involve the following:
240+
1. On your IP camera, configure the credentials for the <abbr title="Real Time Streaming Protocol">RTSP</abbr> stream. This allows you to securely and remotely view live feeds over the network.
241+
2. On your NVR, add the camera's RTSP stream.
242+
3. Configure the NVR detector (for example, detection zones and persons) for the RTSP stream.
243+
244+
**How the automation works**:
245+
Frigate sends a JSON formatted MQTT message when it detects a person.
246+
We then configure the trigger of the automation to filter for MQTT messages that match your desired camera and event type.
247+
For the actions, we simply wait to capture sufficient footage for a preview before including it in your notification.
248+
249+
**Trigger**: The NVR detected a person.
250+
251+
**Conditions**: No one is at home.
252+
253+
*Side note: There are many ways to determine "Away" status.
254+
You can use a toggle switch, Wi-Fi SSID status of your mobile, geofencing of mobile location or presence sensors.*
255+
256+
**Actions**:
257+
1. Wait for 30 seconds (or any amount of time) to record some footage.
258+
2. Send the preview as a notification to your mobile.
259+
260+
The automation code is rather complex,
261+
but you can use the community created [Frigate Mobile App Notification 2.0 Blueprint](https://github.com/SgtBatten/HA_blueprints/blob/main/Frigate_Camera_Notifications/Stable.yaml) to easily create the automation through a few mouse clicks.
262+
263+
## Conclusion: General Guidance on Automating Your Smart Home
264+
265+
Home automations are highly personalized and what I've shared may or may not suit you.
266+
The key is to identify repetitive tasks, the rules for triggering and the actions for buildidng your own automations.
267+
268+
Here's some general tips:
269+
- **Keep automations simple**. It might be tempting to create a single automation that handles all scenarios for a device.
270+
However, that might lead to a complex automation with triggers and conditions that interact in unexpected ways, resulting in an unreliable automation that's difficult to understand and troubleshoot.
271+
- **Make automations intuitive for family members.** Explain how the automations work so any automated behavior does not feel bewildering.
272+
- **Retain manual control.** Sometimes sensors fail, run out of batteries or your smart home platform becomes unresponsive (crashes, system updates, etc.).
273+
Always ensure your home remains functional even when your smart home capabilities are offline.
274+
For example, standard light switches for turning on/off lights.

0 commit comments

Comments
 (0)