Plugwise: implement device availability for non-legacy devices (#80191)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Bouwe Westerdijk 2022-10-13 09:24:14 +02:00 committed by GitHub
parent ea6368775b
commit 937aa286b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,7 +65,11 @@ class PlugwiseEntity(CoordinatorEntity[PlugwiseDataUpdateCoordinator]):
@property @property
def available(self) -> bool: def available(self) -> bool:
"""Return if entity is available.""" """Return if entity is available."""
return super().available and self._dev_id in self.coordinator.data.devices return (
self._dev_id in self.coordinator.data.devices
and ("available" not in self.device or self.device["available"])
and super().available
)
@property @property
def device(self) -> dict[str, Any]: def device(self) -> dict[str, Any]: