jclarke0000 / MMM-MyCommute

This a module for the MagicMirror. It shows your commute time using Google's Traffic API
67 stars 26 forks source link

MyCommute flooding the API - 1.73/ sec, when it is set to 10 minutes #31

Open nakulbende opened 4 years ago

nakulbende commented 4 years ago

Hello - Here is my config file with default poll frew. I gotit working, but it kept blinking at refreshing at a very high rate. Not sure why that was happening. I checked the API console, and was thankful for it. The module had posted 18724 queries in a couple of minutes! That is $139 worth of queries! Please help me with debugging this? I am using a RPi3, And following is my config file. I was checking the MM interface through VNC stream, if that has something to do with it.

Thanks in advance!

image

Just the MyCommute section:

// Commute
        {
            module: 'MMM-MyCommute',
            position: 'bottom_right',
            header: 'XXXX',
            classes: 'default everyone',
            config: {
                apikey: 'XXXX ',
                origin: 'XXXX',
                startTime: '06:00',
                endTime: '18:00',
                hideDays: [0,6],
                pollFrequency: '10 * 60 * 1000',
                destinations: [
                    {
                        destination: 'XXXX',
                        label: 'XXXX',
                        mode: 'transit',
                        color: '#82E5AA'
                    },
                    {
                        destination: 'XXXX',
                        label: 'XXXX',
                        mode: 'driving'
                    },
                    {
                        destination: 'XXXX',
                        label: 'XXXX',
                        mode: 'transit',
                        color: '#82E5AA'
                    },
                    {
                        destination: 'XXXX',
                        label: 'XXXX',
                        mode: 'driving'
                    }
                ]
            }
        },

The full config file:


/* 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 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: 12,
    units: "metric",

    // Modules //

    modules: [
        // Alert
        {
            module: "alert",
        },
        // Notifications
        {
            module: "updatenotification",
            position: "top_bar"
        },
        // Clock
        {
            module: "clock",
            position: "top_right",
            config: {
                timeFormat: '12',
                displaySeconds: 'false',
                showPeriod: 'true',
                clockBold: 'true',
                timezone: 'America/New_York' //Karachi
            }
        },
        // calendar
        {
            module: "calendar",
            //header: "Calenar",
            position: "top_right",
            config: {
                calendars: [
                    {
                        symbol: "island-tropical",
                        url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics"
                    },
                    {
                        symbol: "user-friends",
                        url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics"
                    }
                ]
            }
        },
        //Buller - this one will be todo in house
        {
            module: 'MMM-Buller',
            position: 'top_right',
            header: 'To Do',
            config: {
                debug: false,
                lists: [
                    {
                        type: 'gTasks',
                        name: 'HomeToDo',
                        updateInterval: 1000 * 60 * 1 * 1, //every minutes
                        icon: 'fas tasks',
                    }
                ],
            }
        },
        // dARKYsKY module
        {
            module: "MMM-DarkSkyForecast",
            header: "XXXXX",
            position: "top_left",
            classes: "default everyone",
            config: {
                apikey: "XXXX",
                latitude: "XXXX",
                longitude: "XXXX",
                iconset: "3c",
                concise: false,
                forecastLayout: "table",
                units: "us",
                maxHourliesToShow: "4",
                maxDailiesToShow: "4",
            }
        },
        // XKCD
        {
            module: 'DailyXKCD',
            position: 'bottom_left',
            config: {
                invertColors: true,
                showTitle: true,
                showAltText: true,
                randomComic: true
            }
        },
        // Bring shopping list
        {
            module: "MMM-Bring",
            position: "bottom_center",
            config: {
                email: "USER@EXAMPLE.COM",
                password: "SECRET",
                updateInterval: 15, // in Minutes
                listName: "Weggies", // optional
                showListName: true,
                activeItemColor: "#EE524F",
                latestItemColor: "#4FABA2",
                showLatestItems: false,
                maxItems: 0,
                maxLatestItems: 0,
                locale: "de-DE"
            }
        },
        // MBTA - Main x Emerson
        {
            module: 'MMM-MBTA',
            position: 'bottom_left', // This can be any of the regions.
            header: "XXXXXx",
            config: {
                apikey: 'XXXX',
                updateInterval: 30,
                stations: 'XXX',
                formatETA: 'true',
                showOnly: ["Subway", "Bus"],
                colorIcons: 'true',
                direction: 'Inbound',
                noETAToBack: 'false'
            }
        },
        // MBTA - Davis
        {
            module: 'MMM-MBTA',
            position: 'bottom_left', // This can be any of the regions.
            header: "XXXX",
            config: {
                apikey: 'XXXX',
                updateInterval: 20,
                stations: 'XXX": "XXX',
                formatETA: 'true',
                showOnly: ["Subway", "Bus"],
                colorIcons: 'true',
                flipDirection: 'true',
                direction: 'Inbound',
                noETAToBack: 'false'
            }
        },
        // Commute
        {
            module: 'MMM-MyCommute',
            position: 'bottom_right',
            header: 'XXXX',
            classes: 'default everyone',
            config: {
                apikey: 'XXXX ',
                origin: 'XXXX',
                startTime: '06:00',
                endTime: '18:00',
                hideDays: [0,6],
                pollFrequency: '10 * 60 * 1000',
                destinations: [
                    {
                        destination: 'XXXX',
                        label: 'XXXX',
                        mode: 'transit',
                        color: '#82E5AA'
                    },
                    {
                        destination: 'XXXX',
                        label: 'XXXX',
                        mode: 'driving'
                    },
                    {
                        destination: 'XXXX',
                        label: 'XXXX',
                        mode: 'transit',
                        color: '#82E5AA'
                    },
                    {
                        destination: 'XXXX',
                        label: 'XXXX',
                        mode: 'driving'
                    }
                ]
            }
        },
    ]
};

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

Don't use quotes around your poll frequency configuration. It needs to be: pollFrequency: 10 * 60 * 1000 instead of: pollFrequency: '10 * 60 * 1000'