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 Error

    Scheduled Pinned Locked Moved Troubleshooting
    newcodeerror
    39 Posts 5 Posters 13.5k 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.
    • lavolp3L Offline
      lavolp3 Module Developer @PHAGE.GOV
      last edited by lavolp3

      @PHAGE-GOV I guess you have that part in the alert module.

      It needs to be like @sdetweil said. on the left side a single word, here welcome_message. You need to take care of underlines and the upper-/lowercase.
      Then there is a : and then the value which can be a string or false.

      welcome_message: 'Any string you like'
      

      OR

      welcome_message: false
      

      How to troubleshoot modules
      MMM-soccer v2, MMM-AVStock

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

        @lavolp3 but his error was

        Unexpected token Welcome_message

        so, one at least more this is wrong

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        lavolp3L 1 Reply Last reply Reply Quote 0
        • lavolp3L Offline
          lavolp3 Module Developer @sdetweil
          last edited by lavolp3

          @sdetweil Looking at above post, there’s looots of errors in the config.

          @PHAGE-GOV we can’t lead you through all of these.
          You need to understand how config.js needs to look. Only one comma set false or forgotten breaks the whole file and the mirror.

          How to troubleshoot modules
          MMM-soccer v2, MMM-AVStock

          lavolp3L 1 Reply Last reply Reply Quote 0
          • lavolp3L Offline
            lavolp3 Module Developer @lavolp3
            last edited by lavolp3

            @lavolp3 The alert part needs to look like this:

            		{
            			module: "alert",
            			position: "right",
            			welcome_message: "a string"
            		},
            

            How to troubleshoot modules
            MMM-soccer v2, MMM-AVStock

            P 1 Reply Last reply Reply Quote 0
            • P Offline
              PHAGE.GOV @sdetweil
              last edited by

              @sdetweil okay so ive been combing through the code, and since i didnt know how to properly edit .json files, i had alot of cleanup to do, im still not done, but getting there. what is a trailing space though? i dont know what to remove

              1 Reply Last reply Reply Quote 0
              • P Offline
                PHAGE.GOV @lavolp3
                last edited by

                @lavolp3

                {
                			module: "compliments",
                			position: "lower_third",
                			compliments: {	
                				"anytime" : [
                					"Hey there sexy!"
                				],
                				"morning" : [
                

                so 64 is the compliments line and it says it has trailing spaces. Im actually learning so much about json files rn so thank you @sdetweil and @lavolp3

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

                  @PHAGE-GOV ignore the trailing space error. It’s stupid

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  P 1 Reply Last reply Reply Quote 0
                  • P Offline
                    PHAGE.GOV @sdetweil
                    last edited by

                    @sdetweil indeed it is, i found it tho, and i fixed everything else too! thank you so much! and i learned so much from this also, i feel much more confident poking around and i defs learned much more about proper coding

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

                      @PHAGE-GOV and finding your way on the next error. After 3 years I still make them

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      P 1 Reply Last reply Reply Quote 0
                      • P Offline
                        PHAGE.GOV @sdetweil
                        last edited by

                        @sdetweil yeah, but npm run config:check was such a life saver

                        1 Reply Last reply Reply Quote 1
                        • BKeyportB Offline
                          BKeyport Module Developer
                          last edited by

                          one of the biggest tips I can give you is to throw out everything you know about capitalization…
                          Welcome_message is different from welcome_message

                          Most of the time, with RARE exception, the initial letter is lowercase. javacriptIsWeird

                          The "E" in "Javascript" stands for "Easy"

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

                            @BKeyport no… it is entirely up to the author of the module what case is used.
                            there are no rules…

                            only thing is javascript is case sensitive

                            var foo
                            is different than
                            var fOo
                            etc…

                            the config code doesn’t care, it takes all the settings and makes an object
                            the module then looks for specific items… almost NEVER checking for case mismatch

                            config.foo
                            will NOT find
                            config.fOo

                            it is NOT an error to config if fOo is not present.

                            filenames on linux are also case sensitive

                            Sam

                            How to add modules

                            learning how to use browser developers window for css changes

                            BKeyportB 1 Reply Last reply Reply Quote 1
                            • BKeyportB Offline
                              BKeyport Module Developer @sdetweil
                              last edited by

                              @sdetweil That’s effectively what I said… I’m working from within the naming conventions typically used by module authors, including myself, and trying to stress that case is important, because if you come from a world where it’s not (DOS/Windows, perhaps?) it takes some getting used to.

                              bottom line, Welcome_message is not the same as welcome_message

                              The "E" in "Javascript" stands for "Easy"

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

                                @BKeyport said in Config Error:

                                I’m working from within the naming conventions typically used by module authors

                                i didn’t know there were any conventions! least I don’t follow anything written anywhere

                                Sam

                                How to add modules

                                learning how to use browser developers window for css changes

                                evroomE 1 Reply Last reply Reply Quote 0
                                • evroomE Offline
                                  evroom @sdetweil
                                  last edited by

                                  @sdetweil said in Config Error:

                                  i didn’t know there were any conventions! least I don’t follow anything written anywhere

                                  Naming conventions are not must, but it is used to make code more readable and understandable.
                                  A quick google came up with this useful page:

                                  https://github.com/ktaranov/naming-convention/blob/master/JavaScript Name and Coding Conventions.md

                                  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 i have been coding for 45 years… i know what they are and know what good ones produce…

                                    however, specific casing has always been a useless conversation…

                                    make names meaningful, use case where appropriate…
                                    i don’t follow camelcase, or any other std.

                                    Sam

                                    How to add modules

                                    learning how to use browser developers window for css changes

                                    evroomE 1 Reply Last reply Reply Quote 0
                                    • evroomE Offline
                                      evroom @sdetweil
                                      last edited by

                                      @sdetweil said in Config Error:

                                      i know what they are and know what good ones produce…

                                      Cannot tell from your reply, if you were offended by my post, but please don’t be.
                                      First of all you are the most appreciated and by far the most active member on the Forum and if it weren’t for you, less people would succeed with their installs and less people would be using MM.
                                      But you did say “i didn’t know there were any conventions!”, hence my reply, a bit naïve perhaps.
                                      Probably you meant so say it within the context of programming MM modules.
                                      I had better addressed the link to @BKeyport so that he could take notice, but in principle it was meant for those interested (and do not know that in MM “Welcome_message is not the same as welcome_message”).

                                      Have a nice day,

                                      @evroom

                                      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)

                                      BKeyportB 1 Reply Last reply Reply Quote 0
                                      • BKeyportB Offline
                                        BKeyport Module Developer @evroom
                                        last edited by

                                        @evroom “convention” isn’t the right word here, perhaps. I’m almost leaning to “peer pressure” perhaps? Doing it because it seems everyone else is? 🤣🤣🤣

                                        The "E" in "Javascript" stands for "Easy"

                                        evroomE 1 Reply Last reply Reply Quote 0
                                        • evroomE Offline
                                          evroom @BKeyport
                                          last edited by

                                          @BKeyport said in Config Error:

                                          @evroom “convention” isn’t the right word here, perhaps. I’m almost leaning to “peer pressure” perhaps? Doing it because it seems everyone else is?

                                          I had to read the beginning of the thread first before starting ‘name-calling’ :-) And perhaps had to address it to the thread starter @PHAGE-GOV, for learning purposes
                                          Some people treat the config.js file as code and think that they are actually coding. In principle a JS file is a text file containing JavaScript code, so it is a bit misleading, although it contains “var config =”, which suggests it being a part of some code.
                                          IMHO it would be better to use the json extension, so config.json, as it is based on JSON and stores data structures and objects in this format.

                                          One should’t care less how coders use variables in their programs (as Sam said: “make names meaningful, use case where appropriate”, especially if you want to keep it maintainable or want to hand it over to someone else), but in case of config.js one should make at least a bit of an effort to keep it simple and understandable. Again: IMHO.

                                          In my book this is for example a no-go:

                                          {
                                          location: "New York",
                                          locationID: "", 
                                          appid: "YOUR_OPENWEATHER_API_KEY"
                                          }
                                          

                                          This is just waiting for an accident to happen.
                                          What is wrong using locationName, locationId and apiId ?
                                          Or location, location_id and api_id ?
                                          Probably nitpicking from my side, but it hurts my eyes :-)

                                          I would say “make names meaningful, use case where appropriate and keep it consistent”.

                                          I also know it it all voluntary work and it does not cost a dime (unless you donate something to the author, like I did) and therefore one is not really allowed to complain :-) I hope some constructive criticism is allowed though. Do not want to offend anyone.

                                          That being said, just enjoy your MagicMirror. :-)

                                          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)

                                          1 Reply Last reply Reply Quote 0

                                          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
                                          • 2
                                          • 2 / 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