* Fix TypeError on round(self.humidity) Some weather platforms postpone the first data fetch for a while on init. As a result round(self.humidity is called before it is assigned a value, producing an error. This is a fix for that. * Rewrite to avoid false negative evaluation As per the suggestion from @OttoWinter, rewrite to avoid matching e.g. 0.0 as false.
This commit is contained in:
parent
eceece866d
commit
6e0a3abf66
1 changed files with 4 additions and 1 deletions
|
@ -113,9 +113,12 @@ class WeatherEntity(Entity):
|
|||
ATTR_WEATHER_TEMPERATURE: show_temp(
|
||||
self.hass, self.temperature, self.temperature_unit,
|
||||
self.precision),
|
||||
ATTR_WEATHER_HUMIDITY: round(self.humidity)
|
||||
}
|
||||
|
||||
humidity = self.humidity
|
||||
if humidity is not None:
|
||||
data[ATTR_WEATHER_HUMIDITY] = round(humidity)
|
||||
|
||||
ozone = self.ozone
|
||||
if ozone is not None:
|
||||
data[ATTR_WEATHER_OZONE] = ozone
|
||||
|
|
Loading…
Add table
Reference in a new issue