Trying to use MMM-MyCommute, config.js doesn't look right



  • So I downloaded the MMM-MyCommute module (https://github.com/jclarke0000/MMM-MyCommute); I followed the Installation instructions, and went to set up my config.js file. When I began entering the config for MMM-MyCommute, I noticed it looks different - the string values for MMM-MyCommute aren’t colored yellow like all my other modules are. I just can’t figure out what the deal is. Any help you can provide would be very…well, helpful.

    I’ve tried including my config.js file below, I hope it worked. I’d consider myself an advanced beginner when it comes to the required skills for this, so keep that in mind, if you please.

    SSH into pi, then here’s a summary of commands I used:

    cd ~/MagicMirror/Modules
    git clone https://github.com/jclarke0000/MMM-MyCommute.git
    cd ~/MagicMirror/Modules/MMM-MyCommute
    npm install
    

    I then got a Google Maps API key, and tried to edit my config.js file; see 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 REDACTED :
                                                                   // ["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: 12,
            units: "metric",
    
            modules: [
                    {
                            module: "alert",
                    },
                    {
                            module: "updatenotification",
                            position: "top_bar"
                    },
                    {
                            module: "clock",
    
    ```                        position: "top_left"
                    },
                    {
                            module: "calendar",
                            header: "Today",
                            position: "top_left",
                            config: {
                                    maximumEntries: 5,
                                    calendars: [
                                            {
                                                    symbol: "calendar",
                                                    url: "calendarURL"
                                                    auth:{
                                                            user: "username",
                                                            pass: "secretpassword",
                                                            method: "basic"
                                                    }
                                            },
                                    ],
                            }
                    },
                    {
                            module: "MMM-WunderGround",
                            position: "top_right",
                            config: {
                                    apikey: "secretAPI",
                                    pws: "weatherstationID",
                                    units: "imperial",
                                    hourly: "1",
                                    fctext: "1",
                                    coloricon: "true",
                                    fcdaycount: "1",
                                    hourlyinterval: "3",
                                    hourlycount: "2",
                                    alerttime: "10000",
                                    roundTmpDecs: 0,
                                    layout: "vertical"
                                    }
                    },
                    {
                            module: "MMM-DailyBibleVerse",
                            position: "bottom_bar",
                            config: {
                                    feeds: [
                                            {
                                                    version: "ESV"
                                            }
                                    ],
                            },
                    },
                    {
                            module: ‘MMM-MyCommute‘,
                            position: “bottom_left”,
                            header: “My Drive”,
                            config: {
                                    apikey: “AIzaSyBfJfAgexEpef8VbtTEv6XfyiYTx-4QAge8”
                                    origin: “123 My Street, My City, ST 12345”,
                                    startTime: “20:00”,
                                    endTime: “22:00”,
                                    hideDays: [0,6],
                                    destinations: [
                                            {
                                                    destination: “456 Work Address, City, State ZIP”,
                                                    label: “work”,
                                                    mode: “driving”,
                                            },
                                    ],
                            },
                    }
    //              {
    //                      module: 'MMM-Xmas',
    //                      position: 'fullscreen_above'
    //              }
            ]
    
    }
    
    /*************** DO NOT EDIT THE LINE BELOW ***************/
    if (typeof module !== "undefined") {module.exports = config;}
    


  • There are some ``` in your clock module.

    in your MyCommute u use the wrong " " (try to use another editor in future)

    no comma , behind the apikey

    in the normal calendar module there is no comma , behind the URL

    missing semicolon in last line

    So try this:

    /* 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 REDACTED :
                                                                   // ["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: 12,
            units: "metric",
    
            modules: [
                    {
                            module: "alert",
                    },
                    {
                            module: "updatenotification",
                            position: "top_bar"
                    },
                    {
                            module: "clock",
    
                            position: "top_left"
                    },
                    {
                            module: "calendar",
                            header: "Today",
                            position: "top_left",
                            config: {
                                    maximumEntries: 5,
                                    calendars: [
                                            {
                                                    symbol: "calendar",
                                                    url: "calendarURL",
                                                    auth:{
                                                            user: "username",
                                                            pass: "secretpassword",
                                                            method: "basic"
                                                    }
                                            },
                                    ],
                            }
                    },
                    {
                            module: "MMM-WunderGround",
                            position: "top_right",
                            config: {
                                    apikey: "secretAPI",
                                    pws: "weatherstationID",
                                    units: "imperial",
                                    hourly: "1",
                                    fctext: "1",
                                    coloricon: "true",
                                    fcdaycount: "1",
                                    hourlyinterval: "3",
                                    hourlycount: "2",
                                    alerttime: "10000",
                                    roundTmpDecs: 0,
                                    layout: "vertical"
                                    }
                    },
                    {
                            module: "MMM-DailyBibleVerse",
                            position: "bottom_bar",
                            config: {
                                    feeds: [
                                            {
                                                    version: "ESV"
                                            }
                                    ],
                            },
                    },
                    {
                            module: "MMM-MyCommute",
                            position: "bottom_left",
                            header: "My Drive",
                            config: {
                                    apikey: "AIzaSyBfJfAgexEpef8VbtTEv6XfyiYTx-4QAge8",
                                    origin: "123 My Street, My City, ST 12345",
                                    startTime: "20:00",
                                    endTime: "22:00",
                                    hideDays: [0,6],
                                    destinations: [
                                            {
                                                    destination: "456 Work Address, City, State ZIP",
                                                    label: "work",
                                                    mode: "driving",
                                            },
                                    ],
                            },
                    },
    //              {
    //                      module: 'MMM-Xmas',
    //                      position: 'fullscreen_above'
    //              }
            ]
    
    };
    
    /*************** DO NOT EDIT THE LINE BELOW ***************/
    if (typeof module !== "undefined") {module.exports = config;}
    

    if u run into this problem again, try www.jshint.com ;)

    or use ssh and do this: https://forum.magicmirror.builders/topic/5399/how-to-check-your-config-for-errors-for-absolute-beginners



  • @cruunnerr YAS this worked.

    I used jshint.com - which I’d never heard of - and it helped me figure out what was wrong! It was a combination of stupid syntax errors and using a different editor.

    Thanks to you, I’ve got it up and running beautifully. You’re my new best internet friend.



  • @deerbelac said in Trying to use MMM-MyCommute, config.js doesn’t look right:

    You’re my new best internet friend.

    LOL

    you are welcome mate ;)


Log in to reply
 

Looks like your connection to MagicMirror Forum was lost, please wait while we try to reconnect.