Dealing With Being Distrusting of HomeAssistant Automations

HomeAssistant is something I'm sure everyone is aware of - an open source tool for managing your smart home devices. I have used it for a number of years, starting with a rough and ready setup on a Raspberry Pi 3B. Back then, I only had three smart light bulbs and essentially all I did was manually turn them on/off from my phone. Today, I have a slightly more elaborate setup, with lights, plugs, and sensors in almost every room of my house. The real power of Home Assistant however comes with the automations.

From having lights turn on a little dim before the morning alarm on my phone, to making sure all devices are off whenever there is nobody home, the depth of what you can do with automation is immense. However, there is one UX issue I have with these automations - I just don't quite trust them. Too many times I've come home and realized that my automation didn't realize I had left the house and never turned off my devices. Similar to alarms and logs in software development, automations are only worthwhile if they are reliable and you can trust them. I set out to find a way to increase my trust in the automations I have at home, and also have an easier path to debugging them if they don't run when I expected them to.

My solution was to have a simple notification on my phone whenever an automation runs on Home Assistant. The notification medium was obvious for my workflow/style - use ntfy.sh to trigger a notification on my phone so that whenever I was concerned if the automation ran or not, I would already have the information available in a zero click manner. I thought this might be a little difficult, but as it turns out, there is a built in Apprise notification service built into Home Assistant (which I think was a great idea!). My second issue was making sure that this notification would fire for all of my automations and that I wouldn't have to manually add it to each and every one. This turned out to be easier than expected, as there is an event you can trigger on called AUTOMATION_TRIGGERED which fires on every single automation run. The plan was set!

The first thing I had to do was add the Apprise integraion to my configuration.yaml for Home Assistant with the URLs I wanted to trigger notifications on: [1]

notify:
  - platform: apprise
    url: ntfy://ntfy.sh/home-assistant-notification-topic

After that, I created an automation that would trigger whenever an automation ran, and would then notify me with the name of the automation that ran:

Home Assistant UI screenshot showing the details of how to set up an automation to notify you whenever a different automation runs

That was the sum total of what I had to do! This has made me feel much more at ease and trusting of when my automations have run, and if they don't run when expected, I can easily debug what didn't happen when I expected it to. One interesting thing to note is that the automation that sends a notification doesn't end up triggering the automation to fire again. There is no recursive behavior from it. I hope this helps anyone looking to set up automations on Home Assistant using Apprise, ntfy.sh, or just trying to trigger an automation to run whenever a different automation runs! If you have any fun automations for Home Assistant, or any thoughts/comments, please let me know through whatever means you found this post, and thanks for reading!

[1] I self-host ntfy.sh so this URL is just a dummy! If you want another blog post on self-hosting ntfy.sh, let me know, but those docs are great and it's one of the most stable services I have ever ran.

Show Comments