Skip to content

Commit

Permalink
Update weather.js from One Call API 2.5 to One Call API 3.0 (#312)
Browse files Browse the repository at this point in the history
  • Loading branch information
FireWizard52 committed Apr 28, 2024
1 parent 6315202 commit f1c4ca4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions openweathermap/weather.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit f1c4ca4

Please sign in to comment.