Remove obsolete check from Proximity (#109701)

pull/109737/head
Joost Lekkerkerker 2024-02-05 16:32:39 +01:00 committed by GitHub
parent aaff8a8c62
commit 8df305c881
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 5 deletions

View File

@ -176,18 +176,19 @@ class ProximityTrackedEntitySensor(
) )
@property @property
def data(self) -> dict[str, str | int | None] | None: def data(self) -> dict[str, str | int | None]:
"""Get data from coordinator.""" """Get data from coordinator."""
return self.coordinator.data.entities.get(self.tracked_entity_id) return self.coordinator.data.entities[self.tracked_entity_id]
@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.data is not None return (
super().available
and self.tracked_entity_id in self.coordinator.data.entities
)
@property @property
def native_value(self) -> str | float | None: def native_value(self) -> str | float | None:
"""Return native sensor value.""" """Return native sensor value."""
if self.data is None:
return None
return self.data.get(self.entity_description.key) return self.data.get(self.entity_description.key)