From 4e586c18ff4bf51401083a5b0dcec80efaabb864 Mon Sep 17 00:00:00 2001 From: "Teagan M. Glenn" Date: Wed, 17 Aug 2016 22:32:42 -0600 Subject: [PATCH] Check for error and pull obvservation --- homeassistant/components/sensor/wunderground.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/sensor/wunderground.py b/homeassistant/components/sensor/wunderground.py index 8dc3038cadb..979bff40a89 100644 --- a/homeassistant/components/sensor/wunderground.py +++ b/homeassistant/components/sensor/wunderground.py @@ -153,9 +153,11 @@ class WUndergroundData(object): """Get the latest data from wunderground.""" try: result = requests.get(self._build_url(), timeout=10).json() + if "error" in result['response']: + raise ValueError(result['response']["error"] ["description"]) else: - self.data = result.json()["current_observation"] + self.data = result["current_observation"] except ValueError as err: _LOGGER.error("Check Wunderground API %s", err.args) self.data = None