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.

    Can someone help me understand "updateInterval"? DarkSky is charging me a lot of money.

    Scheduled Pinned Locked Moved Troubleshooting
    10 Posts 7 Posters 1.6k Views 6 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.
    • C Offline
      cotxwx
      last edited by

      I must have done something really wrong because I’m paying a good bit of coin to DarkSky for API calls. This is for the MMM-NOAA3 module.

      updateInterval: 15 * 60 * 1000, //every 15 minutes or whatever you choose
      

      that’s the original ^ and I updated the 15 to 60.

      I guess I don’t understand what each number represents. Milliseconds, Seconds, Minutes?

      I don’t know how, but I had 25k API calls to DarkSky yesterday. Trying to cut this number down. I’d just like to have it update twice hourly if at all possible (it’s current temps / extended weather forecast).

      lavolp3L R T A 5 Replies Last reply Reply Quote 0
      • lavolp3L Offline
        lavolp3 Module Developer
        last edited by

        the updateInterval is not necessarily the API fetch interval. Usually it is used as an update Interval for your content.

        DarkySky have changed their API billing for new subscribers and I believe there are no free plans available anymore.
        Did you subscribe just recently?
        What is your tier/plan?
        Do you know which interval you’d need to get free API calls?

        Before you throw money at them, there are many free weather services out there and someone may have already reprogrammed your module to use another (free) API provider.

        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

          "Your trial account allows up to 1,000 free calls per day to evaluate the Dark Sky API. If you would like > to make more than 1,000 calls per day, simply enter billing information to upgrade to a full account. "

          So you need to stay below 1,000 calls/day.
          I have seen that MMM-NOAA uses a new API provider, weatherbit.

          You might want to do an update.

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

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

            @cotxwx
            Also,

            scheduleUpdate: function() {
                    setInterval(() => {
                        this.getNOAA();
                    }, this.config.updateInterval);
                    this.getNOAA(this.config.initialLoadDelay);
                },
            

            this code shows that the API calls really are determined by updateInterval (as you thought).
            Here something comes into play that I stumbled upon.

            If you have several entities of the mirror open, let’s say you are also using a browser e.g. to develop, the main.js (and hence the setInterval function) will be started a second, third, fourth etc. time.
            In that case you would have SEVERAL interval cycles asking for an API call every x minutes.
            That can blow the API call ratio.
            Don’t know if that’s the case with you.

            That’s why I try to keep an API call cycle always inside the node_helper.js and have it start only once in my modules.

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

            1 Reply Last reply Reply Quote 0
            • S Offline
              sonicgoose
              last edited by

              @cotxwx I’m using the MMM-DarkSkyForecast module on two different mirrors, both using the same API key for DarkSky, and the total number of API calls made on my account averages 96 per day. Here’s my config:

              		{
              			module: "MMM-DarkSkyForecast",
              			//header: "Weather",
              			position: "top_right",
              			classes: "default everyone",
              			disabled: false,
              			config: {
              			    apikey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
              			    latitude: "43.XXXXXX",
              			    longitude: "-79.XXXXXX",      
              			    updateInterval: "30", //this is in minutes, so every 30 minutes
              			    iconset: "3c",
              			    showCurrentConditions: true,
              			    showExtraCurrentConditions: false,
              			    showSummary: true,
              			    showForecastTableColumnHeaderIcons: false,
              			    concise: true,
              			    forecastLayout: "table", //other option is "table"
               		 	}
              		},
              
              1 Reply Last reply Reply Quote 0
              • R Offline
                raymondjspigot @cotxwx
                last edited by

                updateInterval: 15 * 60 * 1000, //every 15 minutes or whatever you choose
                

                that’s the original ^ and I updated the 15 to 60.

                I guess I don’t understand what each number represents. Milliseconds, Seconds, Minutes? >

                Hi @cotxwx - I think the updateInterval in the original is currently set to 15 minutes. The time will be based in milliseconds, so reading it right-to-left that gives you

                1000 (milliseconds per second) x 60 (seconds per minute) x 15 = a 15 minute interval

                which I think ends up being clearer than just giving a sort of anonymous/unit-free total (e.g. 900000 or something like that)

                hope this helps anyway

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @raymondjspigot
                  last edited by

                  @raymondjspigot these should all be adjusted to minutes for the user, and multiply under the covers to avoid this unnecessary confusion

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

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

                    @cotxwx You mentioned MMM-NOAA3.
                    The readme gives the possibility to choose other APIs.
                    I would suggest to do that.

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

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      taikonaut @cotxwx
                      last edited by

                      @cotxwx maybe you just want to switch the module…

                      The fork
                      https://github.com/gerjomarty/MMM-DarkSkyForecast

                      uses the openweather API. Works like charm.

                      1 Reply Last reply Reply Quote 0
                      • A Offline
                        Amninnar @cotxwx
                        last edited by

                        @cotxwx There is some new info about it and how it goes?

                        1 Reply Last reply Reply Quote 0
                        • 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