Add get_assets filtering: offset, on_this_day, city, state, country
All checks were successful
Validate / Hassfest (push) Successful in 3s
All checks were successful
Validate / Hassfest (push) Successful in 3s
- Add offset parameter for pagination support - Add on_this_day parameter for memories filtering (match month and day) - Add city, state, country parameters for geolocation filtering - Update README with new parameters and examples Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -98,6 +98,9 @@ async def async_setup_entry(
|
||||
vol.Optional("limit", default=10): vol.All(
|
||||
vol.Coerce(int), vol.Range(min=1, max=100)
|
||||
),
|
||||
vol.Optional("offset", default=0): vol.All(
|
||||
vol.Coerce(int), vol.Range(min=0)
|
||||
),
|
||||
vol.Optional("favorite_only", default=False): bool,
|
||||
vol.Optional("filter_min_rating", default=1): vol.All(
|
||||
vol.Coerce(int), vol.Range(min=1, max=5)
|
||||
@@ -111,6 +114,10 @@ async def async_setup_entry(
|
||||
vol.Optional("asset_type", default="all"): vol.In(["all", "photo", "video"]),
|
||||
vol.Optional("min_date"): str,
|
||||
vol.Optional("max_date"): str,
|
||||
vol.Optional("on_this_day"): str,
|
||||
vol.Optional("city"): str,
|
||||
vol.Optional("state"): str,
|
||||
vol.Optional("country"): str,
|
||||
},
|
||||
"async_get_assets",
|
||||
supports_response=SupportsResponse.ONLY,
|
||||
@@ -196,6 +203,7 @@ class ImmichAlbumBaseSensor(CoordinatorEntity[ImmichAlbumWatcherCoordinator], Se
|
||||
async def async_get_assets(
|
||||
self,
|
||||
limit: int = 10,
|
||||
offset: int = 0,
|
||||
favorite_only: bool = False,
|
||||
filter_min_rating: int = 1,
|
||||
order_by: str = "date",
|
||||
@@ -203,10 +211,15 @@ class ImmichAlbumBaseSensor(CoordinatorEntity[ImmichAlbumWatcherCoordinator], Se
|
||||
asset_type: str = "all",
|
||||
min_date: str | None = None,
|
||||
max_date: str | None = None,
|
||||
on_this_day: str | None = None,
|
||||
city: str | None = None,
|
||||
state: str | None = None,
|
||||
country: str | None = None,
|
||||
) -> ServiceResponse:
|
||||
"""Get assets for this album with optional filtering and ordering."""
|
||||
assets = await self.coordinator.async_get_assets(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
favorite_only=favorite_only,
|
||||
filter_min_rating=filter_min_rating,
|
||||
order_by=order_by,
|
||||
@@ -214,6 +227,10 @@ class ImmichAlbumBaseSensor(CoordinatorEntity[ImmichAlbumWatcherCoordinator], Se
|
||||
asset_type=asset_type,
|
||||
min_date=min_date,
|
||||
max_date=max_date,
|
||||
on_this_day=on_this_day,
|
||||
city=city,
|
||||
state=state,
|
||||
country=country,
|
||||
)
|
||||
return {"assets": assets}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user