Enable form based (in browser) configuration for MagicMirror.
- An installation of MagicMirror2
A dynamically built form, based on modules installed (git cloned at least) into the modules folder and the contents of the config.js.
-
cd ~/MagicMirror/modules
-
git clone https://github.com/sdetweil/MMM-Config
-
cd MMM-Config
-
npm install
-
Configure your
~/MagicMirror/config/config.js
: (via editor for the last time){ module:"MMM-Config", position:"top_right", // the QR code (if requested) will appear here config:{ } },
Option | Default | Default | Info |
---|---|---|---|
showQR |
OPTIONAL | false |
Show a QR code on the MM screen to allow quick access to the configuration form |
===> | Otherwise, use a browser to open http://MM_IP_Address:MM_Port/modules/MMM-Config/review | ||
Note: If MagicMirror is configured for 'address:"localhost" , you MUST use a browser ON the same system as MM , and the QR code will be replaced by text on the screen explaining why the QRCode is not displayed |
|||
force_update |
OPTIONAL | false | Each time MM is started a scan is done of changed items, config.js and the modules folder. If either changed since last startup, then a new form is generated. If no changes, then the existing form is reused. Set to true forces a new form to be built on every MM startup |
restart |
OPTIONAL | none, static, pm2, pm2:name/number, docker | If not 'none' (default), on save of config.js, MM will be restarted to use that new config file |
if you have multiple instances of MagicMirror running under pm2, and you want restart on save, look at the pm2 status output and get the unique name or number of the app, for example
pm2:MagicMirror1, or pm2:0 this is particularly important if you are running multiple instances from the same MagicMirror folder with differnt config files, you may specify only pm2, and the module will autodetect what app id to use
On form submission, a new config.js is constructed and saved, AFTER
renaming the current config.js out of the way.
The rename adds on the date and time the existing config.js was last modified.
The saved config.js filename will look like this config.js.2021-05-04T10.01.27
.
The ':' in the time is changed to '.' as Windows will not allow a filename with ':'.
MMM-Config uses the jsonform library to construct, present and operate the form
Main form page. The form colors can be set in webform.css
Modules expanded. Module names in red are disabled or not in config.js. Module names in blue are in config.js and enabled.
Because the order of modules is top down by position, all the positioning is moved to this section of the form.
If u want a specific module first, select 1, second select 2, (consider date/time(1) above calendar(2)) if u don't care, select * (the default)
Disabled modules are left in config.js, just disabled. Otherwise, we would lose the configuration information , like api keys, latitude/longitude, etc.