From d7d71c97e2c167471bb4e70f5b4f209af29399af Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 5 Nov 2016 09:15:59 +0100 Subject: [PATCH] Make the wind details more robust (weather.openweathermap) (#4215) * Make the wind details more robust * Return None if values is not available --- homeassistant/components/weather/openweathermap.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/weather/openweathermap.py b/homeassistant/components/weather/openweathermap.py index f8f7e2f3747..b029b4d44bb 100644 --- a/homeassistant/components/weather/openweathermap.py +++ b/homeassistant/components/weather/openweathermap.py @@ -98,7 +98,7 @@ class OpenWeatherMapWeather(WeatherEntity): @property def temperature(self): """Return the temperature.""" - return self.data.get_temperature('celsius')['temp'] + return self.data.get_temperature('celsius').get('temp') @property def temperature_unit(self): @@ -108,7 +108,7 @@ class OpenWeatherMapWeather(WeatherEntity): @property def pressure(self): """Return the pressure.""" - return self.data.get_pressure()['press'] + return self.data.get_pressure().get('press') @property def humidity(self): @@ -118,12 +118,12 @@ class OpenWeatherMapWeather(WeatherEntity): @property def wind_speed(self): """Return the wind speed.""" - return self.data.get_wind()['speed'] + return self.data.get_wind().get('speed') @property def wind_bearing(self): """Return the wind bearing.""" - return self.data.get_wind()['deg'] + return self.data.get_wind().get('deg') @property def attribution(self):