MagicMirror² v2.4.1 is available! For more information about this release, check out this topic.
Please read the release notes carefully since this update requires adjustments to your Raspberry Pi configuration!

Possible Error in My Code?



  • 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;}
    


  • @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',
    

    😉


  • Module Developer

    @Wiltify said in Possible Error in My Code?:

    position: “top_left”

    Needs a comma position: "top_left",



  • @Mykle1

    Thank you, humbling moment of the day.


  • Module Developer

    @Wiltify said in Possible Error in My Code?:

    Thank you, humbling moment of the day.

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



  • You’re welcome…



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


  • Module Developer

    @Wiltify said in Possible Error in My Code?:

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

    Cowboysdude is a freakin Guru!



  • 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
                                    ]
                     }
    ]
    
    };

  • Module Developer

    @Wiltify

    Completely missing for the bottom

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