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