owm.py: check for w['rain']['3h']
[chrisu/seepark.git] / owm.py
diff --git a/owm.py b/owm.py
index 74fe6c48e2e0fdb30eaa8e3c4aa3a478d0543281..d97d57ec7989dc64a92ad07f0eeade6fe4ab6e28 100755 (executable)
--- a/owm.py
+++ b/owm.py
@@ -52,7 +52,7 @@ def extractweatherdata(w):
 
     data['winddegrees'] = w['wind']['deg'] if 'deg' in w['wind'] else math.nan
     data['winddirection'] = degToCompass(data['winddegrees'])
-    data['precipitation'] = w['rain']['3h'] if 'rain' in w else math.nan
+    data['precipitation'] = w['rain']['3h'] if 'rain' in w and w['rain'].get('3h') else math.nan
     data['visibility'] = w.get('visibility', math.nan)
 
     return data