Notifications are an important part of any home automation setup. There’s no point in having sensors and cameras monitoring your home while you’re out if there’s no way of being alerted when something happens.
In the absence of a native Android app, I’d been using Pushover to send notifications from Home Assistant to my phone. With the Android app I now have an alternative. I’ve already replaced Owntracks with the Home Assistant app for my location tracking. Can I do the same for notifications?
Pushover isn’t free but you can try the app for 7 days, after which it costs $4.99. That’s a one-time purchase, so there are no ongoing fees. The HA app is free. Both have limits on the number of notifications you can send, but you’re very unlikely to hit them – 7500 per month for Pushover and 300 per day for Home Assistant.
Both apps do the basics equally well, but differ when it comes to the more advanced features.
The HA app supports actionable notifications. These allow you to configure actions relevant to the notification so that you can quickly respond without having to go into the app.
You can see actionable notifications in many Android apps. For example, TodoIst has a quick action to complete a task when you get a reminder:
Actions in the HA app are sent back to your Home Assistant instance as events. The events can then be used as triggers for automations.
First of all, you need to set up the actions in a service call as part of the automation that triggers the notification:
The resulting notification will appear as:
You can then catch the response by setting up another automation triggered by the event for each action:
The HA app also supports persistent notifications. Persistent notifications can’t be swiped away, but can be updated or cleared by the sending application – the media controls for music apps are examples of persistent notifications.
For example, to have a persistent notification when Home Assistant thinks you’re not at home, you can set up two automations to create and clear the notification. I’ll show the YAML code here for brevity, but these were set up through the UI:
- id: '1603616722574' alias: Persistent notification on description: 'Create notification when leaving home' trigger: - platform: state entity_id: person.sean to: not_home condition:  action: - service: notify.mobile_app_sean_s20 data: title: Home Assistant message: You're not home data: persistent: true tag: persistent mode: single - id: '1603616917525' alias: Persistent notification off description: 'Clear notification when getting home' trigger: - platform: state entity_id: person.sean to: home condition:  action: - service: notify.mobile_app_sean_s20 data: message: clear_notification data: tag: persistent mode: single
On the face it of it then, Home Assistant looks like a clear winner. Actionable notifications are particularly useful, and I can see a lot of potential for using persistent notifications as a simple status view.
There is one area where Pushover may still have the edge. Both Pushover and the HA app support attachments to allow you to attach audio, video or image files to notifications. I described how I set them up for my Zoneminder notifications in a previous post.
Pushover sends local files as attachments. That’s why I had to go through two steps to send the attachment – first of all to download it from the URL of the camera, and then, once the download finished, to send the actual notification. Direct URLs are not supported:
“Attachment files must be directly sent to our API with your other message parameters and cannot be included as a URL or other parameter that would instruct our servers or the device clients to download the file. This is done for efficiency and for the privacy of our users to avoid making requests to non-Pushover URLs without their knowledge.”
The HA app works the other way around. Direct attachments are not supported but URLs are, as long as the URL is internet accessible:
“It is important to note that the attachments are required to be accessible from the internet. If you plan to use camera.snapshot, you will want to store the image in the www folder located in your Home Assistant config directory. This will then expose the image to the internet so that you may use it in your notifications and receive them anywhere.”
The problem is that the Home Assistant www directory is exposed to the internet without authentication. If you copy images to that directory for use in notifications, those images are available to anyone who knows, or guesses, the URL.
Is that a problem in practice? How easy is it to guess the URL?
If you’re using Home Assistant cloud for remote access to your instance, it’s not much of a problem. Your URL for HA cloud contains a long string of random letters, which helps to make the URL harder to guess.
Even if you expose your own instance to the internet, an attacker would still need to guess both the URL of the subdomain of the dynamic DNS service that you use and the filename. You could include a timestamp with the filename to make it harder to guess, or you could even, with a bit more work, generate a long random string to use as the filename. It’s perfectly possible to make it more secure.
You’d also need to include a tidy up step to remove the file. With a Pushover attachment, that’s easy enough to do once the notification is sent as you’d no longer need the file at that point – I used a shell command. With the HA app, it’s a bit more complicated as the file would have to remain until the notification has been seen – you’d probably need an automation that responds to the notification being cleared, which is a beta feature only available in the Android version of the app. You could also use an actionable notification with an explicit “clear” option as one of the actions.
The other advantage of using Pushover for image notifications is that it keeps a configurable number of old notifications. If you clear a notification by mistake it’s easy to refer to back to it by going in to the Pushover app.
Finally, Pushover has another advantage if Home Assistant isn’t the only thing you run at home. The Pushover API is really easy to use and the knowledge base has examples for most of the major programming languages – you can even use a simple command line curl statement to send a notification:
curl -s \ --form-string "token=APP_TOKEN" \ --form-string "user=USER_KEY" \ --form-string "message=hello world" \ https://api.pushover.net/1/messages.json
The HA app has replaced Owntracks for my location tracking, as it clearly worked better and the things that were slightly better in Owntracks weren’t compelling enough to keep it. With location tracking it was more important to pick just one, due to the battery overhead of having multiple apps reporting location.
For notifications, it’s less clearcut and the answer, for me, is to use both Pushover and the HA app. I’ll use the HA app most of the time and explore uses for persistent and actionable notifications. I’ll keep using Pushover for image notifications and as a handy tool for other projects.in Mobile