#Check the result of an automation?

1 messages · Page 1 of 1 (latest)

lament cargo
#

I have an automation that reboots my Sony TV everyday. Sometimes it works and other times it doesn't. How can I check if the automation ran successfully and send a notification of pass or fail? I know how to do the notification part, its the checking the result part that I am having trouble with. Any help would be great, thank you.

kind kindle
#

How do you know if it rebooted or not? Could you see that with one of the sensors it has?

rocky finch
#

In the HA UI on the screen where you edit your automation you should see a link to 'Traces' at the top right (next to the three dots). Click that and it should show you the details of the last time the automation run - there should be a drop down that will allow you to see previous runs.

lament cargo
lament cargo
rocky finch
#

You should add a Notification action to your automation.

lament cargo
#

So if i add that notification will it only fire if it completes successfully?

#

Well I just tested it and the automation failed, but I still got the notification of it completed. Is there a way to have it fire only if it succeeds?

rocky finch
#

Why did the automation fail?

#

can you share a trace?

lament cargo
#

This was in the log:

Logger: homeassistant.components.braviatv.coordinator
Source: components/braviatv/coordinator.py:60
integration: Sony Bravia TV (documentation, issues)
First occurred: 2:00:20 AM (1 occurrence)
Last logged: 2:00:20 AM

Command error:

#

There was no command error, it is blank. the other steps said it finished properly

#

Looking at the trace timeline all the automations for the past week ran and finished at the appropriate time, but but some days had errors. I dont see the errores in the traces though

rocky finch
#

The action to reboot the TV completed and hence the automation ran correctly. You need to figure out a way to detect if the action to reboot the TV errored

lament cargo
#

Ah ok. I think I see it. I think when the "Press Sony XR-55A80J Restart button (button.sony_xr_55a80j_restart)" part happens, that one throws the error, but then the automation continues, waiting for the delay to pass then turns off the tv so it appears to "complete".

I'm pretty new to HA but I want to learn, could you point me in the right direction on how to detect and deal with the error?

rocky finch
#

I don't use a Bravia TV and hence don't use the integration, so not sure what entities are available. It may be possible for you to have a separate automation that just notifies you every time the TV is restarted. You wouldn't use the notify in the restart automation, so if it doesn't restart you won't get the notification from the other automation hence you would know it failed.