Verisure Improve Unpack (#98696)
parent
e484066f2b
commit
614904512c
|
@ -83,17 +83,15 @@ class VerisureDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
raise UpdateFailed("Could not read overview") from err
|
||||
|
||||
def unpack(overview: list, value: str) -> dict | list:
|
||||
return (
|
||||
next(
|
||||
unpacked: dict | list | None = next(
|
||||
(
|
||||
item["data"]["installation"][value]
|
||||
for item in overview
|
||||
if value in item.get("data", {}).get("installation", {})
|
||||
),
|
||||
[],
|
||||
)
|
||||
or []
|
||||
None,
|
||||
)
|
||||
return unpacked or []
|
||||
|
||||
# Store data in a way Home Assistant can easily consume it
|
||||
self._overview = overview
|
||||
|
|
Loading…
Reference in New Issue