mirror of
https://github.com/home-assistant/core.git
synced 2025-08-05 13:45:12 +02:00
Make the wind details more robust (weather.openweathermap) (#4215)
* Make the wind details more robust * Return None if values is not available
This commit is contained in:
@@ -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):
|
||||
|
Reference in New Issue
Block a user