**This is an old revision of the document!** ----
===== About the script ====== * Purpose : Get OpenWeather-data for given city. (current & next 10 days) * - binds weather-data as json to .self and binding-variables. * - refreshes every: data_refresh_interval_minutes * Author : Jappie Toutenhoofd (https://plus.google.com/+JappieToutenhoofd) * Link : https://plus.google.com/+JappieToutenhoofd/posts/ <code> var data_refresh_interval_minutes = 60; if ( self.APIcomm == null) {var api_script = LL.getScriptByName("APIcomm"); if (api_script == null) { alert( "Also import script 'APIcomm'. \n This script depends on it."); return;} LL.runScript('APIcomm', null); } if (self.owm == null) {self.owm = {}; self.owm.req = {}; self.owm.last = 0; self.owm.timer = 0; } //api.openweathermap.org/data/2.5 var Req1 = "http://api.openweathermap.org/data/2.5/"; var Req2 = "?q=hoofddorp,nl"; // <-- your city,land here !! Req2 += "&units=metric"; // or imperial Req2 += "&lang=nl"; // or other country code for language Req2 += "&APPID=59a20bd1ce89c6599758a2a0aeae9423"; self.owm.req.current = Req1 + "weather" + Req2; self.owm.req.forcast = Req1 + "forecast/daily" + Req2 + "&cnt=10"; self.owm.days = ["Zo","Ma","Di","Wo","Do","Vr","Za"]; function refreshOWM() { // prevent event flouding var nu = new Date(); if ((nu - self.owm.last) > (data_refresh_interval_minutes *60000)) { var repl = self.APIcomm(self.owm.req.current); if (repl == null){return;}; self.owm.current = JSON.parse(repl); LL.setVariableString("owm", repl); var repl = self.APIcomm(self.owm.req.forcast); if (repl == null){return;}; self.owm.forcast = JSON.parse(repl); self.owm.timer = setTimeout(refreshOWM, 600000); } } clearTimeout(self.owm.timer); refreshOWM(); </code>