What is Home Assistant Alert? Have you ever left something at home open or turned on for a long time, like the front door, garage door, fridge door, or even an iron? I have, and that’s why I started using Home Assistant alerts. These alerts send repeated notifications at customizable intervals so I never forget again. Plus, these notifications can be actionable. This means I can tap on the notification to close my garage door or ignore it if I want my door to remain open until the next reminder.

In this article, I will show you how the Home Assistant alert functionality works for me and how you can set it up yourself.

How Home Assistant Alerts Work

Here is a quick overview of how I use Home Assistant alerts:

  1. Monitoring the Garage Door: I have set up an alert to monitor if my garage door is open. If it stays open for a certain period, the alert becomes active, and I receive a notification.
  2. Battery Alerts: I have another alert for when my front door battery is low. If the battery drops below 15%, I get notified.

Let me show you how these alerts work in practice.

Tired of Reading? No Problem, Check My Video

Prefer watching a tutorial instead of reading? Check out my video guide on setting up Home Assistant alerts. Watch the video tutorial below:

Garage Door Alert

  1. Opening the Garage Door: I open my garage door.
  2. Alert Activation: A few seconds after opening, the alert becomes active.
  3. Notification: After 1 minute, I receive a notification on my phone via Telegram messenger & Home Assistant Companion App saying, “The garage door is still open.”
  4. Actionable Notification: The Telegram notification includes two buttons: “Close Garage” and “Acknowledge”. If I tap “Close Garage”, the garage door closes. If I tap “Acknowledge”, the alert turns off but the garage door remains open.
Home Assistant Alert with Close garage & Acknowledge buttons in Telegram messenger
Home Assistant Alert with Close garage & Acknowledge buttons in Telegram messenger

Front Door Battery Alert

  1. Battery Below Threshold: If the front door battery drops below 15%, the alert becomes active.
  2. Notification: After 1 minute, I get a notification, “The front door battery is still low.”
  3. Actionable Notification: The notification allows me to acknowledge the alert, ensuring I am reminded again later if I haven’t changed the battery.
Home Assistant Alert where you can just Acknowledge that the battery of the sensor is low
Home Assistant Alert where you can just Acknowledge that the battery of the sensor is low

Setting Up Home Assistant Alerts

To set up alerts in Home Assistant, you need to edit your configuration.yaml file. Here’s a simple step-by-step guide:

Step 1: Install an Add-on

If you use Home Assistant OS or supervised, you can use add-ons like File Editor or VSCode. These can be installed from the Home Assistant Add-on Store with one click.

If you are a bit confused from these OS, Supervised, Core & Container terms, don’t worry just register for my Home Assistant Webinar and you will understand everything essential in no time, absolutely for free. You can use the link below to reserve your seat. 

https://automatelike.pro/webinar

Step 2: Configure Alerts

Add the following code to your configuration.yaml file to set up an alert for your garage door or any device or entity of your interest.

# Example configuration.yaml entry
alert:
  garage_door:
    name: "Garage is open"
    message: "The garage door is still open"
    done_message: "The garage door is closed"
    entity_id: cover.garage_door
    state: "open"   # Optional, 'on' is the default value
    repeat: 1
    can_acknowledge: true  # Optional, default is true
    skip_first: true  # Optional, false is the default
    data:
      inline_keyboard:
        - 'Close garage:/close_garage, Acknowledge:/garage_acknowledge'
    notifiers:
      - app_and_telegram

Step 3: Set Up Notifications

To use Telegram for notifications, use the following official documentation or my article. In general, you have to do the following:

  1. Create a new bot on Telegram.
  2. Get the chat ID and API key.
  3. Add the following to your configuration.yaml file:
telegram_bot:
  - platform: polling
    api_key: YOUR_API_KEY
    allowed_chat_ids:
      - YOUR_CHAT_ID
      
notify:
  - name: Telegram
    platform: telegram
    chat_id: 'YOUR_CHAT_ID'
  - platform: group
    name: app_and_telegram # you can choose your own name here
    services:
      - service: mobile_app_kiril #replace with your notification service
      - service: telegram #replace with your notification service 

Step 4: Restart

To activate the new Telegram notification service and to activate the Alerts you have to restart your Home Assistant, so please restart it now

Step 5: Create Home Assistant Automations

Create automations to handle actions (Close Garage & Acknowledge) when you tap on notification buttons. Here’s an example automation for closing the garage door:

alias: Telegram callback to close the garage door
description: ""
trigger:
  - platform: event
    event_type: telegram_callback
    event_data:
      data: /close_garage
condition: []
action:
  - service: telegram_bot.answer_callback_query
    metadata: {}
    data:
      show_alert: true
      target: "{{ trigger.event.data.chat_id }}"
      callback_query_id: "{{ trigger.event.data.id }}"
      message: The Garage is Closing!
  - service: cover.close_cover
    metadata: {}
    data: {}
    target:
      entity_id: cover.garage_door
mode: single

And here’s an example for acknowledging the alarm when pressing on the Acknowledge button in Telegram messenger.

alias: Telegram callback to stop alerts for garage door
description: ""
trigger:
  - platform: event
    event_type: telegram_callback
    event_data:
      data: /garage_acknowledge
condition: []
action:
  - service: alert.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: alert.garage_door
mode: single

Download the Smart Home Glossary

Need help understanding smart home terms? Download my comprehensive Smart Home Glossary for free. It’s one big PDF file packed with essential terms and explanations. The link is available below and it cost nothing.

https://automatelike.pro/glossary

Conclusion

Using Home Assistant alerts can prevent you from forgetting to close doors or turn off appliances, giving you peace of mind. With a bit of setup, you can receive actionable notifications and control your home from anywhere.

If you have any questions, feel free to reach out in the comments or join my webinar.

Thank you for reading, and happy automating!


If you want to read something else, check this link here.


3 Comments

Garnet · 13/07/2024 at 2:29 am

That was very helpful to see how all those pieces fit together. Thanks!

    KIril Peyanski · 13/07/2024 at 7:05 am

    Glad to hear that Garnet. That is the whole point 🙂 Enjoy!

Robert · 15/07/2024 at 9:17 pm

Hello, do you have a way for an automation to do something if is not getting an answer. I try to send a message when my door is open and AC is on to turn off the ac or to skip it for 5 min, but if i don’t answer to close it in “x” minute. thank you for response

Leave a Reply

Avatar placeholder

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