Add album metadata attributes to Album ID sensor
All checks were successful
Validate / Hassfest (push) Successful in 4s

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 <noreply@anthropic.com>
This commit is contained in:
2026-02-02 00:20:38 +03:00
parent 1d61f05552
commit df446390f2
2 changed files with 6 additions and 2 deletions

View File

@@ -106,7 +106,7 @@ If no external domain is configured in Immich, all URLs will use the Server URL
| Entity Type | Name | Description | | 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 | Asset Count | Total number of assets (includes `people` list in attributes) |
| Sensor | Photo Count | Number of photos in the album | | Sensor | Photo Count | Number of photos in the album |
| Sensor | Video Count | Number of videos in the album | | Sensor | Video Count | Number of videos in the album |

View File

@@ -24,6 +24,7 @@ from homeassistant.util import slugify
from .const import ( from .const import (
ATTR_ALBUM_ID, ATTR_ALBUM_ID,
ATTR_ALBUM_NAME,
ATTR_ALBUM_PROTECTED_URL, ATTR_ALBUM_PROTECTED_URL,
ATTR_ALBUM_URLS, ATTR_ALBUM_URLS,
ATTR_ASSET_COUNT, ATTR_ASSET_COUNT,
@@ -1211,7 +1212,10 @@ class ImmichAlbumIdSensor(ImmichAlbumBaseSensor):
return {} return {}
attrs: dict[str, Any] = { 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) # Primary share URL (prefers public, falls back to protected)