From f1c4ca4376dda16d92a70d0086dca4480ceb22b8 Mon Sep 17 00:00:00 2001 From: FireWizard52 <46283323+FireWizard52@users.noreply.github.com> Date: Sun, 28 Apr 2024 14:57:48 +0200 Subject: [PATCH] Update weather.js from One Call API 2.5 to One Call API 3.0 (#312) --- openweathermap/weather.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openweathermap/weather.js b/openweathermap/weather.js index 68e32fb..5063932 100644 --- a/openweathermap/weather.js +++ b/openweathermap/weather.js @@ -51,19 +51,19 @@ module.exports = function(RED) { //If there is a value missing, the URL is not initialised. if (node.wtype === "forecast") { if (node.lat && node.lon) { - url = "http://api.openweathermap.org/data/2.5/forecast?lang=" + node.language + "&cnt=40&units=metric&lat=" + node.lat + "&lon=" + node.lon + "&APPID=" + node.credentials.apikey; + url = "http://api.openweathermap.org/data/3.0/forecast?lang=" + node.language + "&cnt=40&units=metric&lat=" + node.lat + "&lon=" + node.lon + "&APPID=" + node.credentials.apikey; } else if (node.city && node.country) { - url = "http://api.openweathermap.org/data/2.5/forecast?lang=" + node.language + "&cnt=40&units=metric&q=" + node.city + "," + node.country + "&APPID=" + node.credentials.apikey; + url = "http://api.openweathermap.org/data/3.0/forecast?lang=" + node.language + "&cnt=40&units=metric&q=" + node.city + "," + node.country + "&APPID=" + node.credentials.apikey; } } else if (node.wtype === "current") { if (node.lat && node.lon) { - url = "http://api.openweathermap.org/data/2.5/weather?lang=" + node.language + "&lat=" + node.lat + "&lon=" + node.lon + "&APPID=" + node.credentials.apikey; + url = "http://api.openweathermap.org/data/3.0/weather?lang=" + node.language + "&lat=" + node.lat + "&lon=" + node.lon + "&APPID=" + node.credentials.apikey; } else if (node.city && node.country) { - url = "http://api.openweathermap.org/data/2.5/weather?lang=" + node.language + "&q=" + node.city + "," + node.country + "&APPID=" + node.credentials.apikey; + url = "http://api.openweathermap.org/data/3.0/weather?lang=" + node.language + "&q=" + node.city + "," + node.country + "&APPID=" + node.credentials.apikey; } } else if (node.wtype === "onecall") { if (node.lat && node.lon) { - url = "https://api.openweathermap.org/data/2.5/onecall?lang=" + node.language + "&lat=" + node.lat + "&lon=" + node.lon + "&units=metric&APPID=" + node.credentials.apikey; + url = "https://api.openweathermap.org/data/3.0/onecall?lang=" + node.language + "&lat=" + node.lat + "&lon=" + node.lon + "&units=metric&APPID=" + node.credentials.apikey; } }