Have a script extracting & querying that file.
Below the lines in that script which pull the json-file and perform the decoding.
All well with decoding, except for the last 2 lines related to meteoalarm:
expected to be more of the same, but no output coming.
val_Alarm is a value 0 or 1
AlarmText is a text string, comparable to summary0 or summary0~summary3
Somebody seeing what is 'wrong'?
[for obvious reasons in this code-listing the apikey is a placeholder]
Code: Select all
-- Line 075 = Querying KNMI
json = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")() -- For Linux
-- result=os.capture('curl -s "http://weerlive.nl/api/json-data-10min.php?key='..api_key..'&locatie='..coord..'"')
result=os.capture('curl -s "http://weerlive.nl/api/json-data-10min.php?key=abcdefghi&locatie=52.29626465,6.80555010"')
-- if (DEBUG == 1) then print(result) end
--
-- Line 081 = Reading values from json
local jsonValeur = json:decode(result)
val_Patm =jsonValeur.liveweer[1].luchtd
val_Tact =jsonValeur.liveweer[1].temp
val_Tgvl =jsonValeur.liveweer[1].gtemp
val_sup =jsonValeur.liveweer[1].sup
val_sunder =jsonValeur.liveweer[1].sunder
summary0 =jsonValeur.liveweer[1].samenv
val_Tmin =jsonValeur.liveweer[1].d0tmin
val_Tmax =jsonValeur.liveweer[1].d0tmax
icon =jsonValeur.liveweer[1].image
summary1 =jsonValeur.liveweer[1].verw
summary2 =jsonValeur.liveweer[1].d1weer
val_Tmin2 =jsonValeur.liveweer[1].d1tmin
val_Tmax2 =jsonValeur.liveweer[1].d1tmax
summary3 =jsonValeur.liveweer[1].d2weer
val_Tmin3 =jsonValeur.liveweer[1].d2tmin
val_Tmax3 =jsonValeur.liveweer[1].d2tmax
val_Alarm =jsonValeur.liveweer[1].alarm
AlarmText =jsonValeur.liveweer[1].alarmtxt