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.

    Weather Location / Calendar Format / Fast boot

    Scheduled Pinned Locked Moved Troubleshooting
    12 Posts 5 Posters 10.8k Views 4 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.
    • mochmanM Offline
      mochman Module Developer
      last edited by mochman

      I modified the default module to look for a lat/long or a locationID before it uses the name you put in the config.js.
      The location ID is specific and unambiguous so you shouldn’t get any location errors.

      If you want to modify your code to use a locationID (which you can get here) put this in weatherforecast.js

      in your config.js in the weatherforecast config: { section add:

      locationID: 'YOUR_LOCATION_ID',

      under the “defaults” section add:
      locationID: "",

      change getParams: function()… to

      getParams: function() {
         var params = "?";
         if(this.config.locationID !== "") {
            params += "id=" + this.config.locationID;
         } else {
            params += "q=" + this.config.location;
         }
         params += "&units=" + this.config.units;
         params += "&lang=" + this.config.lang;
         params += "&cnt=" + (((this.config.maxNumberOfDays < 1) || (this.config.maxNumberOfDays > 16)) ? 7 : this.config.maxNumberOfDays);
         params += "&APPID=" + this.config.appid;
         return params;
      },
      

      Moderator note: Please use proper markdown for easier reading.

      M 1 Reply Last reply Reply Quote 0
      • M Offline
        mbartels @mochman
        last edited by

        @mochman Thanks for your help. I’ll try it, when I am working the next time on my Magic Mirror.

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