Logic Machine Forum
KNMI Weather Data Netherlands - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: KNMI Weather Data Netherlands (/showthread.php?tid=3052)



KNMI Weather Data Netherlands - KoBra - 07.12.2020

Dears,

i made a script that i am using in resident mode to poll the data but instead of 60sec i want 600sec polling time as the weatherdata of the KNMI (Dutch meteo agency) is also refreshed from the official weather stations every 10 minutes. So there is no need to poll more.

With the free service of weerlive.nl you are limited to 300 polls a day which is no problem when you do 6x24= 144 updates they only publish. How can i extend the polling time over 60 seconds for a resident script?

https://weerlive.nl/delen.php
http://weerlive.nl/api/json-data-10min.php?key=demo&locatie=Amsterdam


RE: KNMI Weather Data Netherlands - Daniel - 07.12.2020

Use Scheduled script and put */10 in minute.


RE: KNMI Weather Data Netherlands - KoBra - 07.12.2020

(07.12.2020, 16:11)Daniel. Wrote: Use Scheduled script and put */10 in minute.
Thanks a lot!


RE: KNMI Weather Data Netherlands - KoBra - 08.12.2020

ps. the script is attached in the first post if somebody wants to use it. More info on the website https://weerlive.nl/delen.php how to use it


RE: KNMI Weather Data Netherlands - Erwin van der Zwart - 09.12.2020

Tip: Change grp.write() into grp.checkwrite() to avoid writing to +50 objects each run (probably only a few points are changed in the whole set) and cleanup your code, there are +50 vars filled with data and not used.


RE: KNMI Weather Data Netherlands - KoBra - 09.12.2020

Don't know what you mean with "there are +50 vars filled with data and not used."


RE: KNMI Weather Data Netherlands - admin - 09.12.2020

You have variables assigned but not used anywhere.
Code:
plaats = data.plaats
...
grp.write('32/2/1', data.plaats)



RE: KNMI Weather Data Netherlands - KoBra - 09.12.2020

(09.12.2020, 12:45)admin Wrote: You have variables assigned but not used anywhere.
Code:
plaats = data.plaats
...
grp.write('32/2/1', data.plaats)

sorry i am a noob to scripting so i am trying to understand. If i didn't use the plaats = data.plaats i got no data.

i tried first: grp.write('32/2/1', plaats) but no data came in. After adding plaats = data.plaats it started working.


RE: KNMI Weather Data Netherlands - Erwin van der Zwart - 09.12.2020

That does not make sense (: and never seen an issue that looks like that..

The script is running top to bottom and when plaats = data.plaats works you can use the var plaats or data.plaats, but if it fails then neither work as plaats is dependent of data.plaats

Your code grp.checkwrite('x/x/x', data.plaats) is enough and there is no need to assign it to a var first..

What you say can be right if you use grp.write('x/x/x', plaats) without plaats = data.plaats, but your command is grp.write('x/x/x', data.plaats) and is using the parsed json data directly..


RE: KNMI Weather Data Netherlands - KoBra - 11.12.2020

Updated and tested it, and you where right it works so i attached it for others that want to use it.

The main reason i use it is for the feel temperature as a temperature compensated for windspeed and humidity to control a weather dependent setpoint for a heating buffer. 

Besides that you can use it for a free 2 day in advance weather forecast in the visualization