diff --git a/openweathermap/README.md b/openweathermap/README.md index c7f9904..846cba2 100644 --- a/openweathermap/README.md +++ b/openweathermap/README.md @@ -48,6 +48,7 @@ Current conditions will return - **windspeed** - the current wind speed at the location in metres per second. - **winddirection** - the current wind direction at the location in meteorological degrees. - **location** - the name of the location from which the data was sourced. + - **rain** - the precipitation amount in mm/h (only present if it is raining). 5 day Forecast will return a 5 part array, each with diff --git a/openweathermap/weather.js b/openweathermap/weather.js index d88f913..e18c0b6 100644 --- a/openweathermap/weather.js +++ b/openweathermap/weather.js @@ -109,6 +109,7 @@ module.exports = function(RED) { msg.payload.sunrise = jsun.sys.sunrise; msg.payload.sunset = jsun.sys.sunset; msg.payload.clouds = jsun.clouds.all; + if (jsun.hasOwnProperty("rain")) { msg.payload.rain = jsun.rain["1h"]; } if (jsun.hasOwnProperty("coord")) { msg.location.lon = jsun.coord.lon; msg.location.lat = jsun.coord.lat;