Interesting lua-script!
Seems also well suited for application to read the JSON-files from KNMI, but 'just' a small detail to be solved, because the JSON-output files are different.
A JSON-file as output from DarkSky looks like
Code: Select all
{
"latitude": 52.29626465,
"longitude": 6.8055501,
"timezone": "Europe/Amsterdam",
"currently": {
"time": 1557341436,
"summary": "Lichte regen",
"icon": "rain",
"precipIntensity": 0.4394,
"precipProbability": 0.61,
"precipType": "rain",
"temperature": 12.28,
"apparentTemperature": 12.28,
"dewPoint": 9.92,
"humidity": 0.86,
"pressure": 995.11,
"windSpeed": 5.02,
"windGust": 10.22,
"windBearing": 208,
"cloudCover": 0.72,
"uvIndex": 0,
"visibility": 6.74,
"ozone": 417.53
},
The output from KNMI for my location looks like
Code: Select all
{
"liveweer": [
{
"plaats": "Hasselo",
"temp": "10.9",
"gtemp": "8.4",
"samenv": "Motregen en regen",
"lv": "93",
"windr": "ZO",
"windms": "4",
"winds": "3",
"windk": "7.8",
"windkmh": "14.4",
"luchtd": " 996.4",
"ldmmhg": "747",
"dauwp": "9",
"zicht": "7",
"verw": "Perioden met regen, ook (onweers)buien mogelijk met (zware) windstoten",
"sup": "05:46",
"sunder": "21:11",
"image": "regen",
"d0weer": "bewolkt",
"d0tmax": "18",
"d0tmin": "8",
"d0windk": "2",
"d0windknp": "4",
"d0windms": "2",
"d0windkmh": "7",
"d0windr": "Z",
"d0neerslag": "21",
"d0zon": "16",
"d1weer": "halfbewolkt",
"d1tmax": "15",
"d1tmin": "6",
"d1windk": "2",
"d1windknp": "6",
"d1windms": "3",
"d1windkmh": "11",
"d1windr": "ZW",
"d1neerslag": "70",
"d1zon": "40",
"d2weer": "regen",
"d2tmax": "14",
"d2tmin": "8",
"d2windk": "2",
"d2windknp": "6",
"d2windms": "3",
"d2windkmh": "11",
"d2windr": "W",
"d2neerslag": "80",
"d2zon": "20",
"alarm": "0"
}
]
}
With the script of aleph0 for read-out of DarkSky as basis, in analogy it means that generally not
"currently": , but
"liveweer": [ should be the key-value for json:decode()
Just
json:decode(liveweer) returns a nil-error.
Have tried various other, slightly expanded layouts, but not successful.
What is the appropriate layout to put that key-info for KNMI in the brackets of json:decode()?