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.

    Possible Error in My Code?

    Scheduled Pinned Locked Moved Troubleshooting
    18 Posts 4 Posters 6.8k Views 3 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.
    • W Offline
      Wiltify
      last edited by Wiltify

      Help a noob please. I am trying to configure the clock module. Says there are syntax errors in my code when I add “config” and add parameters. It runs fine without the config added. What am I doing wrong? Thanks from a noob.

      Code:

       *
       * 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: "imperial",
      
              modules: [
                      {
                              module: "alert",
                      },
                      {
                              module: "updatenotification",
                              position: "top_bar"
                      },
                      {
                              module: "clock",
                              position: "top_left"
                              config: {
                                      timeFormat: "12",
                                      displaySeconds: "false",
                                      showPeriod: "true",
                                      timezone: "America/New_York"
                              }
                      },
              ]
      
      };
      
      /*************** DO NOT EDIT THE LINE BELOW ***************/
      if (typeof module !== "undefined") {module.exports = config;}
      
      Mykle1M 1 Reply Last reply Reply Quote 0
      • cowboysdudeC Offline
        cowboysdude Module Developer
        last edited by

        @Wiltify said in Possible Error in My Code?:

        module: “clock”,
        position: “top_left”

        Yes after this line in your config you didn’t add the coma

                  position: 'top_left',
        

        ;)

        W 1 Reply Last reply Reply Quote 1
        • Mykle1M Offline
          Mykle1 Project Sponsor Module Developer @Wiltify
          last edited by

          @Wiltify said in Possible Error in My Code?:

          position: “top_left”

          Needs a comma position: "top_left",

          Create a working config
          How to add modules

          W 1 Reply Last reply Reply Quote 1
          • W Offline
            Wiltify @Mykle1
            last edited by

            @Mykle1

            Thank you, humbling moment of the day.

            Mykle1M 1 Reply Last reply Reply Quote 1
            • Mykle1M Offline
              Mykle1 Project Sponsor Module Developer @Wiltify
              last edited by

              @Wiltify said in Possible Error in My Code?:

              Thank you, humbling moment of the day.

              No worries, mate. We’ve all been there.

              Create a working config
              How to add modules

              1 Reply Last reply Reply Quote 1
              • cowboysdudeC Offline
                cowboysdude Module Developer
                last edited by

                You’re welcome…

                1 Reply Last reply Reply Quote 1
                • W Offline
                  Wiltify @cowboysdude
                  last edited by

                  @cowboysdude Jeez, I didn’t even see this, sorry… Thank you!!

                  Mykle1M 1 Reply Last reply Reply Quote 2
                  • Mykle1M Offline
                    Mykle1 Project Sponsor Module Developer @Wiltify
                    last edited by

                    @Wiltify said in Possible Error in My Code?:

                    Jeez, I didn’t even see this, sorry… Thank you!!

                    Cowboysdude is a freakin Guru!

                    Create a working config
                    How to add modules

                    1 Reply Last reply Reply Quote 1
                    • W Offline
                      Wiltify
                      last edited by

                      I don’t know if I downloaded the fitbit module correct, something maybe wrong in my code first?

                       *
                       * 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: "imperial",
                      
                              modules: [
                                      {
                                              module: "alert",
                                      },
                                      {
                                              module: "updatenotification",
                                              position: "top_bar"
                                      },
                                      {
                                              module: "clock",
                                              position: "top_left",
                                              config: {
                                                      timeFormat: "12",
                                                      displaySeconds: "false",
                                                      showPeriod: "true",
                                                      timezone: "America/New_York"
                                              }
                                      },
                                      {
                                              module: "currentweather",
                                              position: "top_left",
                                              config: {
                                                      locationID: "4839416",  //ID from http://www.openweathermap.org/help/city_list.txt
                                                      appid: "a8fcb80620f43f70c4e6141e5e0f09dc",
                                                      units: "imperial",
                                                      roundTemp: "true",
                                                      degreeLabel: "true",
                                                      showHumidity: "true"
                                              }
                                      },
                                      {
                                              module: "weatherforecast",
                                              position: "top_left",
                                              config: {
                                                      locationID: "4839416",
                                                      appid:"a8fcb80620f43f70c4e6141e5e0f09dc",
                                                      units: "imperial",
                                                      roundTemp: "true",
                                                      showRainAmount: "true"
                                              }
                                      },
                                      {
                                              module: 'MMM-fitbit',
                                              position: 'top_center',
                                              config: [
                                                      credentials: {
                                                              client_id: ,
                                                              client_secret: ,
                                              },
                                                      resources: [
                                                              'steps',
                                                              'floors',
                                                              'caloriesOut',
                                                              'distance',
                                                              'activeMinutes',
                                                              'sleep',
                                                              'heart'
                                                      ],
                                                      update_interval: 60
                                                      ]
                                       }
                      ]
                      
                      };
                      Mykle1M 1 Reply Last reply Reply Quote 0
                      • Mykle1M Offline
                        Mykle1 Project Sponsor Module Developer @Wiltify
                        last edited by Mykle1

                        @Wiltify

                        Completely missing for the bottom

                        /*************** DO NOT EDIT THE LINE BELOW ***************/
                        if (typeof module !== "undefined") {module.exports = config;}
                        

                        Create a working config
                        How to add modules

                        W 1 Reply Last reply Reply Quote 0
                        • W Offline
                          Wiltify @Mykle1
                          last edited by

                          @Mykle1 I have that, must not have copied when I brought it into here, whoops…

                          Mykle1M 1 Reply Last reply Reply Quote 0
                          • Mykle1M Offline
                            Mykle1 Project Sponsor Module Developer @Wiltify
                            last edited by

                            @Wiltify

                            I assume you removed the client id and client secret for this post?

                            Create a working config
                            How to add modules

                            W 1 Reply Last reply Reply Quote 0
                            • W Offline
                              Wiltify @Mykle1
                              last edited by

                              @Mykle1 Yes, but the module site has them inside of brackets instead of quatations, does that vary between developers formatting?

                              Mykle1M 1 Reply Last reply Reply Quote 0
                              • Mykle1M Offline
                                Mykle1 Project Sponsor Module Developer @Wiltify
                                last edited by

                                @Wiltify

                                I’m not familiar with this module. Try it as shown in the README. Try it without the brackets shown. Try it with quotes and without.

                                There are also some differences between your entry and this entry from the module site, as you call it. Can you see them? Correct them and try again. :-)

                                {
                                	module: 'MMM-fitbit',
                                	position: 'top_center',
                                	config: [
                                		credentials: {
                                			client_id: ,
                                			client_secret: ,
                                		},
                                		resources: [
                                			'steps',
                                			'floors',
                                			'caloriesOut',
                                			'distance',
                                			'activeMinutes',
                                			'sleep',
                                			'heart'
                                		],
                                		update_interval: 60
                                	]
                                },
                                

                                Create a working config
                                How to add modules

                                1 Reply Last reply Reply Quote 0
                                • ? Offline
                                  A Former User
                                  last edited by A Former User

                                  config: [] ???
                                  Usually config field is not array. So I think {} is right.

                                  Mykle1M 1 Reply Last reply Reply Quote 2
                                  • Mykle1M Offline
                                    Mykle1 Project Sponsor Module Developer @Guest
                                    last edited by

                                    @Sean

                                    Haha Sean, I was testing @Wiltify to see if he could notice the difference between his post and the entry from the README. I didn’t even notice the []. Good catch!

                                    Create a working config
                                    How to add modules

                                    W 1 Reply Last reply Reply Quote 0
                                    • W Offline
                                      Wiltify @Mykle1
                                      last edited by

                                      @Mykle1 @Sean Ha, I got so sucked up into adding modules I forgot to reply. Thanks Sean for pointing that out, I ran a command, which I can’t remember but it ended with "Config:check: and looks for errors, and it pointed out out the brackets so I changed those as well as something else. Mykle, thanks for pushing me to learn :) Already a huge fan of this community.

                                      Mykle1M 1 Reply Last reply Reply Quote 1
                                      • Mykle1M Offline
                                        Mykle1 Project Sponsor Module Developer @Wiltify
                                        last edited by

                                        @Wiltify said in Possible Error in My Code?:

                                        Mykle, thanks for pushing me to learn :) Already a huge fan of this community.

                                        Ahh, you’re welcome, mate.

                                        Create a working config
                                        How to add modules

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