From df446390f2128ff4681da25815e2d9ba7d54d507 Mon Sep 17 00:00:00 2001 From: "alexei.dolgolyov" Date: Mon, 2 Feb 2026 00:20:38 +0300 Subject: [PATCH] Add album metadata attributes to Album ID sensor Add asset_count, last_updated, and created_at attributes to the Album ID sensor for convenient access to album metadata. Co-Authored-By: Claude Opus 4.5 --- README.md | 2 +- custom_components/immich_album_watcher/sensor.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1c43f8a..70231b5 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ If no external domain is configured in Immich, all URLs will use the Server URL | Entity Type | Name | Description | |-------------|------|-------------| -| Sensor | Album ID | Album identifier with `album_name` and `share_url` attributes | +| Sensor | Album ID | Album identifier with `album_name`, `asset_count`, `share_url`, `last_updated`, and `created_at` attributes | | Sensor | Asset Count | Total number of assets (includes `people` list in attributes) | | Sensor | Photo Count | Number of photos in the album | | Sensor | Video Count | Number of videos in the album | diff --git a/custom_components/immich_album_watcher/sensor.py b/custom_components/immich_album_watcher/sensor.py index cab738e..d7ef735 100644 --- a/custom_components/immich_album_watcher/sensor.py +++ b/custom_components/immich_album_watcher/sensor.py @@ -24,6 +24,7 @@ from homeassistant.util import slugify from .const import ( ATTR_ALBUM_ID, + ATTR_ALBUM_NAME, ATTR_ALBUM_PROTECTED_URL, ATTR_ALBUM_URLS, ATTR_ASSET_COUNT, @@ -1211,7 +1212,10 @@ class ImmichAlbumIdSensor(ImmichAlbumBaseSensor): return {} attrs: dict[str, Any] = { - "album_name": self._album_data.name, + ATTR_ALBUM_NAME: self._album_data.name, + ATTR_ASSET_COUNT: self._album_data.asset_count, + ATTR_LAST_UPDATED: self._album_data.updated_at, + ATTR_CREATED_AT: self._album_data.created_at, } # Primary share URL (prefers public, falls back to protected)