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.

    Limit API calls by deactivating the modul based on time?

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    5 Posts 2 Posters 68 Views 2 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.
    • K Offline
      Kastore
      last edited by

      Hey everyone,

      I got the MM-TomTomCalculateRouteTraffic module and it is making calls with a TomTom API - now i would like to have really high amount of calls in the morning (about once every 30s) and non after a certain time.

      Is it possible to config a module to be deactivated after a certain time? e.g. run it from 7-8am and then not?

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

        @Kastore MMM-ModuleScheduler can show/hide based on a schedule…

        when hidden modules should stop accessing apis… many don’t…
        this module does not…

        One could add a couple small routines to support this, every module is different in what they need to do… stop timers, start timers, …

        suspend()
        https://docs.magicmirror.builders/module-development/core-module-file.html#suspend

        and resume()
        https://docs.magicmirror.builders/module-development/core-module-file.html#resume

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        K 1 Reply Last reply Reply Quote 0
        • K Offline
          Kastore @sdetweil
          last edited by

          @sdetweil
          Okay that makes sense to stop and resume them but i am guessing i would need to somehow code the hide and show into the module as well.
          Since i got no clue on coding i am not sure if that will help me unforunately

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

            @Kastore hide and show are MagicMirror functions
            suspend and resume are the functions the module needs to implement

            MMM-ModuleScheduler calls the MagicMirror hide/show

            You can try it now, but this module will keep making api requests while hidden.

            Maybe you could open an issue on the module GitHub to engage the author to add those routines

            Sam

            How to add modules

            learning how to use browser developers window for css changes

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

              I submitted a pull request to the original repo

              you can try my fork in the meantime

              stop mm
              cd ~/MagicMirror/modules
              -rename the existing module folder to some other name
              git clone https://github.com/sdetweil/MMM-TomTomCalculateRouteTraffic
              git checkout withsuspend
              

              then restart mm
              then if you use ModuleScheduler or pages, carousel, or other modules that support hiding and showing you could validate that no api calls are made during the hidden time

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              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