Read the statement by Michael Teeuw here.
Config code not working?
-
Hi guys… I’ve entered the code exactly as instructed, into the config.js and when I refresh MM, it wont load…
This is for the MMM-Smartthings module… and I put in the ‘Token’ between the commas as indicated.
I admit im no expert here, but why so many brackets at the end?
I even tried just using the normal open and close brackets, like my other modules, but still no joy.Any pointers please?
Using the module
To use this module, add the following configuration block to the modules array in the config/config.js file:var config = { modules: [ { module: "MMM-Smartthings", position: "top_left", header: "Smartthings", config: { personalAccessToken: 'your_smarthings_api_key', capabilities: [ 'contactSensor', 'lock' ], title: "Doors & Locks", excludedDeviceNames: [ 'Sense-', // Contains this text 'Virtual Lock Test' // Or is a specific device label ] } } ] }
-
@johnnyboy ok, that looks pretty!..
one little check…
To use this module, add the following configuration block to the modules array in the config/config.js file:
when u added, did the module block BEFORE have a trailing , (more coming),
if not YOU need to add itif where you added yours, there is stuff AFTER, does THIS module block have a trailing comma (more coming), if not YOU need to add one
run the config checker
cd ~/MagicMirror npm run config:check
when u see ‘unexpected token’, that means the line before is probably missing its comma, (more coming)
-
This is how it looks on screen
/* Magic Mirror Config Sample * * By Michael Teeuw http://michaelteeuw.nl * MIT Licensed. * * For more information on how you can configure this file * See https://github.com/MichMich/MagicMirror#configuration * */ var config = { address: "localhost", // Address to listen on, can be: // - "localhost", "127.0.0.1", "::1" to listen on loopback interface // - another specific IPv4/6 to listen on a specific interface // - "0.0.0.0", "::" to listen on any interface // Default, when address config is left out or empty, is "localhost" port: 8080, ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses // or add a specific IPv4 of 192.168.1.5 : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"], // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"], useHttps: false, // Support HTTPS or not, default "false" will use HTTP httpsPrivateKey: "", // HTTPS private key path, only require when useHttps is true httpsCertificate: "", // HTTPS Certificate path, only require when useHttps is true language: "en", timeFormat: 24, units: "metric", // serverOnly: true/false/"local" , // local for armv6l processors, default // starts serveronly and then starts chrome browser // false, default for all NON-armv6l devices // true, force serveronly mode, because you want to.. no UI on this device modules: [ { module: 'alert', config: { // The config property is optional. // See 'Configuration options' for more information. } }, { module: 'clock', position: 'top_center' }, { module: 'MMM-Smartthings', position: 'top_left', header: 'Smartthings', config: { personalAccessToken: '*****-*****-*****-*****', capabilities: [ 'contactSensor', 'lock' ], title: "Doors & Locks", excludedDeviceNames: [ 'Sense-', // Contains this text 'Virtual Lock Test' // Or is a specific device label ] } } ] }, { module: 'calendar',
^^^^ Above I tried with single quotes, having already tried double quotes as was indicated to
module: "MMM-Smartthings", position: "top_left", header: "Smartthings",
-
@johnnyboy said in Config code not working?:
> 'Virtual Lock Test' // Or is a specific device label > ] > } > } < ----- > ] < -----
well, ya got a few extra things in there
every { needs a } and every [ needs a ]
extras not allowed -
That did it… I just knew there were too many brackets, but who am I to contradict the developer of that module?
Thanks so much for pointing me in the right direction.{ module: 'MMM-Smartthings', position: 'top_left', header: 'Smartthings', config: { personalAccessToken: 'MY TOKEN GOES IN HERE', capabilities: [ 'contactSensor', 'lock' ], title: "Doors & Locks", excludedDeviceNames: [ 'Sense-', // Contains this text 'Virtual Lock Test' // Or is a specific device label ] } }, { module: 'calendar',
How the instructions said to do it!
'contactSensor', 'lock' ], title: "Doors & Locks", excludedDeviceNames: [ 'Sense-', // Contains this text 'Virtual Lock Test' // Or is a specific device label ] } } ] }, { module: 'calendar',
-
@johnnyboy said in Config code not working?:
but who am I to contradict the developer of that module?
well, you have to read what he said, you copied too much… LOOK like this (his is correct), not BE EXACTLY this (as he only had one module)
read the modules for beginners
https://forum.magicmirror.builders/topic/4231/how-to-add-modules-for-absolute-beginners?_=1592186111969 -
@sdetweil
For sure I was’nt knocking him… I just followed what it said - to enter that block into Config…
I’m very much a novice in this, so I just enter what I see, or be told to by members, who know far more than I… but I did say at opening post that I was unsure if there should be so many brackets at the end…But yeah, it works brilliantly… although I have quite a lot of Smartthings items… so the list goes all down the entire side of the screen, covering Compliments - Lower 3rd, and news feed - bottom bar. … so will need to make another post to find out how to reduce the font size using CSS.
Thanks again Sam… you have helped restore my interest in MM again, with your help on several of my posts.
-