This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Power price API -> grp. adresses on Wiser
#3
Thats perfect! Big Grin 
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)
Reply


Messages In This Thread
RE: Power price API -> grp. adresses on Wiser - by ClausP - 10.11.2022, 08:24

Forum Jump: