mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
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
@ -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…
x
Reference in New Issue
Block a user