Disclaimer: This tutorial will use Pulsetray, a tool I've developed myself.
Introduction
If you use Home Assistant, you probably send notifications to your phone using the Companion App. It's great for letting you know when a door opens or a camera sees motion, but it has one problem I hated: There's no notifications tray.
While the Companion App notifications are highly customizable, they don't get stored anywhere. Once you dismiss an alert from your phone, it's gone forever.
I wanted a persistent searchable history of notifications, so I built a tool to fix it. This tutorial will show you how to setup an Android app to centralize your Home Assistant notifications, along with categories, rich media and a permanent history. You can even extend this to other platforms you'd like to monitor, like GitHub, UniFi Protect, and more.
Let's dive in!
1. Install and configure Pulsetray
First, we need to set up the app to receive alerts.
- Download the Pulsetray app from the Play Store and complete the sign up process.
- Navigate to Settings > API keys > Add API key
- Enter a name and click on Add key.
- Copy the generated Token immediately. You will use this token to authorize POST requests from Home Assistant, and this is the only time it'll be visible.
With the app being all set, let's move onto Home Assistant.
2. Setup a rest_command in Home Assistant
Next, we need to prepare Home Assistant to allow it to talk to Pulsetray. We will do this by creating a rest_command in your configuration.yaml file, which allows Home Assistant to send HTTP requests to external APIs.
- Open your
configuration.yamlfile (you can use the File Editor add-on). - Append the YAML block shown below to the end of the file.
- Replace
YOUR_TOKENwith the API token you copied in the previous step.
rest_command:
pulsetray:
url: "https://api.pulsetray.com/v1/notifications"
method: post
content_type: "application/json"
headers:
Authorization: "Bearer YOUR_TOKEN"
payload: "{{ json_body | to_json }}"
The payload: "{{ json_body | to_json }}" line allows us to define the specific contents of the notification later when we create our automation.
Save the file and restart your Home Assistant instance to apply the changes.
3. Create the automation
Once Home Assistant reboots, we can set up the actual trigger. For this example, I'll configure an alert that fires when my Samsung fridge door has been left open for more than 30 seconds.
In Home Assistant, go to Settings > Automations & scenes > + Create automation > Create new automation.
The trigger (When)
- Click on + Add trigger
- Select Device and choose your specific device (e.g. Fridge)
- Select the trigger action (e.g. Fridge door opened) and set the duration to 30 seconds.
The action (Then do)
- Click on +Add action
- Search for and select RESTful Command: pulsetray
- Click the three dots in the corner of the action and select Edit in YAML
- Paste the following YAML code to define your notification payload:
action: rest_command.pulsetray
metadata: {}
data:
json_body:
title: Fridge door is open
body: Fridge door has been open for more than 30 seconds
androidConfig:
priority: high
Done! You can now save the automation. To test the action, click the three dots at the top of the automation and select Run actions. You should receive a notification to your phone instantly.
Bonus! Organizing with Categories
Centralizing notifications is great, but a flat list can get messy really quickly. To separate and filter our alerts, we'll use sources and categories.
- In the Pulsetray app, go to Settings > Sources and categories
- Click + Add source. Set the code to
home-assistant, and the name toHome Assistant. Save it. - In the source you've just created, click on + Add category. Set the code to
fridgeand the name toFridge. Save it.
Now, go back to your Home Assistant automation and update your YAML action to include the new codes we've created:
action: rest_command.pulsetray
metadata: {}
data:
json_body:
title: Fridge door is open
body: Fridge door has been open for more than 30 seconds
source: home-assistant
category: fridge
androidConfig:
priority: high
Save the automation, and you're good to go! You'll now be able to filter and separate your notifications at a glance.
Wrapping up
I built this tool to solve a problem I had, and I hope more people find it useful. You can integrate it with any service that supports POST requests or webhooks, like Vercel, GitHub or UniFi Protect.
To find more usages and customization, you can take a look at the docs.
If you have any questions or suggestions please let me know!






Top comments (0)