29.05.2022, 22:04
Hi. I want to read out the current hourly power prices (Dutch EPEX spot market). With this info I want to switch on heavy power users (car charging, airco etc) and switch off my solar panels when the market prices are below -/-0,06729 per kWh (since then the energy taxes don't compensate the negative market price, taxes are 0,03679 per kWh + 0,0305 per kWh). I found a website where I can read out these prices, but how can I let a script return the hourly values in a way I can make decisions with it?
With this simple script (where I've put in the time range of 1 day), I get the following output;
--/--
local https = require('ssl.https')
local ltn12 = require('ltn12')
local json = require('json')
local cBody = 'TariffReturn'
local cReq = {}
result1 = https.request({
url = 'https://mijn.easyenergy.com/nl/api/tariff/getapxtariffs?startTimestamp=2022-05-29T22%3A00%3A00.000Z&endTimestamp=2022-05-30T22%3A00%3A00.000Z&grouping=',
method = 'GET',
headers = {
['content-length'] = #cBody,
['content-type'] = 'application/json'
},
source = ltn12.source.string(cBody),
sink = ltn12.sink.table(cReq)
})
if (cReq) then
mydata = json.pdecode(table.concat(cReq))
log(mydata)
end
--/--
In the output I refer to this part:
--/
....
[4]
* table:
["Timestamp"]
* string: 2022-05-30T01:00:00+00:00
["TariffReturn"]
* number: 0.1845
["TariffUsage"]
* number: 0.223245
["SupplierId"]
* number: 0
/--
where ' ["TariffReturn"]
* number: 0.1845
the price per kWh is for every kWh consumed (or delivered) between 2022-05-30, 04.00 - 05.00u
The notation is a little bit confusion, since the table states it is at 01.00.
I check the output of easyenergy with one of the other EPEX spot market parties: https://prijzen.powerhouse.net/forecast/
Any help is welcome.
Jeroen
With this simple script (where I've put in the time range of 1 day), I get the following output;
--/--
local https = require('ssl.https')
local ltn12 = require('ltn12')
local json = require('json')
local cBody = 'TariffReturn'
local cReq = {}
result1 = https.request({
url = 'https://mijn.easyenergy.com/nl/api/tariff/getapxtariffs?startTimestamp=2022-05-29T22%3A00%3A00.000Z&endTimestamp=2022-05-30T22%3A00%3A00.000Z&grouping=',
method = 'GET',
headers = {
['content-length'] = #cBody,
['content-type'] = 'application/json'
},
source = ltn12.source.string(cBody),
sink = ltn12.sink.table(cReq)
})
if (cReq) then
mydata = json.pdecode(table.concat(cReq))
log(mydata)
end
--/--
In the output I refer to this part:
--/
....
[4]
* table:
["Timestamp"]
* string: 2022-05-30T01:00:00+00:00
["TariffReturn"]
* number: 0.1845
["TariffUsage"]
* number: 0.223245
["SupplierId"]
* number: 0
/--
where ' ["TariffReturn"]
* number: 0.1845
the price per kWh is for every kWh consumed (or delivered) between 2022-05-30, 04.00 - 05.00u
The notation is a little bit confusion, since the table states it is at 01.00.
I check the output of easyenergy with one of the other EPEX spot market parties: https://prijzen.powerhouse.net/forecast/
Any help is welcome.
Jeroen