mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 14:27:07 +00:00
Error handling on state
This commit is contained in:
parent
ecb4eb843b
commit
dd14f90afb
@ -103,8 +103,10 @@ class WUndergroundSensor(Entity):
|
|||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
"""Return the state of the sensor."""
|
"""Return the state of the sensor."""
|
||||||
value = self.rest.data
|
if self.rest.data and self._condition in self.rest.data:
|
||||||
return value[str(self._condition)]
|
return self.rest.data[self._condition]
|
||||||
|
else:
|
||||||
|
return STATE_UNKNOWN
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def entity_picture(self):
|
def entity_picture(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user