20.06.2018, 19:58
Both my scripts stopped working 26.05.2018.
Can anyone see what is wrong? Think I tried to fix it, but I messed around with so many different versions of the scripts that I lost track.
require('json')
require('ssl.https')
now = os.date('*t')
pickhour = now.hour + 1
date = os.date('*t')
date.day = date.day
param = os.date('%d-%m-%Y', os.time(date))
res = ssl.https.request('https://www.nordpoolgroup.com/Market-data1/Dayahead/Area-Prices/NO/Hourly/?dd=NO5&view=table' .. param)
values = {}
if res then
res = json.pdecode(res)
if type(res) == 'table' then
for _, row in ipairs(res.data.Rows) do
cols = row.Columns
value = cols[ 1 ].Value:gsub(',', '.')
values[ #values + 1 ] = tonumber(value)
end
end
end
grp.write('4/4/41', values[pickhour]) -- output address
Can anyone see what is wrong? Think I tried to fix it, but I messed around with so many different versions of the scripts that I lost track.
require('json')
require('ssl.https')
now = os.date('*t')
pickhour = now.hour + 1
date = os.date('*t')
date.day = date.day
param = os.date('%d-%m-%Y', os.time(date))
res = ssl.https.request('https://www.nordpoolgroup.com/Market-data1/Dayahead/Area-Prices/NO/Hourly/?dd=NO5&view=table' .. param)
values = {}
if res then
res = json.pdecode(res)
if type(res) == 'table' then
for _, row in ipairs(res.data.Rows) do
cols = row.Columns
value = cols[ 1 ].Value:gsub(',', '.')
values[ #values + 1 ] = tonumber(value)
end
end
end
grp.write('4/4/41', values[pickhour]) -- output address