10 New Automations for 2024: How To Setup

In this article I’ll explain how I set up all 10 of the automations found in my latest video. I’m using Home Assistant for every automation because I think it’s the best smart home system available right now. Not only that, but it makes it possible to do these automations in a very easy way!

If you want to jump to specific automations, make sure to use the table of contents below.

Affiliate Disclosure: This page has affiliate links, which earn us commission at no cost to you. 

It’s a twister! 🌪️ 

We have some outdoor shades that can handle some wind, but not extreme wind gusts. So the automation automatically rolls up the shades when the wind gusts are over 25 mph.

I’m using a Tempest weather station in my backyard for accurate wind speeds. I’m also using the BOND controller to open/close my outdoor shades with RF signals. Both Tempest and BOND have integrations into Home Assistant, so that makes everything easy.

Here is a screenshot of the automation.

Here is the YAML code of the automation so you can see exactly what’s happening.

alias: Windy outside open up shades
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.st_00050086_wind_gust
    above: 25
condition: []
action:
  - service: cover.open_cover
    target:
      entity_id: cover.backyard_shade_all
    data: {}
mode: single

Watch your step! 👟

For this automation I’m turning on some light strips under my side of the bed when I get up. I’m using a pressure sensor that is still being developed, but will hopefully be available this year. I’m using some cheap Kasa light strips because I just need some light to see and nothing fancy. Kasa lights integrate extremely well with Home Assistant, and so does the pressure sensor!

There are two automations. One that turns ON the light when stepping on the mat, and the other turns OFF the light if no one has been stepping on the mat for 30 seconds.

Here is a screenshot of the first automation.

Here is the YAML code of the automation so you can see exactly what’s happening.

alias: Bed light strips turn on from pressure mat
description: ""
trigger:
  - platform: state
    entity_id:
      - switch.pressure_mat_pressure_trigger
    to: "on"
condition: []
action:
  - service: light.turn_on
    target:
      entity_id: light.kasa_kl400_2
    data: {}
mode: single

Here is a screenshot of the second automation.

Here is the YAML code of the automation so you can see exactly what’s happening.

alias: Pressure sensor mat turn bed lights off
description: ""
trigger:
  - platform: state
    entity_id:
      - switch.pressure_mat_pressure_trigger
    to: "off"
    for:
      hours: 0
      minutes: 0
      seconds: 30
condition: []
action:
  - service: light.turn_off
    target:
      entity_id: light.kasa_kl400_2
    data: {}
    enabled: true
mode: single

Let the tiny terror sleep 😴

We don’t want our baby to wake up early, so if it’s nap time, the doorbell needs to ONLY notify our phones when it’s pressed, and not announce everywhere. I’m using a smart light switch and a contact sensor on the door to help me know when the baby is asleep.

If the door is closed and the light is off, then the baby is asleep. I’m using an Aqara contact sensor that uses Zigbee. I love how well this sensor works and how inexpensive it is. BUT, you will need a Zigbee hub or USB dongle for Home Assistant to connect it. You can use any smart light switch and I’m using Lutron. I’m also using a Unifi G4 doorbell that integrates great into Home Assistant.

The trigger is when the doorbell is pressed, it checks to make sure it’s not in the middle of the night and if the baby’s door is open or the light is on. If passes ALL of that then it will announce on the HomePod speakers someone is at the door.

Here is a screenshot of the automation.

Here is the YAML code of the automation so you can see exactly what’s happening.

alias: Front Doorbell Pressed
description: ""
trigger:
  - type: occupied
    platform: device
    device_id: 3287bfa01d8528cce1d857ca65ebe56a
    entity_id: binary_sensor.g4_doorbell_2_doorbell
    domain: binary_sensor
condition:
  - condition: time
    after: "07:00:00"
    before: "21:00:00"
action:
  - service: camera.snapshot
    target:
      entity_id: camera.g4_doorbell_2
    data:
      filename: /config/www/tmp/doorbell_snap.jpg
  - condition: or
    conditions:
      - condition: device
        type: is_on
        device_id: 1493ac3e934b0a55a7239615580d18f1
        entity_id: light.kitchen_island_pendants
        domain: light
      - condition: state
        entity_id: binary_sensor.lumi_lumi_sensor_magnet_aq2_opening
        state: "on"
  - service: media_player.volume_set
    data:
      volume_level: 0.5
    target:
      entity_id:
        - media_player.homepod_right_speaker
        - media_player.homepod_left_speaker
  - service: tts.google_translate_say
    data:
      entity_id: media_player.homepod_right_speaker
      message: Someone is at the front door.
