Skip to content

Commit

Permalink
Update openweathermap.js
Browse files Browse the repository at this point in the history
update case select of endpoint
  • Loading branch information
HeikoGr authored Oct 10, 2024
1 parent 4aba437 commit 0d2afe3
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions modules/default/weather/providers/openweathermap.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ WeatherProvider.register("openweathermap", {
defaults: {
apiVersion: "3.0",
apiBase: "https://api.openweathermap.org/data/",
// weatherEndpoint is "onecall" since API 3.0
// "onecall", "forecast" or "weather" only for pro customers
// weatherEndpoint is "/onecall" since API 3.0
// "/onecall", "/forecast" or "/weather" only for pro customers
weatherEndpoint: "/onecall",
locationID: false,
location: false,
// the onecall endpoint needs lat / lon values, it doesn't support the locationId
// the /onecall endpoint needs lat / lon values, it doesn't support the locationId
lat: 0,
lon: 0,
apiKey: ""
Expand Down Expand Up @@ -102,14 +102,10 @@ WeatherProvider.register("openweathermap", {
if (!this.config.weatherEndpoint) {
switch (this.config.type) {
case "hourly":
this.config.weatherEndpoint = "/onecall";
break;
case "daily":
case "forecast":
this.config.weatherEndpoint = "/forecast";
break;
case "current":
this.config.weatherEndpoint = "/weather";
this.config.weatherEndpoint = "/onecall";
break;
default:
Log.error("weatherEndpoint not configured and could not resolve it based on type");
Expand Down

0 comments on commit 0d2afe3

Please sign in to comment.