Top 7 overlooked Home Assistant automation trigger hacks
Note: This is generated from a transcript from one of my YouTube videos
Introduction to Advanced Triggers
Are your automations feeling a little predictable? You’ve likely got a motion sensor set up so that when you walk into a room, it turns a light on. Well, in this video, I’m going to cover seven different triggers that I’ve discovered over the last few years while building out my home automation system. These are my seven favorites. If you’ve got some, leave some in the comments; I’d love to hear them. Let’s get straight into it.
Contact Sensors and Duration Triggers
Location-Based Triggers
The next category of triggers is location-based. I have something set up so that if I'm in a particular zone, it triggers an action. In this case, if I'm in the 'gym' zone, which means I'm training and about to shower, it boosts the hot water. This works by detecting if I've been in that zone for 30 minutes. It then hooks into the 'hvac' integration and invokes the boost function for the hot water. I also used a similar concept when I was in the 'school' zone to disable notifications about potty reminders for my son. This was effective because if it knew I was in that zone, I likely wanted to avoid interruptions, especially at certain times.
NFC Tag Triggers
Mac Camera Status Triggers
Object Detection Triggers with Frigate
Sunset, Sunrise, and Time-Based Maintenance Triggers
An example of a trigger that might seem more obvious, but you might still like to explore, is sunset and sunrise. In our conservatory, we have lights that we want to turn on in the evening. Rather than setting a fixed time, like 6 PM, we turn them on at sunset. We also have lights in our conservatory that can be shaped on a magnetic blackboard, allowing us to create any design we want. For example, around Christmas, we turn them into festive shapes like a Christmas tree or a snowman, and change the lights to red, green, and white. I have an automation set up so that if the air conditioning hasn't been used in 72 hours, it runs a quick 20-minute cycle, just turning the fans on to circulate air before shutting down again. Throughout the winter, this automation runs every 72 hours to perform maintenance on the air conditioning. The key here is that it's not a fixed time-based automation; instead, it waits for a duration to elapse before triggering. This is quite a different trigger.
Scheduled Maintenance and Power Monitoring Triggers
Links:
- Govee Glide Hexa Panels: https://amzn.to/4iXioqs
- Aqara door sensor: https://s.click.aliexpress.com/e/_c3GktgGZ
- Ulanzi pixel clock: https://s.click.aliexpress.com/e/_c4myhcez
- COB RGB IC LED Strip: https://s.click.aliexpress.com/e/_c4K4cGal
- WLED controller box: https://s.click.aliexpress.com/e/_c4m8ij9r
- Sonoff zigbee smart water valve: https://s.click.aliexpress.com/e/_c3FtEu2z
- Elgato Key Light: https://amzn.to/4qelusB
- Govee Rope Light 2: https://amzn.to/4537pWv
- Aqara temperature sensor: https://s.click.aliexpress.com/e/_c3xAoLxT
- Innr smart plug: https://amzn.to/4iYKscT
Video
You can watch the full video on YouTube here:
Automations
Freezer open
alias: Notifications - Freezer left open
triggers:
- type: opened
device_id: f03ad2c7317d85c5bb34cbb49d7dab92
entity_id: a8416ee9f8c01ffab30b7b32943eb76f
domain: binary_sensor
for:
hours: 0
minutes: 15
seconds: 0
trigger: device
conditions: []
actions:
- data:
message: freezer open!
title: freezer is open!
action: notify.mobile_app_pixel_9_pro
- data:
entity_id: media_player.kitchen
message: Oh no! It looks like the freezer might be open
action: tts.cloud_say
mode: single
Stand up
alias: Notifications - Sitting for too long
triggers:
- type: not_opened
device_id: 2df59b838cba31ee9782854af81fa931
entity_id: 86f8a1a25fb706145b46b09c00cbee95
domain: binary_sensor
for:
hours: 0
minutes: 45
seconds: 0
trigger: device
- type: occupied
device_id: a0b642e80f6cc9eac5ba3e89af59ddf6
entity_id: 09b1c62f3b18c6fb0647889f94c642b4
domain: binary_sensor
trigger: device
for:
hours: 0
minutes: 45
seconds: 0
conditions:
- condition: and
conditions:
- type: is_occupied
condition: device
device_id: a0b642e80f6cc9eac5ba3e89af59ddf6
entity_id: 09b1c62f3b18c6fb0647889f94c642b4
domain: binary_sensor
- type: is_not_open
condition: device
device_id: 2df59b838cba31ee9782854af81fa931
entity_id: 86f8a1a25fb706145b46b09c00cbee95
domain: binary_sensor
for:
hours: 0
minutes: 50
seconds: 0
- type: is_off
condition: device
device_id: f4c0909bac37c8c46dc2393a7e9df40c
entity_id: 57b8a27e489b058b5bab7ebc0ef5bfc7
domain: binary_sensor
enabled: false
actions:
- metadata: {}
data:
qos: 0
retain: false
topic: awtrix_c02208/notify
payload: >-
{ "text":"Get up", "icon": "49337", "rainbow": false, "duration": 10
}
action: mqtt.publish
- action: select.select_option
metadata: {}
data:
option: Rainbow
target:
entity_id: select.office_wall_wled_preset
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- action: automation.trigger
metadata: {}
data:
skip_condition: true
target:
entity_id: automation.office_light_on
mode: single
Boost hot water
alias: "Temperature - Boost hot water while exercising "
triggers:
- entity_id:
- person.ben
to: BJJ
for:
hours: 0
minutes: 30
seconds: 0
enabled: true
trigger: state
alias: Ben is training BJJ
- entity_id:
- person.lizzie
to: Climbing
for:
hours: 0
minutes: 15
seconds: 0
enabled: true
trigger: state
alias: Lizzie is climbing
conditions: []
actions:
- data:
entity_id: water_heater.thermostat_1
time_period: "01:00:00"
on_off: "on"
action: hive.boost_hot_water
alias: Boost the hot water
mode: single
Open garage
alias: NFC - toggle garage door
triggers:
- trigger: tag
tag_id: ********-****-****-****-************
conditions: []
actions:
- action: automation.trigger
metadata: {}
data:
skip_condition: true
target:
entity_id: automation.doors_garage
mode: single
On call
alias: Lights - office lights on call
triggers:
- type: turned_on
device_id: f4c0909bac37c8c46dc2393a7e9df40c
entity_id: 57b8a27e489b058b5bab7ebc0ef5bfc7
domain: binary_sensor
trigger: device
for:
hours: 0
minutes: 0
seconds: 4
- type: turned_on
device_id: 45c5faa79d6b709e2eb817c190798446
entity_id: a3e88892eb5d149c9c7165c999922264
domain: binary_sensor
trigger: device
conditions:
- type: is_occupied
condition: device
device_id: a0b642e80f6cc9eac5ba3e89af59ddf6
entity_id: 09b1c62f3b18c6fb0647889f94c642b4
domain: binary_sensor
actions:
- action: light.turn_off
metadata: {}
data: {}
target:
device_id: 162dd37f58925138984ab65508787813
enabled: true
- target:
entity_id:
- light.office_ceiling_wled_2
data:
brightness: 129
effect: Solid
color_temp: 312
enabled: true
action: light.turn_on
- target:
entity_id:
- light.office_innr_ceiling_light
data: {}
action: light.turn_off
- metadata: {}
data:
option: Aurora
target:
entity_id:
- select.office_picture_frame_wled_preset
action: select.select_option
- action: light.turn_off
metadata: {}
data: {}
target:
entity_id: light.office_wall_wled
- metadata: {}
data:
option: Gradient camera
target:
entity_id:
- select.office_kallax_wled_preset
action: select.select_option
- action: light.turn_on
metadata: {}
data: {}
target:
entity_id: light.elgato_a2utb52211twpv
mode: single
Water the cats
Frigate provides binary sensors for object types - in this case, it’s using a binary sensor for ‘cat’
alias: Maintenance - water cats
triggers:
- type: occupied
device_id: 9453eca3b18ed24921ee474d6a417ef7
entity_id: b784e31b092a070859bba5a8ff8d2627
domain: binary_sensor
trigger: device
enabled: true
- type: occupied
device_id: 5ece90f97ce8f5ccae5e618642f01d1a
entity_id: e204f43b0a4fe1f2927337843693d526
domain: binary_sensor
trigger: device
enabled: true
conditions:
- condition: template
value_template: >-
{{ state_attr('automation.maintenance_water_cats', 'last_triggered') ==
none or (now() - state_attr('automation.maintenance_water_cats',
'last_triggered')).total_seconds() > 1800 }}
- condition: state
entity_id: input_boolean.front_garden_recent_person
state: "off"
- type: is_not_open
condition: device
device_id: 0e546256a057750bc79caecedb077bb9
entity_id: ae8a12324b914b89cd351a031ce3198a
domain: binary_sensor
- condition: numeric_state
entity_id: sensor.pirate_weather_precip_probability
below: 85
actions:
- type: turn_on
device_id: e08748e04df8e572eb31e70760024f1c
entity_id: 85568e5db507a35d03f7e66ff0dd32cf
domain: switch
- action: notify.mobile_app_pixel_9_pro
metadata: {}
data:
title: Watered a cat
message: The sprinkler was set off at {{ now() }}
enabled: true
alias: Notify Ben's phone
mode: single
Sunset conservatory lights
alias: Lights - Conservatory lights on
mode: single
triggers:
- type: motion
device_id: 754c7cb6982bda5ed173eab8823560b8
entity_id: 8e01bd65cfd173523880fce9d20d2daf
domain: binary_sensor
for:
hours: 0
minutes: 0
seconds: 1
trigger: device
- event: sunset
offset: 0
trigger: sun
conditions:
- type: is_motion
condition: device
device_id: 754c7cb6982bda5ed173eab8823560b8
entity_id: 8e01bd65cfd173523880fce9d20d2daf
domain: binary_sensor
- condition: or
conditions:
- condition: sun
before: sunrise
- condition: sun
after: sunset
actions:
- target:
entity_id:
- switch.conservatory_ledvance_socket_wall_light
data: {}
action: switch.turn_on
- data:
brightness_pct: 100
target:
device_id:
- 5221b2898daad97f4bb40be7be219425
- e0dc7ab8a4e73f492990b7b738bbc311
action: light.turn_on
Heat lamp might be out
alias: Temperature - Cheeto's heat lamp
triggers:
- trigger: time
at: "08:00:00"
conditions:
- type: is_temperature
condition: device
device_id: a60fb50d05aa2fc0568fa22313e78a87
entity_id: eac6c6b269b339c37df507381c683b15
domain: sensor
below: 30
actions:
- data:
title: "Cheeto's viv temperature "
message: It's colder than it should be in her vivarium. Check the heat lamp!
action: notify.mobile_app_pixel_9_pro
entity_id: media_player.living_room_speaker
message: Cheeto's vivarium is a bit cold. Check the heat lamp.
action: tts.cloud_say
- data:
mode: single
Dehumidifier example
alias: Humidity - notify high in snug
triggers:
- type: power
device_id: d723b8d78f7a359fe9e92be374014ffe
entity_id: 569bbd3a09d8e65da55b3fd584a52fe8
domain: sensor
trigger: device
below: 2
for:
hours: 1
minutes: 0
seconds: 0
- trigger: numeric_state
entity_id:
- sensor.snug_aqara_temperature_humidity
above: 65
conditions:
- condition: and
conditions:
- type: is_power
condition: device
device_id: d723b8d78f7a359fe9e92be374014ffe
entity_id: 569bbd3a09d8e65da55b3fd584a52fe8
domain: sensor
below: 5
- condition: device
type: is_on
device_id: d723b8d78f7a359fe9e92be374014ffe
entity_id: 81c5a5dbc8af48befb98754130cbe5d6
domain: switch
- condition: numeric_state
entity_id: sensor.snug_aqara_temperature_humidity
above: 60
actions:
- device_id: 6fc2c52666a788dca9568baf28521a0d
domain: mobile_app
type: notify
message: Humidity in the snug is high, maybe the dehumidifier is off?
title: High humidity in snug
- if:
- condition: time
after: "08:00:00"
before: "19:00:00"
weekday:
- mon
- tue
- wed
- thu
- fri
- sat
- sun
then:
- data:
entity_id: media_player.living_room_speaker
message: The snug dehumidifier needs emptying
cache: false
action: tts.cloud_say
mode: single
Support me to keep making videos
If you like the work I’m doing, please drop a like on the video, or consider subscribing to the channel.
In case you’re in a particularly generous mood, you can fund my next cup of coffee over on Ko-Fi
The links from some of my videos are affiliate links, which means I get a small kickback at no extra cost to you. It just means that the affiliate knows the traffic came from me.