From 685bee785d21c9ca89033625230ffefccf6cc2d8 Mon Sep 17 00:00:00 2001 From: Pierre Kisters Date: Sun, 4 Jul 2021 19:37:38 +0200 Subject: [PATCH] add rain to openweathermap (#282) * add rain to openweathermap * document rain field to openweathermap/README.md --- openweathermap/README.md | 1 + openweathermap/weather.js | 1 + 2 files changed, 2 insertions(+) diff --git a/openweathermap/README.md b/openweathermap/README.md index c7f9904a..846cba2a 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 d88f9133..e18c0b6a 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;