Read the statement by Michael Teeuw here.
Default Weather Module Multiple Instances for Diff Locations
-
Re: Default Modules
I found that I can use the new weather module many times for different locations.
I"m building a mirror for my Dad and he likes to watch the weather in different cities where his family members are located.I would like to be able to do this on different “pages” using the pages module. I setup a PiSupply Flick Large to do the page incrementing and it’s working great. So, ideally I’d have his local weather on page 1 and on page 2 have about five weather locations for the family.
How would I do this? Would I have to copy and rename the weather module?
-
@sdetweil I finally got it! Your hint on another forum post plus this… finally made sense to me after I stared at it a while.
for anyone else…
- The pages module works on class names not actual module names.
- MagicMirror uses the module name as the default css class for that module.
- you don’t have to use the default class name in the pages module config, you can use the additional class you gave it instead.
so parts of my config now look like this:
{ module: "weather", classes: "nbweather", position: "top_right", config: { weatherProvider: "openweathermap", type: "current", location: "New Braunfels", locationID: "4714131", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city apiKey: "xxxxxxxxxxxxx" } }, { module: "weather", classes: "nbweather", position: "top_right", header: "Weather Forecast", config: { weatherProvider: "openweathermap", type: "forecast", colored: true, showPrecipitationAmount: true, location: "New Braunfels", locationID: "4714131", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city apiKey: "xxxxxxxxxxxxxxxxxxxxxx" } }, { module: "weather", position: "top_right", classes: "altusweather", header: "Altus Weather", config: { weatherProvider: "openweathermap", type: "current", location: "Altus", locationID: "4529292", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxx" } },
and the config section for my pages module looks like this:
module: 'MMM-pages', config: { modules: [[ "clock", "calendar", "nbweather", "compliments"], [ "clock","MMM-SolarPicture","MMM-APOD","MMM-NewsAPI"], [ "altusweather","MMM-MyScoreboard"] ],
As you can see I used the class I gave each instance of the module instead of the module’s default class name.
-
@kayakbabe the easiest way is to assign a ‘class’ to each module on a page
page1
page2
page3
etcthen use the classname as the thing in the pages config
modules: [ [ 'page1' ], [ 'page2' ], [ 'page3' ] ]
in each module definition
module: ‘weather’,
classes:‘page1’,etc
-
@sdetweil I finally got it! Your hint on another forum post plus this… finally made sense to me after I stared at it a while.
for anyone else…
- The pages module works on class names not actual module names.
- MagicMirror uses the module name as the default css class for that module.
- you don’t have to use the default class name in the pages module config, you can use the additional class you gave it instead.
so parts of my config now look like this:
{ module: "weather", classes: "nbweather", position: "top_right", config: { weatherProvider: "openweathermap", type: "current", location: "New Braunfels", locationID: "4714131", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city apiKey: "xxxxxxxxxxxxx" } }, { module: "weather", classes: "nbweather", position: "top_right", header: "Weather Forecast", config: { weatherProvider: "openweathermap", type: "forecast", colored: true, showPrecipitationAmount: true, location: "New Braunfels", locationID: "4714131", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city apiKey: "xxxxxxxxxxxxxxxxxxxxxx" } }, { module: "weather", position: "top_right", classes: "altusweather", header: "Altus Weather", config: { weatherProvider: "openweathermap", type: "current", location: "Altus", locationID: "4529292", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxx" } },
and the config section for my pages module looks like this:
module: 'MMM-pages', config: { modules: [[ "clock", "calendar", "nbweather", "compliments"], [ "clock","MMM-SolarPicture","MMM-APOD","MMM-NewsAPI"], [ "altusweather","MMM-MyScoreboard"] ],
As you can see I used the class I gave each instance of the module instead of the module’s default class name.
-
@kayakbabe but. even EASIER
for the modules u want one page 1
set ALL of their classes property to ‘page1’then your pages config says
modules:[ [ "page1" ], [ "page2" ] ]
all modules w page1 class property show together on the 1st page
don’t have to list them individually.
and if u change your mind, then u change the module classes, NOT the pages config
-
@sdetweil I got it! That makes even more sense! Thanks!