mode: single

Smart reboot 🔄

I was tired of manually unplugging my smart light strips and plugging them back in when they would go offline. Now it automatically does it for me! I’m using some DIY light strips I put together, but this could apply to any smart device that goes offline.

Home Assistant has a status called “Unavailable” that is key to knowing if a device needs to be rebooted. I’m using any old smart outlet to cut power to the light strips and turn them back on. Then the automation checks to see if the lights are on in the room, and if so it leaves the light strips on, or turns them off if all the other lights are off.

Here is a screenshot of the automation.

Here is the YAML code of the automation so you can see exactly what’s happening.

alias: Reboot WLED if they go offline
description: ""
trigger:
  - platform: state
    entity_id:
      - light.wled_studio_corner_2
    to: unavailable
    for:
      hours: 0
      minutes: 5
      seconds: 0
condition: []
action:
  - type: turn_off
    device_id: 1be127cec893c8318da139a2cf11f8f2
    entity_id: 3f7840d4d2e792b1c53b648f0f515c10
    domain: switch
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - type: turn_on
    device_id: 1be127cec893c8318da139a2cf11f8f2
    entity_id: 3f7840d4d2e792b1c53b648f0f515c10
    domain: switch
  - delay:
      hours: 0
      minutes: 0
      seconds: 20
      milliseconds: 0
  - device_id: eaa3e7804452463e5cc1ddf8d9133cba
    domain: select
    entity_id: abccdb33a77194743a5b774960c27260
    type: select_option
    option: Solid Magenta
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - condition: state
    entity_id: light.kasa_light_strips_new_fav_2
    state: "off"
  - type: turn_off
    device_id: eaa3e7804452463e5cc1ddf8d9133cba
    entity_id: e9d986deda0cfc053af8095ca9abfb02
    domain: light
mode: single

Basketball lights 🏀

I wanted the lights to turn on automatically when we are playing basketball at night. I’m using a Unifi G4 bullet camera that can detect people to turn ON the lights. There’s also a second automation to turn OFF the lights if no one is detected for 10 minutes. I’m using some Novastella smart flood lights that integrate into Home Assistant using the Tuya integration.

The Unifi Protect integration for Home Assistant has the person detection available. Make sure to use the binary_sensor and not the switch.

Here is a screenshot of the first automation.

Here is the YAML code of the automation so you can see exactly what’s happening.

alias: Basketball lights on
description: Person detected at night the lights turn on
trigger:
  - platform: state
    entity_id:
      - binary_sensor.g4_bullet_backyard_person_detected
    to: "on"
condition:
  - condition: time
    after: "17:00:00"
    before: "23:00:00"
action:
  - service: light.turn_on
    target:
      entity_id:
        - light.smart_floodlight
        - light.smart_floodlight_2
    data: {}
mode: single

Here is a screenshot of the second automation.

Here is the YAML code of the automation so you can see exactly what’s happening.

alias: Basketball lights off
description: Person not detected at night the lights turn off
trigger:
  - platform: state
    entity_id:
      - binary_sensor.g4_bullet_backyard_person_detected
    to: "off"
    for:
      hours: 0
      minutes: 10
      seconds: 0
condition:
  - condition: time
    after: "17:00:00"
    before: "23:30:00"
action:
  - service: light.turn_off
    target:
      entity_id:
        - light.smart_floodlight
        - light.smart_floodlight_2
      device_id: []
      area_id: []
    data: {}
mode: single

Fresh air alert 🛝

Using that Unifi camera that can detect people in the backyard, I’m alerting my family (including myself) if no one has been in the backyard for a while and the weather is nice. I’m using the Tempest weather station so I can make sure it’s not raining and all of that, but you could easily use a normal weather integration for this automation.

The trigger is a “time based trigger” that doesn’t happen at dinner time.

Here is a screenshot of the automation.

Here is the YAML code of the automation so you can see exactly what’s happening.

alias: Kids go play outside announcement
description: ""
trigger:
  - platform: time
    at: "16:00:00"
  - platform: time
    at: "18:00:00"
  - platform: time
    at: "19:00:00"
condition:
  - condition: state
    entity_id: binary_sensor.g4_bullet_backyard_person_detected
    state: "off"
    for:
      hours: 1
      minutes: 0
      seconds: 0
  - condition: numeric_state
    entity_id: sensor.st_00050086_temperature
    above: 60
    below: 85
  - condition: not
    conditions:
      - condition: state
        entity_id: weather.home
        state: rainy
  - condition: state
    entity_id: input_boolean.tv_on
    state: "off"
action:
  - service: media_player.volume_set
    data:
      volume_level: 0.4
    target:
      entity_id:
        - media_player.homepod_right_speaker
        - media_player.homepod_left_speaker
  - service: tts.google_translate_say
    data:
      entity_id: media_player.homepod_right_speaker
      message: >-
        It is nice out, so go play in the backyard or I will block Netflix and
        mute my microphone so I can’t hear your cries. 
mode: single

Bribery 🍬

My kids have been slacking on their chores lately, so I wanted an automation to help motivate them. So I made a chore dashboard they can check off their chores, and when finished the candy dispenser gives them a treat.

I’m using a Google Nest display to cast a dashboard to the screen. I created two input boolean switches (virtual switches) to mark each chore as complete. Then I set up an automation: when both chores are complete, it sends me a notification with a actionable button I can press to give them candy if they did complete their chores.

Here is a screenshot of the automation to pull up the chore dashboard.

Here is the YAML code of the automation so you can see exactly what’s happening.

alias: Chore Button Pressed
description: ""
trigger:
  - device_id: f09eb5f58632e5177ee8ae8d8c87c8bb
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: remote_button_short_press
condition: []
action:
  - service: script.chore_display_cast_on
    data: {}
  - delay:
      hours: 0
      minutes: 5
      seconds: 0
      milliseconds: 0
  - service: script.chore_display_stop_casting
    data: {}
mode: single

I’m using a script to cast the dashboard so I have the option to use in other automations.

alias: Chore Display Cast On
sequence:
  - service: cast.show_lovelace_view
    data:
      entity_id: media_player.reed_s_display
      dashboard_path: lovelace-dash
      view_path: chore
mode: single

Here is a screenshot of the automation to send me the actionable notification.

Here is the YAML code of the automation so you can see exactly what’s happening.

alias: Chores complete notification
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.chore_kids_room_clean
    to: "on"
  - platform: state
    entity_id:
      - input_boolean.chore_pick_up_toys
    to: "on"
condition:
  - condition: state
    entity_id: input_boolean.chore_kids_room_clean
    state: "on"
  - condition: state
    entity_id: input_boolean.chore_pick_up_toys
    state: "on"
action:
  - service: script.actionable_notification_android
    data:
      title: Kids chores are done
      message: Well the kids say they are (hold to accept)
      replyevent: chorescomplete
      buttontitle: Give them candy
mode: single

The script for the actionable notification is there so I can easily change out which phone it goes to, and not change any of the automations that use it. I did a horrible job at naming the script by putting “Android” in it, even though it now goes to an iPhone… but oh well.

alias: Actionable Notification Android
sequence:
  - service: notify.mobile_app_iphone_pro_15
    data:
      message: " {{message}} "
      title: " {{title}} "
      data:
        actions:
          - action: " {{replyevent}} "
            title: " {{buttontitle}} "
mode: single

Here is a screenshot of the automation give them candy if I press the button on the notification.

Here is the YAML code of the automation so you can see exactly what’s happening.

alias: Chores complete confirm with candy
description: ""
trigger:
  - platform: event
    event_type: mobile_app_notification_action
    event_data:
      action: chorescomplete
condition: []
action:
  - service: button.press
    data: {}
    target:
      entity_id: button.aqara_aqara_feeder_acn001_feed
    enabled: true
mode: single

Watch the sunset 🌅

To make sure we don’t miss the sunset, I raise the shades right before the sun goes down. That way the sun isn’t shining through the window, but is just behind the mountains.

Here is a screenshot of the automation.

Here is the YAML code of the automation so you can see exactly what’s happening.

alias: Open outdoor shades for the sunset
description: ""
trigger:
  - platform: sun
    event: sunset
    offset: "-00:04:00"
condition: []
action:
  - service: cover.open_cover
    target:
      entity_id: cover.backyard_shade_all
    data: {}
mode: single

Dad mode 👨‍👧‍👧

When Aly is gone and I’m at home watching the kids in the evening, I need extra help from my smart home. I have my child’s favorite YouTube channel pull up on the TV, lights turn pink, and music in their room.

I’m using the Unifi integration into Home Assistant to know when Aly’s phone is disconnected from WiFi and mine is still home. That triggers the automation and I’m using the Apple TV integration with Home Assistant to pull up the YouTube app and pull up a video.

Here is a screenshot of the automation.

Here is the YAML code of the automation so you can see exactly what’s happening.

alias: Dad mode
description: Aly is gone in the evening and Reed is at home with the kids
trigger:
  - platform: state
    entity_id:
      - device_tracker.iphone_13_mini
    to: not_home
    for:
      hours: 0
      minutes: 2
      seconds: 0
condition:
  - condition: state
    entity_id: device_tracker.iphone_15_pro_2
    state: home
  - condition: time
    after: "17:00:00"
    before: "19:00:00"
  - condition: state
    entity_id: input_boolean.tv_on
    state: "off"
action:
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.dad_mode
    data: {}
  - service: light.turn_on
    target:
      entity_id:
        - light.hue_lightstrip_plus
        - light.wiz_rgbww_tunable_76c1e2
    data:
      brightness_pct: 100
      rgb_color:
        - 255
        - 0
        - 200
  - service: light.turn_off
    target:
      entity_id:
        - light.kitchen_kitchen_lights
        - light.kitchen_kitchen_back_door_lights
        - light.dining_room_main_lights
        - light.family_room_main_lights
    data: {}
  - service: automation.trigger
    target:
      entity_id: automation.ms_rachel_tv
    data:
      skip_condition: true
    enabled: true
  - service: media_player.play_media
    data:
      media_content_type: routine
      media_content_id: kidsmusic
    target:
      entity_id: media_player.reed_s_3rd_echo_dot
mode: single

Here is the automation for the YouTube video to pull up on the Apple TV.

alias: Ms Rachel on Apple TV
description: ""
trigger:
  - platform: event
    event_type: ms_rachel_tv
    event_data: {}
condition: []
action:
  - service: remote.send_command
    data:
      num_repeats: 1
      delay_secs: 0.4
      hold_secs: 0
      command: wakeup
    target:
      entity_id: remote.family_room_tv
  - delay:
      hours: 0
      minutes: 0
      seconds: 6
      milliseconds: 0
  - service: media_player.volume_set
    data:
      volume_level: 0.4
    target:
      entity_id:
        - media_player.homepod_right_speaker
        - media_player.homepod_left_speaker
  - service: media_player.select_source
    data:
      source: YouTube
    target:
      device_id: 7eac7199358a3c4fe3131e3c05bf0b26
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - service: remote.send_command
    data:
      delay_secs: 1
      hold_secs: 0
      command: top_menu
    target:
      entity_id: remote.family_room_tv
    alias: Go to main menu
  - service: remote.send_command
    data:
      hold_secs: 0
      command: top_menu
      delay_secs: 0.2
      num_repeats: 2
    target:
      entity_id: remote.family_room_tv
    alias: Double press menu
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - service: remote.send_command
    data:
      delay_secs: 0.2
      hold_secs: 0
      command: left
    target:
      entity_id: remote.family_room_tv
    alias: Go left
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - service: remote.send_command
    data:
      num_repeats: 2
      delay_secs: 0.1
      hold_secs: 0
      command: up
    target:
      entity_id: remote.family_room_tv
    alias: Exit out of app
  - service: remote.send_command
    data:
      delay_secs: 1
      hold_secs: 0
      command: menu
    target:
      entity_id: remote.family_room_tv
    alias: Go to main menu
  - service: media_player.select_source
    data:
      source: YouTube
    target:
      device_id: 7eac7199358a3c4fe3131e3c05bf0b26
    alias: Select YouTube
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - alias: Go left
    service: remote.send_command
    data:
      delay_secs: 1
      command: left
    target:
      entity_id: remote.family_room_tv
    enabled: true
  - alias: Go up
    service: remote.send_command
    data:
      command: up
      delay_secs: 1
    target:
      entity_id: remote.family_room_tv
    enabled: true
  - alias: Select search
    service: remote.send_command
    data:
      delay_secs: 1
      command: select
    target:
      entity_id: remote.family_room_tv
    enabled: true
  - service: remote.send_command
    data:
      delay_secs: 0.2
      hold_secs: 0
      command: right
      num_repeats: 12
    target:
      entity_id: remote.family_room_tv
    enabled: true
    alias: Select M
  - alias: Select search term
    service: remote.send_command
    data:
      delay_secs: 1
      command: select
    target:
      entity_id: remote.family_room_tv
    enabled: true
  - service: remote.send_command
    data:
      delay_secs: 0.2
      hold_secs: 0
      command: right
      num_repeats: 6
    target:
      entity_id: remote.family_room_tv
    enabled: true
    alias: Select M
  - alias: Select search term
    service: remote.send_command
    data:
      delay_secs: 1
      command: select
    target:
      entity_id: remote.family_room_tv
    enabled: true
  - service: remote.send_command
    data:
      delay_secs: 1
      command: down
    target:
      entity_id: remote.family_room_tv
    enabled: true
  - service: remote.send_command
    data:
      delay_secs: 1
      command: right
    target:
      entity_id: remote.family_room_tv
    enabled: true
  - alias: Select search term
    service: remote.send_command
    data:
      delay_secs: 1
      command: select
    target:
      entity_id: remote.family_room_tv
    enabled: true
  - service: remote.send_command
    data:
      delay_secs: 0.2
      hold_secs: 0
      command: right
      num_repeats: 5
    target:
      entity_id: remote.family_room_tv
    enabled: true
  - service: remote.send_command
    data:
      delay_secs: 0.2
      hold_secs: 0
      command: select
    target:
      entity_id: remote.family_room_tv
    enabled: true
