Add an indicator when an automation has stopped due to an error

have an indicator in the automation list that shows an error was registered in the last run of the Automation.

perhaps re-purpose the disabled indicator to error if one occurs?

or perhaps a additional column of “Last Result”

The error shown in your screenshot will be logged. Therefore it will appear in the Logs page.

In other words, the Logs page already displays errors produced by automations (and other things). The error’s details are displayed and how often it has occurred. That’s far more informative and actionable than a mere indicator.

Here’s the funny thing… I closed that automation to post the feature request and now I have no Idea which automation it was in and I am not sure I ever saw any Log message for it… a simple little indicator in the automation list would actually help me find it again… also do you have the anything special set in the logger section of your config to catch those ?

I also sometimes get error messages that do not indicate from whence it came (or at least clearly)
like:

Logger: homeassistant.helpers.template
Source: helpers/template.py:157
First occurred: 4:18:07 AM (10 occurrences)
Last logged: 11:15:04 AM

* Template variable warning: 'dict object' has no attribute 'flip_degrees' when rendering '{{ trigger.event.data.args.flip_degrees }}'
* Template variable warning: 'dict object' has no attribute 'relative_degrees' when rendering '{{ trigger.event.data.args.relative_degrees }}'

i have been trying to find these for some time… is it a template in a trigger?? I can not seem to find where its coming from.

The error messages, shown in your recent post, refer to templates that contain the trigger variable.

There are two things in Home Assistant that support triggers:

  1. Automations
  2. Trigger-based Template entities (Sensors, Binary Sensors, etc)

Therefore ask yourself in which automation or Trigger-based Template Sensor did you create that deals with flip_degrees and relative_degrees?

If an error occurs in an automation, notably like the one in your screenshot, it will be logged. It will appear in Logs unless you clear the view but then you can still see it if you click the Load Full Logs button. It will be purged from the Logs view after you restart Home Assistant.

Well Thank you for the Advice… I have dug through all the files in the config folder… automation.yaml, sensors.yaml, all the files in my packages folder… I simply cannot find it…

I have asked myself that… and myself answered “I don’t know” … :slight_smile:

By the looks of that template… I doubt I wrote that…

The error message reported a problem with a Jinja2 template containing a reference to the trigger variable. Home Assistant’s source code is all python so that template is part of your configuration.

Use a text editor like Visual Studio Code that can quickly search all files in all sub-directories for a given string.

The error message can also be due to something you may have been testing in the Template Editor (although a template referencing the trigger variable can’t really be tested properly within the Template Editor so it’s probably not there).

Well Something I said in my last reply made me think of something

“I doubt I wrote that”

Turns out its in a Blueprint that I used for the Aqara Cube… so I didn’t write it…

The Trigger listens for a ZHA Event and trigger the process … the errors are when it tries to set variables that do not exist when the device issues a “wake” command… ultimately the error means nothing because the automation chooses the default choice which has no action

and an indicator in the automation’s list would not have helped since the automation had no “error”

but that is not to say an indicator would not be helpful or should not be added … I am sure not everyone sits and scans their entire logs continuously till the find a problem… I have entities that get deleted and added back and are not the same entity id that was in the automation in the first place… so it could be a quicker way back to having a functioning automation certainly for newer HA Users.

Blueprints are designed to create automations or scripts. When you used the blueprint you downloaded, you created an automation. Whether you were aware of it or not, the resulting automation contained an error.

The same people wouldn’t sit and scan the Automations page continuously till they find a problem …

The Logs page reports errors occuring throughout Home Assistant. It’s where one should occasionally look to detect problems. That’s its purpose.

You could even create an automation that triggers on automation errors and creates a notification.