Thats perfect!
Work like a charm! But again, im totally noob, so what do I do to get all 24 hours of the day?
I've done this: (changed the "5/5/ .. i," to 5/5/1.
It gives me 836,75000 in a 4 byte float object.
Work like a charm! But again, im totally noob, so what do I do to get all 24 hours of the day?
I've done this: (changed the "5/5/ .. i," to 5/5/1.
It gives me 836,75000 in a 4 byte float object.
Code:
url = 'https://api.energidataservice.dk/dataset/Elspotprices?offset=0&filter=%7B%22PriceArea%22:%22dk1%22%7D&sort=HourDK%20DESC&timezone=dk&limit=24'
resp = require('ssl.https').request(url)
data = require('json').decode(resp).records
max = 0
min = math.huge
sum = 0
for i, item in ipairs(data) do
price = item.SpotPriceDKK
max = math.max(max, price)
min = math.min(min, price)
sum = sum + price
grp.checkupdate('5/5/1', price)
end
avg = sum / #data
grp.checkupdate('5/5/25', avg)
grp.checkupdate('5/5/26', max)
grp.checkupdate('5/5/27', min)