diff --git a/README.md b/README.md index 352b4ec..2023bf2 100644 --- a/README.md +++ b/README.md @@ -418,6 +418,8 @@ Each item in the `added_assets` list contains the following fields: | `description` | Description/caption of the asset (from EXIF data) | | `is_favorite` | Whether the asset is marked as favorite (`true` or `false`) | | `rating` | User rating of the asset (1-5 stars, or `null` if not rated) | +| `latitude` | GPS latitude coordinate (or `null` if no geolocation) | +| `longitude` | GPS longitude coordinate (or `null` if no geolocation) | | `url` | Public URL to view the asset (only present if album has a shared link) | | `download_url` | Direct download URL for the original file (if shared link exists) | | `playback_url` | Video playback URL (for VIDEO assets only, if shared link exists) | diff --git a/custom_components/immich_album_watcher/const.py b/custom_components/immich_album_watcher/const.py index df01808..cb73c77 100644 --- a/custom_components/immich_album_watcher/const.py +++ b/custom_components/immich_album_watcher/const.py @@ -68,6 +68,8 @@ ATTR_ASSET_PLAYBACK_URL: Final = "playback_url" ATTR_ASSET_DESCRIPTION: Final = "description" ATTR_ASSET_IS_FAVORITE: Final = "is_favorite" ATTR_ASSET_RATING: Final = "rating" +ATTR_ASSET_LATITUDE: Final = "latitude" +ATTR_ASSET_LONGITUDE: Final = "longitude" # Asset types ASSET_TYPE_IMAGE: Final = "IMAGE" diff --git a/custom_components/immich_album_watcher/coordinator.py b/custom_components/immich_album_watcher/coordinator.py index c41ca9b..0932c4f 100644 --- a/custom_components/immich_album_watcher/coordinator.py +++ b/custom_components/immich_album_watcher/coordinator.py @@ -29,6 +29,8 @@ from .const import ( ATTR_ASSET_DOWNLOAD_URL, ATTR_ASSET_FILENAME, ATTR_ASSET_IS_FAVORITE, + ATTR_ASSET_LATITUDE, + ATTR_ASSET_LONGITUDE, ATTR_ASSET_OWNER, ATTR_ASSET_OWNER_ID, ATTR_ASSET_PLAYBACK_URL, @@ -120,6 +122,8 @@ class AssetInfo: people: list[str] = field(default_factory=list) is_favorite: bool = False rating: int | None = None + latitude: float | None = None + longitude: float | None = None is_processed: bool = True # Whether asset is fully processed by Immich @classmethod @@ -147,6 +151,10 @@ class AssetInfo: is_favorite = data.get("isFavorite", False) rating = exif_info.get("rating") if exif_info else None + # Get geolocation + latitude = exif_info.get("latitude") if exif_info else None + longitude = exif_info.get("longitude") if exif_info else None + # Check if asset is fully processed by Immich asset_type = data.get("type", ASSET_TYPE_IMAGE) is_processed = cls._check_processing_status(data, asset_type) @@ -162,6 +170,8 @@ class AssetInfo: people=people, is_favorite=is_favorite, rating=rating, + latitude=latitude, + longitude=longitude, is_processed=is_processed, ) @@ -648,6 +658,8 @@ class ImmichAlbumWatcherCoordinator(DataUpdateCoordinator[AlbumData | None]): ATTR_PEOPLE: asset.people, ATTR_ASSET_IS_FAVORITE: asset.is_favorite, ATTR_ASSET_RATING: asset.rating, + ATTR_ASSET_LATITUDE: asset.latitude, + ATTR_ASSET_LONGITUDE: asset.longitude, } # Add thumbnail URL if requested diff --git a/custom_components/immich_album_watcher/manifest.json b/custom_components/immich_album_watcher/manifest.json index f902de4..2ce874c 100644 --- a/custom_components/immich_album_watcher/manifest.json +++ b/custom_components/immich_album_watcher/manifest.json @@ -8,5 +8,5 @@ "iot_class": "cloud_polling", "issue_tracker": "https://github.com/DolgolyovAlexei/haos-hacs-immich-album-watcher/issues", "requirements": [], - "version": "2.2.1" + "version": "2.3.0" }