MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    config,js beginner

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    20 Posts 6 Posters 7.6k Views 6 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • idoodlerI Offline
      idoodler Module Developer @berne
      last edited by

      @berne You have one extra } before the updatenotification module.

      Here is the corrected config:

      /* Magic Mirror Config Sample
       *
       * By Michael Teeuw http://michaelteeuw.nl
       * MIT Licensed.
       *
       * For more information how you can configurate 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, 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"],
      
      	language: "en",
      	timeFormat: 24,
      	units: "metric",
      
      	modules: [
      		{
      			module: "alert",
      		},
      		{
      			module: "MMM-NowPlayingOnSpotify",
      			position: "top_right",
      			config: {
      				showCoverArt: true,
                      		clientID: "",
      				clientSecret: "",
      				accessToken: "",
      				refreshToken: ""
      			}
      		},     
      		{
      			module: "updatenotification",
      			position: "top_bar"
      		},
      		{
      			module: "clock",
      			position: "top_left"
      		},
      		{
      			module: "calendar",
      			header: "US Holidays",
      			position: "top_left",
      			config: {
      				calendars: [
      					{
      						symbol: "calendar-check",
      						url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics"					}
      				]
      			}
      		},
      		{
      			module: "compliments",
      			position: "lower_third"
      		},
      		{
      			module: "currentweather",
      			position: "top_right",
      			config: {
      				location: "Vara,Sweden",
      				locationID: "2665018",  //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
      				appid: "YOUR_OPENWEATHER_API_KEY"
      			}
      		},
      		{
      			module: "weatherforecast",
      			position: "top_right",
      			header: "Weather Forecast",
      			config: {
      				location: "Vara,Sweden",
      				locationID: "2665018",  //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
      				appid: "YOUR_OPENWEATHER_API_KEY"
      			}
      		},
      		{
      			module: "newsfeed",
      			position: "bottom_bar",
      			config: {
      				feeds: [
      					{
      						title: "Aftonbladet",
      						url: "http://www.aftonbladet.se/nyheter/rss.xml"
      					}
      				],
      				showSourceTitle: true,
      				showPublishDate: true,
      				broadcastNewsFeeds: true,
      				broadcastNewsUpdates: true
      			}
      		}
      	]
      };
      
      /*************** DO NOT EDIT THE LINE BELOW ***************/
      if (typeof module !== "undefined") {module.exports = config;}
      
      1 Reply Last reply Reply Quote 0
      • B Offline
        berne
        last edited by

        /* Magic Mirror Config Sample
         *
         * By Michael Teeuw http://michaelteeuw.nl
         * MIT Licensed.
         *
         * For more information how you can configurate 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, 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"],
        
        	language: "en",
        	timeFormat: 24,
        	units: "metric",
        
        	modules: [
        		{
        			module: "alert",
        		},
        		{
        	           module: "MMM-NowPlayingOnSpotify",
        			position: "bottom_right",
        			config: {
        				showCoverArt: true,
                        		clientID: "c162a50685084953913d4fc247758a9e",
        				clientSecret: "d464b761e3c849a3846d087a96739d0c",
        				accessToken: "BQCJP0CGFThDfAv6p8my-fkZJQjPUoQN3nBYnV4Q-jtdVRtjcx3mCaDnX9QpSKD4YfXgSVAWh3vU_Mpij_9NpyrN1KK_6lv93Ffz3IkJqUiX31WQmJXzsIatawIhTbbqx0KLdP0qK-qFQx_MKuvSrUSB",
        				refreshToken: "AQCJi17nSbRBpLbfjH6M2t-6x2FIrBlqiHC4cctLslmIj1STMwj1pTH7JJ8TUvHIonlEnogyKqltqD3KxfYzOml4PUiW-fyFHcaPhLeRTVNwyz3DtCjFblIggtYwUkF6wk0QJw"
        				}
        		},
        		{
        
        		module: "updatenotification",
        			position: "top_bar"
        		},
        		{
        			module: "clock",
        			position: "top_left"
        		},
        		{
        			module: "calendar",
        			header: "Kalender",
        			position: "top_left",
        			config: {
        				calendars: [
        					{
        						symbol: "calendar-check",
        						url: "https://calendar.google.com/calendar/ical/berntsson88%40gmail.com/public/basic.ics"					}
        				]
        			}
        		},
        		{
        			module: "compliments",
        			position: "lower_third"
        		},
        		{
        			module: "currentweather",
        			position: "top_right",
        			config: {
        				location: "Vara,Sweden",
        				locationID: "2665018",  //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
        				appid: "cb3ba3fb9618b6f6de3fbbb9ee78284e"
        			}
        		},
        		{
        			module: "weatherforecast",
        			position: "top_right",
        			header: "Weather Forecast",
        			config: {
        				location: "Vara,Sweden",
        				locationID: "5128581",  //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
        				appid: "cb3ba3fb9618b6f6de3fbbb9ee78284e"
        			}
        		},
        		{
        			module: "newsfeed",
        			position: "bottom_bar",
        			config: {
        				feeds: [
        				{
        						title: "Aftonbladet",
        						url: "http://www.aftonbladet.se/nyheter/rss.xml"
                                        },
                                        {
        					        title: "Macworld",
                                                        url: "http://feeds.idg.se/idg/FPjt",
                                        },
        	
        					]
        				],
        				showSourceTitle: true,
        				showPublishDate: true,
        				broadcastNewsFeeds: true,
        				broadcastNewsUpdates: true
        			}
        		},
        	]
        
        };
        
        /*************** DO NOT EDIT THE LINE BELOW ***************/
        if (typeof module !== "undefined") {module.exports = config;}
        
        

        i got Spotify to work, the weather is not working and not the RSS feed, i tyde to add one more to newfeed, but it sems like i mess up my config.

        i toke a code and paste in to: jslint.com thats @idoodler did fix for me, got lots of error.

        How are u guys doing?
        if i change one thing i am messing somting up, i just what something to contoll the code, before i use in config.

        idoodlerI S 2 Replies Last reply Reply Quote 0
        • idoodlerI Offline
          idoodler Module Developer @berne
          last edited by idoodler

          @berne You do have one error remove the lonley ] but keep the ],.

          In addition, the linter you is way to sensitive, try the one I posted, or simply use Visual Studio codes Intelisense, it will automatically show you errors…

          Linter: https://jshint.com/

          1 Reply Last reply Reply Quote 0
          • S Do not disturb
            sdetweil @berne
            last edited by

            @berne

            every module looks lie this

            {
               module:"name",
               position: " pos",
               header: "????",
               config: {
               }
            },
            

            try to make sure the [ and { line up
            inside the config the same [, { and comma pattern
            one tricky thin is onside arrays (lists of things), when the things are groups like calendar and rss feed
            there needs to be a comma after the LAST entry too

            		{
            			module: "calendar",
            			header: "Kalender",
            			position: "top_left",
            			config: {
            				calendars: [
            					{
            						symbol: "calendar-check",
            						url: "https://calendar.google.com/calendar/ical/berntsson88%40gmail.com/public/basic.ics"
            					}    // < ----- missing comma
            				]
            			}
            		},
            

            using jslint is a pain… you need to check a bunch of things on the bottom of the page,
            else get lots of useless errors,… single quotes, whitespace,

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            idoodlerI 1 Reply Last reply Reply Quote 0
            • idoodlerI Offline
              idoodler Module Developer @sdetweil
              last edited by

              @sdetweil There is no comma needed after the last entry, a comma is only needed if an object is followed by another object, a comma after a last object is not mandatory.

              S 1 Reply Last reply Reply Quote 0
              • B Offline
                berne
                last edited by berne

                102 Expected ‘}’ to match ‘{’ from line 90 and instead saw ‘]’.
                108 Expected ‘]’ to match ‘[’ from line 28 and instead saw ‘}’.
                109 Expected ‘}’ to match ‘{’ from line 11 and instead saw ‘]’.
                109 Missing semicolon.
                109 Unrecoverable syntax error. (94% scanned).

                okej, igot this,
                we can take 102 dose that mean i just need to swap to }?
                109 i have no ide what that translate :S

                S idoodlerI 2 Replies Last reply Reply Quote 0
                • S Do not disturb
                  sdetweil @idoodler
                  last edited by

                  @idoodler yeh, i can never tell… some modules use the extra comma , some don’t … looked thru my config and it has one everyplace… doesn’t hurt…

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 1
                  • S Do not disturb
                    sdetweil @berne
                    last edited by

                    @berne on 101 u have ] and then on 102 u have another ]

                    use a good editor Notepad++ on windows… it will show you the matching ( { and [ with ], } and )

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    B 1 Reply Last reply Reply Quote 0
                    • idoodlerI Offline
                      idoodler Module Developer @berne
                      last edited by idoodler

                      @berne

                      • Expected '}' to match '{' from line 90 and instead saw ']'.
                        • Remove the ] in the line above (Line 101) This will validate your config you can ignore the other warnings.
                      1 Reply Last reply Reply Quote 0
                      • B Offline
                        berne @sdetweil
                        last edited by

                        @sdetweil but can i trust https://jshint.com/
                        and do what it saying to get it right, like 102
                        just swap ] to }’ on 102

                        i what to learn… but is really hard, i Appreciate you time and @idoodler too

                        mumblebajM evroomE 2 Replies Last reply Reply Quote 0
                        • idoodlerI Offline
                          idoodler Module Developer
                          last edited by

                          @berne I recomend you to to checkout the structure of the existing config.js file.

                          You may also check out the W3Schools documentation: https://www.w3schools.com/js/js_objects.asp

                          1 Reply Last reply Reply Quote 1
                          • mumblebajM Offline
                            mumblebaj Module Developer @berne
                            last edited by

                            @berne Can you paste your config.js? We can then have a look to see if it is correct and point to where you may have to make the changes.

                            As @sdetweil pointed out, a good text editor like notepad++ would show you the matching “{” and “}” etc.

                            Check out my modules at: https://github.com/mumblebaj?tab=repositories
                            Check my blog-post: https://mumblebaj.xyz/
                            Check my MM Container: https://hub.docker.com/repository/docker/mumblebaj/magicmirror/general

                            1 Reply Last reply Reply Quote 0
                            • evroomE Online
                              evroom @berne
                              last edited by

                              @berne

                              I wrote a small post on this topic.
                              JSON is supposed to be easy and straightforward, but when there is nested data it can get quite complex.

                              https://forum.magicmirror.builders/topic/9712/cannot-add-modules/14

                              MagicMirror version: 2.33.0
                              Raspberry Pi 4 Model B Rev 1.5 (8 GB RAM)
                              Raspbian GNU/Linux 12 (bookworm)

                              Test environment:
                              MagicMirror version: v2.33.0
                              Raspberry Pi 3 Model B Plus Rev 1.3 (1 GB RAM)
                              Raspbian GNU/Linux 12 (bookworm)

                              S 1 Reply Last reply Reply Quote 0
                              • S Do not disturb
                                sdetweil @evroom
                                last edited by sdetweil

                                @evroom and each module gets to customize the config to their needs, so no two look alike… (to the beginners)

                                Sam

                                How to add modules

                                learning how to use browser developers window for css changes

                                1 Reply Last reply Reply Quote 0
                                • O Offline
                                  otto
                                  last edited by

                                  I am thinking about install this
                                  https://github.com/dolanmiu/MMM-awesome-alexa/blob/master/README.md

                                  But I don’t have a pi button, do I really need that?
                                  Can’t I jut lay say -Alexa light the magic mirror

                                  1 Reply Last reply Reply Quote 0
                                  • B Offline
                                    berne
                                    last edited by berne

                                    @mumblebaj
                                    This is my config now, is it looking right? i havet dare to past in to the config,js berfore some one can tell me its right

                                    /* Magic Mirror Config Sample
                                     *
                                     * By Michael Teeuw http://michaelteeuw.nl
                                     * MIT Licensed.
                                     *
                                     * For more information how you can configurate 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, 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"],
                                    
                                    	language: "en",
                                    	timeFormat: 24,
                                    	units: "metric",
                                    
                                    	modules: [
                                    		{
                                    			module: "alert",
                                    		},
                                    		{
                                    	           module: "MMM-NowPlayingOnSpotify",
                                    			position: "bottom_right",
                                    			config: {
                                    				showCoverArt: true,
                                                    		clientID: "XXXXXXXX",
                                    				clientSecret: "XXXXXXXX",
                                    				accessToken: "XXXXXXXXX",
                                    				refreshToken: "XXXXXXXX"
                                    				}
                                    		},
                                    		{
                                    			  module: 'MMM-awesome-alexa',
                                    			position: 'bottom_bar',
                                    			config: {
                                    			  wakeWord: 'Smart Mirror',
                                    			        clientId: 'XXXXXXX',
                                    			    clientSecret: 'XXXXXX',
                                    			    deviceId: 'Magic_Mirror',
                                    			    refreshToken: 'XXXXXXX',
                                    			    lite: false,
                                    			    isSpeechVisualizationEnabled: true
                                    			}
                                    		  }
                                    		  
                                    		{
                                    
                                    		module: "updatenotification",
                                    			position: "top_bar"
                                    		},
                                    		{
                                    			module: "clock",
                                    			position: "top_left"
                                    		},
                                    		{
                                    			module: "calendar",
                                    			header: "Kalender",
                                    			position: "top_left",
                                    			config: {
                                    				calendars: [
                                    					{
                                    						symbol: "calendar-check",
                                    						url: "https://calendar.google.com/calendar/ical/berntsson88%40gmail.com/public/basic.ics"					}
                                    				]
                                    			}
                                    		},
                                    		{
                                    			module: "compliments",
                                    			position: "lower_third"
                                    		},
                                    		{
                                    			module: "currentweather",
                                    			position: "top_right",
                                    			config: {
                                    				location: "Vara,Sweden",
                                    				locationID: "2665018",  //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
                                    				appid: "cb3ba3fb9618b6f6de3fbbb9ee78284e"
                                    			}
                                    		},
                                    		{
                                    			module: "weatherforecast",
                                    			position: "top_right",
                                    			header: "Weather Forecast",
                                    			config: {
                                    				location: "Vara,Sweden",
                                    				locationID: "5128581",  //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
                                    				appid: "cb3ba3fb9618b6f6de3fbbb9ee78284e"
                                    			}
                                    		},
                                    		{
                                    			module: "newsfeed",
                                    			position: "bottom_bar",
                                    			config: {
                                    				feeds: [
                                    				{
                                    						title: "Aftonbladet",
                                    						url: "http://www.aftonbladet.se/nyheter/rss.xml"
                                                                    },
                                                                    {
                                    					        title: "Macworld",
                                                                                    url: "http://feeds.idg.se/idg/FPjt",
                                                                    },
                                    	
                                                                   
                                    				],
                                    				showSourceTitle: true,
                                    				showPublishDate: true,
                                    				broadcastNewsFeeds: true,
                                    				broadcastNewsUpdates: true
                                    			}
                                    		},
                                    	]
                                    
                                    };
                                    
                                    /*************** DO NOT EDIT THE LINE BELOW ***************/
                                    if (typeof module !== "undefined") {module.exports = config;}
                                    mumblebajM 1 Reply Last reply Reply Quote 0
                                    • mumblebajM Offline
                                      mumblebaj Module Developer @berne
                                      last edited by

                                      @berne You are missing a comma after the closing bracket of MMM-awesome-alexa. It should be },

                                      Check out my modules at: https://github.com/mumblebaj?tab=repositories
                                      Check my blog-post: https://mumblebaj.xyz/
                                      Check my MM Container: https://hub.docker.com/repository/docker/mumblebaj/magicmirror/general

                                      1 Reply Last reply Reply Quote 2

                                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                      With your input, this post could be even better 💗

                                      Register Login
                                      • 1 / 1
                                      • First post
                                        Last post
                                      Enjoying MagicMirror? Please consider a donation!
                                      MagicMirror created by Michael Teeuw.
                                      Forum managed by Sam, technical setup by Karsten.
                                      This forum is using NodeBB as its core | Contributors
                                      Contact | Privacy Policy