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.

    syntax errors

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    11 Posts 5 Posters 2.8k Views 5 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.
    • E Offline
      Egnos
      last edited by Egnos

      Hi guys,
      I’m a beginner and I’m setting up the module MMM-AssistantMk2 but I don’t know why if I add this two configuration:

      record: { // Full values are in FOR EXPERTS section.
      recordProgram: “arecord”, // Defaults to “arecord” - also supports “rec” and “sox”
      device: null // recording device (e.g.: “plughw:1”)

      play: { // Full values are in FOR EXPERTS section.
      playProgram: “mpg321”, // recommended.

      the MM show me: WARNING! Could not validate config file. Please correct syntax errors. Starting with default configuration.

      Where am I wrong?
      I attach my config.js

      Thanks everyone.

      [0_1546719570197_config.js](Caricamento 100%)

      My Mirror https://forum.magicmirror.builders/topic/17262/the-raspimirror-was-born/7

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

        @egnos Please show us the full config.js file and mark it as Code by selecting the whole content of the file and click on the </> button.

        You can find a markdown tutorial here: https://commonmark.org/help/

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

          Change directory to tests/configs
          And run

          Node config_check.js

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • E Offline
            Egnos
            last edited by

            Sorry, the config.js below:

            /* 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: "MMM-AssistantMk2",
            		  position: "top_right",
            		  config: {
            		    deviceLocation: {
            					coordinates: { // set the latitude and longitude of the device to get localized information like weather or time. (ref. mygeoposition.com)
            					latitude: 45.200049, // -90.0 - +90.0
            					longitude: 7.568917, // -180.0 - +180.0					
            			
            			profiles: {
            				"default" : { // profile name.
            				profileFile: "default.json", // profile file name.
            				lang: "it-IT"
            				//currently available (estimation, not all tested):
            				//  de-DE, en-AU, en-CA, en-GB, en-US, en-IN
            				// fr-CA, fr-FR, it-IT, ja-JP, es-ES, es-MX, ko-KR, pt-BR
            				// https://developers.google.com/assistant/sdk/reference/rpc/languages
            				
            			record: { // Full values are in `FOR EXPERTS` section.
            				recordProgram: "arecord",  // Defaults to "arecord" - also supports "rec" and "sox"
            				device: null        // recording device (e.g.: "plughw:1")
            			
            			play: { // Full values are in `FOR EXPERTS` section.
            				playProgram: "mpg321", // recommended.
            											}
            										}
            								 	}
            								 }
            							}		  
            					  }
            				}
                    },
            		{
            			module: "alert",
            		},
            		{
            			module: "updatenotification",
            			position: "top_bar"
            		},
            		{
            			module: "clock",
            			position: "top_left"
            		},
            		{
            			module: "calendar",
            			header: "US Holidays",
            			position: "top_left",
            			config: {
            				calendars: [
            					{
            						symbol: "calendar-check-o ",
            						url: "webcal://www.calendarlabs.com/templates/ical/US-Holidays.ics"
            					}
            				]
            			}
            		},
            		{
            			module: "compliments",
            			position: "lower_third"
            		},
            		{
            			module: "currentweather",
            			position: "top_right",
            			config: {
            				location: "New York",
            				locationID: "",  //ID from http://bulk.openweathermap.org/sample/; unzip the gz file and find your city
            				appid: "YOUR_OPENWEATHER_API_KEY"
            			}
            		},
            		{
            			module: "weatherforecast",
            			position: "top_right",
            			header: "Weather Forecast",
            			config: {
            				location: "New York",
            				locationID: "5128581",  //ID from http://www.openweathermap.org/help/city_list.txt
            				appid: "YOUR_OPENWEATHER_API_KEY"
            			}
            		},
            		{
            			module: "newsfeed",
            			position: "bottom_bar",
            			config: {
            				feeds: [
            					{
            						title: "New York Times",
            						url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml"
            					}
            				],
            				showSourceTitle: true,
            				showPublishDate: true
            			}
            		},
            	]
            
            };
            
            /*************** DO NOT EDIT THE LINE BELOW ***************/
            if (typeof module !== "undefined") {module.exports = config;}
            
            

            Thanks.

            My Mirror https://forum.magicmirror.builders/topic/17262/the-raspimirror-was-born/7

            1 Reply Last reply Reply Quote 0
            • G Offline
              ganget
              last edited by ganget

              Heey i just check your config file and found that there are some differences compared to the config in the readme file. Something i noticed is to check if there is a }, after each { . Example

              {
                module: "MMM-AssistantMk2",
                position: "top_right",
                config: {
              deviceLocation: {
                    coordinates: { // set the latitude and longitude of the device to get localized information like weather or time. (ref. mygeoposition.com)
                      latitude: 45.200049, // -90.0 - +90.0
                      longitude: 7.568917, // -180.0 - +180.0
                    },
                  },
              

              there is twice }, at the end to close both the {
              Can you check for me if this works?

              {
                module: "MMM-AssistantMk2",
                position: "top_right",
                config: {
              
                  // --- ESSENTIALS / modifying for your environment might be needed.
              
              
                  deviceLocation: {
                    coordinates: { // set the latitude and longitude of the device to get localized information like weather or time. (ref. mygeoposition.com)
                      latitude: 45.200049, // -90.0 - +90.0
              		longitude: 7.568917, // -180.0 - +180.0	
                    },
                  },
              
                  defaultProfile: "default", // If you have several profiles and want to set one of them as default profile, describe here.
              
                  profiles: {
                    "default" : { // profile name.
                      profileFile: "default.json", // profile file name.
                      lang: "it-IT"
                      //currently available (estimation, not all tested):
                      //  de-DE, en-AU, en-CA, en-GB, en-US, en-IN
                      // fr-CA, fr-FR, it-IT, ja-JP, es-ES, es-MX, ko-KR, pt-BR
                      // https://developers.google.com/assistant/sdk/reference/rpc/languages
                      },
                  },
              
                  record: { // Full values are in `FOR EXPERTS` section.
                    recordProgram: "arecord",  // Defaults to "arecord" - also supports "rec" and "sox"
                    device: null        // recording device (e.g.: "plughw:1")
                  },
              
                  play: { // Full values are in `FOR EXPERTS` section.
                    playProgram: "mpg321", // recommended.
                  },
              },
              },
              
              
              E 1 Reply Last reply Reply Quote 2
              • E Offline
                Egnos @ganget
                last edited by

                Sorry @ganget, but I’m not sure that the configuration you propose can work, because after opening a “{” is closed with a “},” and the “},” is used only for the closure of the entire module and not the single configurations. Correct?

                Is it possible that the problem is on the comma after “mpg321”?

                play: { // Full values are in `FOR EXPERTS` section.
                      playProgram: "mpg321", // recommended.
                

                Thank you all!

                My Mirror https://forum.magicmirror.builders/topic/17262/the-raspimirror-was-born/7

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

                  from the MM folder run

                  node tests/configs/check_config.js

                  find and fix all errors, starting from the top of the list

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  E 1 Reply Last reply Reply Quote 0
                  • yawnsY Offline
                    yawns Moderator
                    last edited by

                    @ganget is right, your { } are mixed up.

                    This passes the test on jshint.com

                    /* 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: "MMM-AssistantMk2",
                    		  position: "top_right",
                    		  config: {
                    		    deviceLocation: {
                    					coordinates: { // set the latitude and longitude of the device to get localized information like weather or time. (ref. mygeoposition.com)
                    					latitude: 45.200049, // -90.0 - +90.0
                    					longitude: 7.568917, // -180.0 - +180.0					
                              },
                            },
                    			profiles: {
                    				"default" : { // profile name.
                    				profileFile: "default.json", // profile file name.
                    				lang: "it-IT",
                    				//currently available (estimation, not all tested):
                    				//  de-DE, en-AU, en-CA, en-GB, en-US, en-IN
                    				// fr-CA, fr-FR, it-IT, ja-JP, es-ES, es-MX, ko-KR, pt-BR
                    				// https://developers.google.com/assistant/sdk/reference/rpc/languages
                    				}
                            },
                    			record: { // Full values are in `FOR EXPERTS` section.
                    				recordProgram: "arecord",  // Defaults to "arecord" - also supports "rec" and "sox"
                    				device: null        // recording device (e.g.: "plughw:1")
                          },
                    			play: { // Full values are in `FOR EXPERTS` section.
                    				playProgram: "mpg321", // recommended.
                    			}        
                          }
                            },
                    		{
                    			module: "alert",
                    		},
                    		{
                    			module: "updatenotification",
                    			position: "top_bar"
                    		},
                    		{
                    			module: "clock",
                    			position: "top_left"
                    		},
                    		{
                    			module: "calendar",
                    			header: "US Holidays",
                    			position: "top_left",
                    			config: {
                    				calendars: [
                    					{
                    						symbol: "calendar-check-o ",
                    						url: "webcal://www.calendarlabs.com/templates/ical/US-Holidays.ics"
                    					}
                    				]
                    			}
                    		},
                    		{
                    			module: "compliments",
                    			position: "lower_third"
                    		},
                    		{
                    			module: "currentweather",
                    			position: "top_right",
                    			config: {
                    				location: "New York",
                    				locationID: "",  //ID from http://bulk.openweathermap.org/sample/; unzip the gz file and find your city
                    				appid: "YOUR_OPENWEATHER_API_KEY"
                    			}
                    		},
                    		{
                    			module: "weatherforecast",
                    			position: "top_right",
                    			header: "Weather Forecast",
                    			config: {
                    				location: "New York",
                    				locationID: "5128581",  //ID from http://www.openweathermap.org/help/city_list.txt
                    				appid: "YOUR_OPENWEATHER_API_KEY"
                    			}
                    		},
                    		{
                    			module: "newsfeed",
                    			position: "bottom_bar",
                    			config: {
                    				feeds: [
                    					{
                    						title: "New York Times",
                    						url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml"
                    					}
                    				],
                    				showSourceTitle: true,
                    				showPublishDate: true
                    			}
                    		},
                    	]
                    
                    };
                    
                    /*************** DO NOT EDIT THE LINE BELOW ***************/
                    if (typeof module !== "undefined") {module.exports = config;}
                    

                    Also, if you look at the readme for this module configuration you notice the { } need to be set different.

                    1 Reply Last reply Reply Quote 0
                    • E Offline
                      Egnos @sdetweil
                      last edited by Egnos

                      @sdetweil said in syntax errors:

                      from the MM folder run

                      node tests/configs/check_config.js

                      find and fix all errors, starting from the top of the list

                      Thanks, as soon possible I will try this command.

                      Ok thanks @ganget, but I do not understand why if I remove the comma of the “}” referring to “play” the configuration does not give problems but if I remove the comma from the “}” referring to “record” it goes into error…

                      	record: { // Full values are in `FOR EXPERTS` section.
                      			recordProgram: "arecord",  // Defaults to "arecord" - also supports "rec" and "sox"
                      			device: null        // recording device (e.g.: "plughw:1")
                        },
                      		play: { // Full values are in `FOR EXPERTS` section.
                      			playProgram: "mpg321", // recommended.
                      		}        
                      

                      Sorry for the banalities … but I’m a beginner.:smiling_face_with_open_mouth_cold_sweat:

                      My Mirror https://forum.magicmirror.builders/topic/17262/the-raspimirror-was-born/7

                      S G 2 Replies Last reply Reply Quote 0
                      • S Offline
                        sdetweil @Egnos
                        last edited by sdetweil

                        @egnos comma is continuation… its ok to have an EXTRA , after the play group,… it is NOT ok to have a missing , between things

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        1 Reply Last reply Reply Quote 3
                        • 1
                        • 2
                        • 1 / 2
                        • 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