Verisure unpack (#98605)

This commit is contained in:
Niels Perfors
2023-08-18 10:26:01 +02:00
committed by GitHub
parent d3ee2366b0
commit 89705a22cf

View File

@@ -83,7 +83,8 @@ class VerisureDataUpdateCoordinator(DataUpdateCoordinator):
raise UpdateFailed("Could not read overview") from err
def unpack(overview: list, value: str) -> dict | list:
return next(
return (
next(
(
item["data"]["installation"][value]
for item in overview
@@ -91,6 +92,8 @@ class VerisureDataUpdateCoordinator(DataUpdateCoordinator):
),
[],
)
or []
)
# Store data in a way Home Assistant can easily consume it
self._overview = overview