Persistent Android notification history for Home Assistant, with a Lovelace card to browse it.
A Home Assistant custom component that listens to the notification sensor exposed by the Home Assistant Companion app on Android and keeps a persistent, on-disk history of every notification it sees — so the log survives Home Assistant restarts. A bundled Lovelace card lets you browse recent notifications straight from your dashboard.
- What it does
- Requirements
- Installation
- Configuration
- Lovelace card
- Sensor attributes
- How it works
- License
- Listens for state changes on an Android notification
sensorentity (theandroid.title/android.textattributes reported by the Companion app) - Persists the notification history to Home Assistant's storage (
.storage), so it is not lost on restart - Creates a sensor entity whose:
- state is the title or text of the most recent notification
- attributes are
history_count,last_notificationandnotifications
- Ships a Lovelace card (
custom:phone-notifications-card) that renders the history as a scrollable list
- A working Home Assistant instance
- The Home Assistant Companion app on the Android phone whose notifications you want to log,
with its notification sensor enabled (an entity such as
sensor.<phone>_active_notification_count)
- Add this repository to HACS as a custom Integration repository
- Install Phone Notifications Logger and restart Home Assistant
Copy the custom_components/phone_notifications_logger folder into your Home Assistant
config/custom_components/ directory, then restart Home Assistant.
Add a sensor platform entry to configuration.yaml:
sensor:
- platform: phone_notifications_logger
sensor_entity_id: sensor.samsung_s21_active_notification_count_2
name: "Phone Notifications"
max_history: 1000| Option | Required | Default | Description |
|---|---|---|---|
sensor_entity_id |
Yes | — | The phone's Android notification sensor to listen to |
name |
No | Phone Notifications |
Friendly name of the sensor created by this integration |
max_history |
No | 1000 |
Maximum number of notifications kept in history (oldest are trimmed first) |
Restart Home Assistant afterwards: a sensor entity (for example sensor.phone_notifications,
following the name you chose) is created and starts logging.
When installed through HACS, the card resource is served at:
/hacsfiles/phone_notifications_logger/phone_notifications_card.js
Add it as a resource (HACS registers it automatically for most setups) and then add a manual card to your dashboard:
type: custom:phone-notifications-card
entity: sensor.phone_notifications
max_items: 10
title: "Notification History"| Option | Description |
|---|---|
entity |
The sensor entity created by this integration |
max_items |
How many notifications to display |
title |
The card's title |
The card shows the last max_items notifications with timestamp, title and text.
| Attribute | Contents |
|---|---|
history_count |
Number of notifications currently stored |
last_notification |
The most recent notification, as { timestamp, title, text } |
notifications |
The full stored history |
The integration subscribes to state-change events on the configured sensor_entity_id using
Home Assistant's async_track_state_change_event helper. Every time the source sensor updates
and carries android.title or android.text attributes, a {timestamp, title, text} record is
appended to an in-memory list, the sensor's state is updated to the notification title (or text),
and the list is trimmed to max_history entries before being written to Home Assistant's
Store — a per-entity JSON file under .storage/. On startup the stored history is loaded back
so nothing is lost across restarts.
MIT © 2025 Antonio Di Stefano