This is an automated archive made by the Lemmit Bot.
The original was posted on /r/homeassistant by /u/SignedJannis on 2025-12-20 19:12:54+00:00.
Sometimes an automation or script fails.
Example: my central heating automation, that has been working fine for years, just started silently failing due to "ecobee suddenly having expired keys" for whatever reason. That could be very bad, given our harsh winters. I've seen other users post about losing e.g thousands of dollars of wild meat, because their freezer failed and their notify automation also failed them, etc.
If an automation fails, I want to know about it.
The following automation will notify you if another automation/script fails unexpectedly. I suggest using a few different notification options, in case one fails - and use "continue_on_error: true" on each notification - because you dont want a notification-service-failure halting your automation-failure notifications! :)
I personally use a gmail notification, tts on a google home, "speak message aloud via tts on phone", and of course home assistant phone app notifications. Below example has email only, add whatever you need.
Note: you will need the following two lines in your configuration.yaml
system_log:
fire_event: true
automation:
alias: Automation Fail Detector - Notify
description: Triggers whenever any automation fails
triggers:
- trigger: event
event_type: system_log_event
event_data:
level: ERROR
conditions:
- condition: template
value_template: >-
{{ 'automation' in trigger.event.data.name.lower() or 'script' in
trigger.event.data.name.lower() }}
actions:
- action: script.email_notification
continue_on_error: true
data:
emailsubject: "Automation Failed: {{ trigger.event.data.name }}"
emailbody: |-
An automation has failed!
Failed Component: {{ trigger.event.data.name }}
Error Message: {{ trigger.event.data.message }}
Source File: {{ trigger.event.data.source }}
Time: {{ now().strftime('%Y-%m-%d %H:%M:%S') }}
{% if trigger.event.data.exception != '' %}Exception Details:
{{ trigger.event.data.exception }}{% endif %}
mode: queued
max: 20