Handle CO2Signal response value being None (#54377)

This commit is contained in:
Paulus Schoutsen 2021-08-09 23:17:47 -07:00
parent 747eb92a4a
commit 3effe94a27

View File

@ -118,7 +118,8 @@ class CO2Sensor(update_coordinator.CoordinatorEntity[CO2SignalResponse], SensorE
def available(self) -> bool: def available(self) -> bool:
"""Return True if entity is available.""" """Return True if entity is available."""
return ( return (
super().available and self._description.key in self.coordinator.data["data"] super().available
and self.coordinator.data["data"].get(self._description.key) is not None
) )
@property @property