You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/weather.md
+23-6Lines changed: 23 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,8 @@ This module will be configurable to be used as a current weather view, or to
4
4
show the forecast. This way the module can be used twice to fulfill both
5
5
purposes.
6
6
7
-
The biggest change is the use of weather providers. This way we are not bound to
8
-
one API source. And users can choose which API they want to use as their source.
9
-
10
-
The module is in a very early stage, and needs a lot of work. It's API isn't set
11
-
in stone, so keep that in mind when you want to contribute.
7
+
The module uses weather providers. This way we are not bound to one API source.
8
+
And users can choose which API they want to use as their source.
12
9
13
10
## Screenshot
14
11
@@ -35,6 +32,25 @@ To use this module, add it to the modules array in the `config/config.js` file:
35
32
},
36
33
```
37
34
35
+
## Themes
36
+
37
+
Beginning with MagicMirror² `v2.35.0` we offer the use of themes. With this enhancement
38
+
users must not create an own module if they only want to change the design of the module.
39
+
40
+
Usage:
41
+
42
+
- create a theme directory under `modules`, e.g. `modules/myweathertemplate`.
43
+
- create own files `current.njk`, `forecast.njk`, `hourly.njk` and `weather.css` in the new directory.
44
+
As starting point you can copy the existing files (located at `defaultmodules/weather`).
45
+
- set the configuration option `themeDir` to your new theme directory (e.g. `../../../modules/myweathertemplate`).
46
+
47
+
For advanced users there are more options to customize the template:
48
+
- you can define a function `window.initWeatherTheme(this)` which is called when starting the module.
49
+
Insert own code here if you need to do additional stuff before start.
50
+
- you can define a function `window.updateWeatherTheme(this)` for updating the dom with own code.
51
+
- you can use custom scripts located in your theme directory which contain e.g. the 2 methods
52
+
mentioned above or other stuff. Use the configuration option `themeCustomScripts` to load these scripts.
53
+
38
54
## Configuration options
39
55
40
56
The following properties can be configured:
@@ -63,7 +79,8 @@ The following properties can be configured:
63
79
|`initialLoadDelay`| The initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds) <br><br> **Possible values:**`1000` - `5000` <br> **Default value:**`0`|
64
80
|`appendLocationNameToHeader`| If set to `true`, the returned location name will be appended to the header of the module, if the header is enabled. This is mainly interesting when using calender based weather. <br><br> **Default value:**`true`|
65
81
|`calendarClass`| The class for the calender module to base the event based weather information on. <br><br> **Default value:**`'calendar'`|
66
-
|`useCorsProxy`| Some weather modules need a cors proxy to get their api running. <br><br> **Possible values:** true or false <br> **Default value:**`false` (except providers `pirateweather` and `envcanada`) |
82
+
|`themeDir`| Defines the location of the 3 `*.njk` and the `weather.css` file. You can use an own dir containing these files to override the default ones. Directory must be specified relative to the `weather` directory. <br><br> **Possible values:** relative path <br> **Default value:**`./`|
83
+
|`themeCustomScripts`| Defines additional script file names located in the `themeDir`. Only needed it your weather theme needs own additional scripts. <br><br> **Possible values:** array of filenames <br> **Default value:**`[]`|
0 commit comments