Skip to content

Commit 34f7962

Browse files
authored
add weather templates (#366)
1 parent 9a14928 commit 34f7962

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

modules/weather.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ This module will be configurable to be used as a current weather view, or to
44
show the forecast. This way the module can be used twice to fulfill both
55
purposes.
66

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.
129

1310
## Screenshot
1411

@@ -35,6 +32,25 @@ To use this module, add it to the modules array in the `config/config.js` file:
3532
},
3633
```
3734

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+
3854
## Configuration options
3955

4056
The following properties can be configured:
@@ -63,7 +79,8 @@ The following properties can be configured:
6379
| `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` |
6480
| `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` |
6581
| `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:** `[]` |
6784

6885
#### Current weather options
6986

0 commit comments

Comments
 (0)