mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 13:47:35 +00:00
Verisure Improve Unpack (#98696)
This commit is contained in:
parent
e484066f2b
commit
614904512c
@ -83,17 +83,15 @@ class VerisureDataUpdateCoordinator(DataUpdateCoordinator):
|
|||||||
raise UpdateFailed("Could not read overview") from err
|
raise UpdateFailed("Could not read overview") from err
|
||||||
|
|
||||||
def unpack(overview: list, value: str) -> dict | list:
|
def unpack(overview: list, value: str) -> dict | list:
|
||||||
return (
|
unpacked: dict | list | None = next(
|
||||||
next(
|
(
|
||||||
(
|
item["data"]["installation"][value]
|
||||||
item["data"]["installation"][value]
|
for item in overview
|
||||||
for item in overview
|
if value in item.get("data", {}).get("installation", {})
|
||||||
if value in item.get("data", {}).get("installation", {})
|
),
|
||||||
),
|
None,
|
||||||
[],
|
|
||||||
)
|
|
||||||
or []
|
|
||||||
)
|
)
|
||||||
|
return unpacked or []
|
||||||
|
|
||||||
# Store data in a way Home Assistant can easily consume it
|
# Store data in a way Home Assistant can easily consume it
|
||||||
self._overview = overview
|
self._overview = overview
|
||||||
|
Loading…
x
Reference in New Issue
Block a user