Error handling on state

This commit is contained in:
Teagan M. Glenn 2016-08-17 22:30:23 -06:00
parent ecb4eb843b
commit dd14f90afb

View File

@ -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):