mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-23 13:24:06 +00:00
Merge pull request #2900 from rejas/issue_2899
Use type value in weatherbit provider
This commit is contained in:
@@ -23,6 +23,7 @@ _This release is scheduled to be released on 2022-10-01._
|
|||||||
- Broadcast all calendar events while still honoring global and per-calendar maximumEntries.
|
- Broadcast all calendar events while still honoring global and per-calendar maximumEntries.
|
||||||
- Respect rss ttl provided by newsfeed (#2883).
|
- Respect rss ttl provided by newsfeed (#2883).
|
||||||
- Fix multi day calendar events always presented as "(1/X)" instead of the amount of days the event has progressed.
|
- Fix multi day calendar events always presented as "(1/X)" instead of the amount of days the event has progressed.
|
||||||
|
- Fix weatherbit provider to use type config value instead of endpoint
|
||||||
|
|
||||||
## [2.20.0] - 2022-07-02
|
## [2.20.0] - 2022-07-02
|
||||||
|
|
||||||
@@ -32,8 +33,8 @@ Special thanks to the following contributors: @eouia, @khassel, @kolbyjack, @Kri
|
|||||||
|
|
||||||
- Added a new config option `httpHeaders` used by helmet (see https://helmetjs.github.io/). You can now set own httpHeaders which will override the defaults in `js/defauls.js` which is useful e.g. if you want to embed MagicMirror into annother website (solves #2847).
|
- Added a new config option `httpHeaders` used by helmet (see https://helmetjs.github.io/). You can now set own httpHeaders which will override the defaults in `js/defauls.js` which is useful e.g. if you want to embed MagicMirror into annother website (solves #2847).
|
||||||
- Show endDate for calendar events when dateHeader is enabled and showEnd is set to true (#2192).
|
- Show endDate for calendar events when dateHeader is enabled and showEnd is set to true (#2192).
|
||||||
- Added the notification emitting from the weather module on infromation updated.
|
- Added the notification emitting from the weather module on information updated.
|
||||||
- Use recommended file extention for YAML files (#2864).
|
- Use recommended file extension for YAML files (#2864).
|
||||||
|
|
||||||
### Updated
|
### Updated
|
||||||
|
|
||||||
|
@@ -18,7 +18,6 @@ WeatherProvider.register("weatherbit", {
|
|||||||
// Set the default config properties that is specific to this provider
|
// Set the default config properties that is specific to this provider
|
||||||
defaults: {
|
defaults: {
|
||||||
apiBase: "https://api.weatherbit.io/v2.0",
|
apiBase: "https://api.weatherbit.io/v2.0",
|
||||||
weatherEndpoint: "/current",
|
|
||||||
apiKey: "",
|
apiKey: "",
|
||||||
lat: 0,
|
lat: 0,
|
||||||
lon: 0
|
lon: 0
|
||||||
@@ -69,6 +68,31 @@ WeatherProvider.register("weatherbit", {
|
|||||||
.finally(() => this.updateAvailable());
|
.finally(() => this.updateAvailable());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overrides method for setting config to check if endpoint is correct for hourly
|
||||||
|
*
|
||||||
|
* @param {object} config The configuration object
|
||||||
|
*/
|
||||||
|
setConfig(config) {
|
||||||
|
this.config = config;
|
||||||
|
if (!this.config.weatherEndpoint) {
|
||||||
|
switch (this.config.type) {
|
||||||
|
case "hourly":
|
||||||
|
this.config.weatherEndpoint = "/forecast/hourly";
|
||||||
|
break;
|
||||||
|
case "daily":
|
||||||
|
case "forecast":
|
||||||
|
this.config.weatherEndpoint = "/forecast/daily";
|
||||||
|
break;
|
||||||
|
case "current":
|
||||||
|
this.config.weatherEndpoint = "/current";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Log.error("weatherEndpoint not configured and could not resolve it based on type");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// Create a URL from the config and base URL.
|
// Create a URL from the config and base URL.
|
||||||
getUrl() {
|
getUrl() {
|
||||||
const units = this.units[this.config.units] || "auto";
|
const units = this.units[this.config.units] || "auto";
|
||||||
|
Reference in New Issue
Block a user