Navigation

    Windy Community

    • Register
    • Login
    • Search
    • Unread
    • Categories
    • Groups
    • Go to windy.com

    WindyAPI: Start weatherforecast by default on page load?

    Windy API v4
    2
    4
    466
    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.
    • T
      TheStigh last edited by

      Hi,

      Is there a parameter I can set to start the forecast by default upon loading the page, rather than clicking the 'play' button? My project will be without a mouse/keyboard, that's the reason I want it to autostart/by timer etc...

      1 Reply Last reply Reply Quote 0
      • marekd
        marekd Administrator last edited by marekd

        @TheStigh Try store.set('animation', true); when initialize API.

        T 1 Reply Last reply Reply Quote 0
        • T
          TheStigh @marekd last edited by

          @marekd

          Did this:

          windyInit (options, windyAPI => {	
                  const {store,map,overlays} = windyAPI;
          	var overlay = store.get('overlay');
          	var windMetric = overlays.wind.metric;
          	store.set('overlay',this.config.showLayer);
          	store.set('animation',true);
          	overlays.wind.setMetric(this.config.windyMetric);
          	map.setZoom(this.config.zoomLevel);
          });
          

          I tried, but got:
          lib.js:6 Evented Failed to call animation TypeError: Cannot read property 'end' of undefined
          at w (lib.js:82)
          at lib.js:82
          at Object. (lib.js:82)
          at Object.emit (lib.js:16)
          at h (lib.js:47)
          at Object.i [as set] (lib.js:47)
          at windyAPI (MMM-WindyV2-dev.js:167)
          at m (lib.js:116)
          at lib.js:116

          1 Reply Last reply Reply Quote 0
          • T
            TheStigh last edited by

            @marekd

            I actually solved it a different way; by calling

            document.getElementById('playpause').click()
            

            Thanks anyway for the quick replies :)

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Windyty, S.E. - all rights reserved. Powered by excellent NodeBB
            NodeBB & contributors, OSM & contributors, HERE maps
            Terms and Conditions     Privacy Policy