Handle CO2Signal response value being None (#54377)

This commit is contained in:
Paulus Schoutsen 2021-08-09 23:17:47 -07:00 committed by GitHub
parent 3202d4882a
commit 934662cd54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -118,7 +118,8 @@ class CO2Sensor(update_coordinator.CoordinatorEntity[CO2SignalResponse], SensorE
def available(self) -> bool:
"""Return True if entity is available."""
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