Improve CO2Signal error handling (#53602)
* Improve CO2Signal error handling * Update homeassistant/components/co2signal/sensor.py Co-authored-by: Franck Nijhof <git@frenck.dev> Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
d865577187
commit
9c33818392
1 changed files with 7 additions and 0 deletions
|
@ -114,6 +114,13 @@ class CO2Sensor(update_coordinator.CoordinatorEntity[CO2SignalResponse], SensorE
|
|||
f"{coordinator.entry_id}_{description.unique_id or description.key}"
|
||||
)
|
||||
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
"""Return True if entity is available."""
|
||||
return (
|
||||
super().available and self._description.key in self.coordinator.data["data"]
|
||||
)
|
||||
|
||||
@property
|
||||
def state(self) -> StateType:
|
||||
"""Return sensor state."""
|
||||
|
|
Loading…
Add table
Reference in a new issue