• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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 5.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.
  • S Away
    sdetweil @berne
    last edited by Jul 19, 2019, 4:52 PM

    @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

    I 1 Reply Last reply Jul 19, 2019, 4:54 PM Reply Quote 0
    • I Offline
      idoodler Module Developer @sdetweil
      last edited by Jul 19, 2019, 4:54 PM

      @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 Jul 19, 2019, 4:56 PM Reply Quote 0
      • B Offline
        berne
        last edited by berne Jul 19, 2019, 4:58 PM Jul 19, 2019, 4:55 PM

        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 I 2 Replies Last reply Jul 19, 2019, 4:59 PM Reply Quote 0
        • S Away
          sdetweil @idoodler
          last edited by Jul 19, 2019, 4:56 PM

          @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 Away
            sdetweil @berne
            last edited by Jul 19, 2019, 4:59 PM

            @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 Jul 19, 2019, 5:07 PM Reply Quote 0
            • I Offline
              idoodler Module Developer @berne
              last edited by idoodler Jul 19, 2019, 5:06 PM Jul 19, 2019, 5:06 PM

              @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 Jul 19, 2019, 5:07 PM

                @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

                M E 2 Replies Last reply Jul 19, 2019, 5:49 PM Reply Quote 0
                • I Offline
                  idoodler Module Developer
                  last edited by Jul 19, 2019, 5:09 PM

                  @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
                  • M Online
                    mumblebaj Module Developer @berne
                    last edited by Jul 19, 2019, 5:49 PM

                    @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

                    1 Reply Last reply Reply Quote 0
                    • E Offline
                      evroom @berne
                      last edited by Jul 19, 2019, 6:26 PM

                      @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.30.0
                      Raspberry Pi 4 Model B Rev 1.5 (8 GB RAM)
                      Raspbian GNU/Linux 12 (bookworm)

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

                      S 1 Reply Last reply Jul 19, 2019, 6:30 PM Reply Quote 0
                      • 1
                      • 2
                      • 2 / 2
                      2 / 2
                      • First post
                        11/20
                        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