mode: single

TV light perfection! 😍

I’ve always wanted a reliable way to turn off the lights when watching TV at night, and turn the lights back up when the TV is paused. I’m using the Apple TV integrated with Home Assistant to make this happen. Getting the Apple TV integrated into Home Assistant is so easy, because Home Assistant will detect it on your network and give you a button to set it up for you.

You get access to see if the Apple TV is playing or paused. This happens when you hit the remote or even if the show ends, so that’s how the lights turn on after the show finishes automatically. You also have access to what app on the Apple TV is being used, so you could only run this if watching Netflix or YouTube.

Also, I made a video on my 2nd channel explaining how to set it up.

Here is a screenshot of the automation to turn off the lights when something is playing.

Here is the YAML code of the automation so you can see exactly what’s happening.

alias: Living room lights off when TV is playing
description: ""
trigger:
  - platform: state
    entity_id:
      - media_player.family_room_tv_2
    to: playing
condition:
  - condition: time
    after: "18:00:00"
    before: "23:55:00"
  - condition: state
    entity_id: input_boolean.tv_lights_lock
    state: "off"
action:
  - service: scene.turn_on
    target:
      entity_id: scene.living_room_off_ha
    metadata: {}
mode: single

Here is a screenshot of the automation to turn on the lights when it’s paused or the show is finished.

Here is the YAML code of the automation so you can see exactly what’s happening.

alias: Family room TV paused turn up lights
description: ""
trigger:
  - platform: state
    entity_id:
      - media_player.family_room_tv_2
    to: paused
condition:
  - condition: time
    after: "18:00:00"
    before: "23:55:00"
  - condition: state
    entity_id: input_boolean.tv_lights_lock
    state: "off"
action:
  - choose:
      - conditions:
          - condition: time
            after: "18:00:00"
            before: "22:00:00"
        sequence:
          - service: scene.turn_on
            target:
              entity_id: scene.evening_living_room_lights_ha
            metadata: {}
    default:
      - service: scene.turn_on
        target:
          entity_id: scene.living_room_lights_warm_ha
        metadata: {}
mode: single

If you want to only have this work for a certain app on the Apple TV just add the App ID to the condition.

Say you don’t want it to change the lights when it autoplays on Netflix. Add one more condition to the automation.

              - condition: and
                conditions:
                  - condition: state
                    entity_id: media_player.family_room_tv_2
                    attribute: media_content_type
                    state: video
                  - condition: state
                    entity_id: media_player.family_room_tv_2
                    attribute: app_id
                    state: com.netflix.Netflix