Merge pull request #945 from zmrow/fix-exception-in-openweather

Fix #863 - Added a check for good pull from OWM and return if the object is None
This commit is contained in:
Paulus Schoutsen 2016-01-20 19:57:57 -08:00
commit 66d23cd15f

View File

@ -165,6 +165,10 @@ class WeatherData(object):
def update(self):
""" Gets the latest data from OpenWeatherMap. """
obs = self.owm.weather_at_coords(self.latitude, self.longitude)
if obs is None:
_LOGGER.warning('Failed to fetch data from OWM')
return
self.data = obs.get_weather()
if self.forecast == 1: