WindyAPI: Start weatherforecast by default on page load?



  • 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...



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



  • @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



  • @marekd

    I actually solved it a different way; by calling

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

    Thanks anyway for the quick replies :)


Log in to reply
 

Windyty, S.E. - all rights reserved. Powered by excellent NodeBB
NodeBB & contributors, OSM & contributors, HERE maps