Remove units for humidity in Wundeground sensor (#3018)

* Remove units for humidity

Wunderground returns the information with the units.

* Trim the % from the return value of humidity
pull/3036/head
arsaboo 2016-08-28 23:05:28 -04:00 committed by Teagan Glenn
parent 1699885907
commit 39402aff2e
1 changed files with 4 additions and 1 deletions

View File

@ -101,7 +101,10 @@ class WUndergroundSensor(Entity):
def state(self):
"""Return the state of the sensor."""
if self.rest.data and self._condition in self.rest.data:
return self.rest.data[self._condition]
if self._condition == 'relative_humidity':
return int(self.rest.data[self._condition][:-1])
else:
return self.rest.data[self._condition]
else:
return STATE_UNKNOWN