node-red-node-openweathermap
Advanced tools
Comparing version 0.1.13 to 0.1.14
{ | ||
"name" : "node-red-node-openweathermap", | ||
"version" : "0.1.13", | ||
"version" : "0.1.14", | ||
"description" : "A Node-RED node that gets the weather report from openweathermap", | ||
@@ -5,0 +5,0 @@ "dependencies" : { |
@@ -25,3 +25,4 @@ /** | ||
node.city = city; | ||
} else if (lat && lon) { | ||
} | ||
else if (lat && lon) { | ||
if (90 >= lat && lat >= -90) { | ||
@@ -39,3 +40,3 @@ node.lat = lat; | ||
} | ||
} | ||
} | ||
node.language = language || "en"; | ||
@@ -90,4 +91,4 @@ callback(); | ||
if (jsun) { | ||
msg.data = jsun; | ||
if (jsun.hasOwnProperty("weather") && jsun.hasOwnProperty("main")) { | ||
msg.data = jsun; | ||
msg.payload.weather = jsun.weather[0].main; | ||
@@ -108,4 +109,6 @@ msg.payload.detail = jsun.weather[0].description; | ||
msg.payload.clouds = jsun.clouds.all; | ||
msg.location.lon = jsun.coord.lon; | ||
msg.location.lat = jsun.coord.lat; | ||
if (jsun.hasOwnProperty("coord")) { | ||
msg.location.lon = jsun.coord.lon; | ||
msg.location.lat = jsun.coord.lat; | ||
} | ||
msg.location.city = jsun.name; | ||
@@ -119,8 +122,11 @@ msg.location.country = jsun.sys.country; | ||
} else if (jsun.hasOwnProperty("list")) { | ||
msg.location.lon = jsun.city.coord.lon; | ||
msg.location.lat = jsun.city.coord.lat; | ||
msg.location.city = jsun.city.name; | ||
msg.location.country = jsun.city.country; | ||
msg.payload = jsun.list; | ||
msg.data = jsun; | ||
if (jsun.hasOwnProperty("city")) { | ||
msg.location.city = jsun.city.name; | ||
msg.location.country = jsun.city.country; | ||
if (jsun.city.hasOwnProperty("coord")) { | ||
msg.location.lat = jsun.city.coord.lat; | ||
msg.location.lon = jsun.city.coord.lon; | ||
} | ||
} | ||
msg.title = RED._("weather.message.forecast"); | ||
@@ -127,0 +133,0 @@ callback(); |
49300
302