Read the statement by Michael Teeuw here.
Config editing
-
I am having a hell of a time trying to figure out how to edit the config file. I can open it, i can add text, i can reposition the text but nothing works for me. Would anyone be willing to help walk me through one module?
-
@ZeroCool see the topics in my signature below, they will help.
a module is
{ module: position: config:{ ... } },
notice the trailing comma.
missing trailing commas are fatal, too.many is not
-
Keep in mind that many modules have invalid samples. They’re all assuming you’re running one module.
Basic structure of the modules section:
modules: [ { module: 'modulename', // comment position: 'position', config: { key: value, }, }, { ... }. /*************** DO NOT EDIT BELOW ***************/ ] }; if (typeof module !== "undefined") {module.exports = config;}
Notice I’ve moved the do not edit line. This is to make it easier for me to find the end.
Important points:
once you think you’re ready, run “npm run config:check” in your MagicMirror directory. This will check the config. Any errors will be listed, one by one.If you copy and paste from a README.md file, do so from the bracket “{” directly above the keyword “module” to the bracket “}” that matches it vertically. Make sure to add a comma to the closing bracket “},” if it’s not the last module in the list. A graphical editor, such as Geany, is useful for this.
You can set up drive sharing (SAMBA) to another computer, so you can have the editor up and see the changes right away. Again, Geany is recommended.
Feel free to ask direct questions, like “it’s reporting unexpected comma on line XX.” and post the relevant code. Make sure to use the code </> button above to paste the code.
-
@ZeroCool you can try my MMM-Config module, which creates a form to use for managing config.js
-
@BKeyport nice touch on the do not change below marker…
also for remote editing
either WinScp or Bitvise provide ssh clients that present both the command line terminal window AND a graphical file manager view of the pi. (these are both Windows apps) , on Linux you can use the caja file browser to access remotes via different protocols)
this allows you to click to navigate the pi filesystem and double click to edit the file selected.
on my windows box I use Notepad++, great brace({}) and bracket ([]) matching
on linux I use Sublime-text… nearest to notepad++
multiple files, remembers what you were editing when closed and restarted (including across reboots) …Visual studio is also another good editor with similar features
-
@ZeroCool Another thing to keep in mind is the type of the value. Text types must start and end with
"
, whilst boolean values (true
/false
) and numbers should not.A small example:
{ module: "weather", position: "top_right", config: { type: "current", updateInterval: 600000, useBeaufort: false }
Maybe we should add a type-column to the default modules documentation.