addressstationcode = '16/0/0' addressstationregio = '16/0/1' addressstationnaam = '16/0/2' addresslat = '16/0/3' addresslon = '16/0/4' addressdatum = '16/0/5' addressluchtvochtigheid = '16/0/6' addresstemperatuurGC = '16/0/7' addresswindsnelheidMS = '16/0/8' addresswindsnelheidBF = '16/0/9' addresswindrichtingGR = '16/0/10' addresswindrichting = '16/0/11' addressluchtdruk = '16/0/12' addresszichtmeters = '16/0/13' addresswindstotenMS = '16/0/14' addressregenMMPU = '16/0/15' addresstemperatuur10cm = '16/0/16' addresslatGraden = '16/0/17' addresslonGraden = '16/0/18' --Beschikbare weerstations -- 1 = Venlo 27 = Goeree -- 2 = Arnhem 28 = Leeuwarden -- 3 = Berkhout 29 = Lelystad -- 4 = Cadzand 30 = West-Utrecht -- 5 = Utrecht 31 = Maastricht -- 6 = Den Helder 32 = Noordoostpolder -- 7 = Eindhoven 33 = Oost-Groningen -- 8 = Weert 34 = Oosterschelde -- 10 = Gilzen Rijen 35 = Rotterdam -- 11 = Goes 36 = Rotterdam Haven -- 12 = Oost-Overijssel 37 = Schaar -- 13 = Groningen 38 = Amsterdam -- 14 = Oost-Zeeland 39 = Midden-Zeeland -- 15 = Zwolle 40 = West-Friesland -- 16 = Gorinchem 41 = Texel -- 17 = Hoek van Holland 42 = Tholen -- 18 = Zuid-Zeeland 43 = Twente -- 19 = Hoogeveen 44 = West-Zeeland -- 20 = Wadden 45 = Vlieland -- 21 = Enkhuizen-Lelystad 46 = Vlissingen -- 22 = Schiermonnikoog 47 = Uden -- 23 = IJmond 48 = Terneuzen -- 24 = IJmuiden 49 = Hoorn -- 25 = Katwijk 50 = Wijk aan Zee -- 26 = Noord-Groningen 51 = Woensdrecht weerstation_naam = "Eindhoven" -- Vul hier het weerstation naam in. (Zie tabel hierboven) require('socket.http') socket.http.TIMEOUT = 15 local data = socket.http.request('http://xml.buienradar.nl/') --log(data) if not data then log('De weerdata kan niet worden opgehaald.') return end for i in string.gmatch(data, '') do if i ~= nil then stationcode = i:match([[(.-)]]) stationregio = i:match([[(.-)]]) lat = i:match([[(.-)]]) lon = i:match([[(.-)]]) datum = i:match([[(.-)]]) luchtvochtigheid = i:match([[(.-)]]) temperatuurGC = i:match([[(.-)]]) windsnelheidMS = i:match([[(.-)(.-)]]) windrichtingGR = i:match([[(.-)]]) windrichting = i:match([[(.-)]]) luchtdruk = i:match([[(.-)]]) zichtmeters = i:match([[(.-)]]) windstotenMS = i:match([[(.-)]]) regenMMPU = i:match([[(.-)]]) temperatuur10cm = i:match([[(.-)]]) latGraden = i:match([[(.-)]]) lonGraden = i:match([[(.-)]]) function titleCase( first, rest ) return first:upper()..rest:lower() end if weerstation_naam == stationregio then currentvalue = grp.getvalue(addressstationcode) if stationcode ~= currentvalue then grp.update(addressstationcode, stationcode) end currentvalue = grp.getvalue(addressstationregio) if stationregio ~= currentvalue then grp.update(addressstationregio, stationregio) end currentvalue = grp.getvalue(addressstationnaam) if stationnaam ~= currentvalue then grp.update(addressstationnaam, stationnaam) end currentvalue = grp.getvalue(addresslat) if lat ~= currentvalue then grp.update(addresslat, lat) end currentvalue = grp.getvalue(addresslon) if lon ~= currentvalue then grp.update(addresslon, lon) end currentvalue = grp.getvalue(addressdatum) if datum ~= currentvalue then grp.update(addressdatum, datum) end currentvalue = grp.getvalue(addressluchtvochtigheid) if luchtvochtigheid ~= currentvalue then grp.update(addressluchtvochtigheid, luchtvochtigheid) end currentvalue = grp.getvalue(addresstemperatuurGC) if temperatuurGC ~= currentvalue then grp.update(addresstemperatuurGC, temperatuurGC) end currentvalue = grp.getvalue(addresswindsnelheidMS) if windsnelheidMS ~= currentvalue then grp.update(addresswindsnelheidMS, windsnelheidMS) end currentvalue = grp.getvalue(addresswindsnelheidBF) if windsnelheidBF ~= currentvalue then grp.update(addresswindsnelheidBF, windsnelheidBF) end currentvalue = grp.getvalue(addresswindrichtingGR) if windrichtingGR ~= currentvalue then grp.update(addresswindrichtingGR, windrichtingGR) end currentvalue = grp.getvalue(addresswindrichting) if windrichting ~= currentvalue then grp.update(addresswindrichting, windrichting) end currentvalue = grp.getvalue(addressluchtdruk) if luchtdruk ~= currentvalue then grp.update(addressluchtdruk, luchtdruk) end currentvalue = grp.getvalue(addresszichtmeters) if zichtmeters ~= currentvalue then grp.update(addresszichtmeters, zichtmeters) end currentvalue = grp.getvalue(addresswindstotenMS) if windstotenMS ~= currentvalue then grp.update(addresswindstotenMS, windstotenMS) end currentvalue = grp.getvalue(addressregenMMPU) if regenMMPU ~= currentvalue then grp.update(addressregenMMPU, regenMMPU) end currentvalue = grp.getvalue(addresstemperatuur10cm) if temperatuur10cm ~= currentvalue then grp.update(addresstemperatuur10cm, temperatuur10cm) end currentvalue = grp.getvalue(addresslatGraden) if latGraden ~= currentvalue then grp.update(addresslatGraden, latGraden) end currentvalue = grp.getvalue(addresslonGraden) if lonGraden ~= currentvalue then grp.update(addresslonGraden, lonGraden) end end end end