Hello,
Is there any possible way to get Nordpool electricity spot prices as a plugin for nymea?
I’ve read that nordpool has an API, but to use it, one should be a customer…
Is there any official and leagal way around this?
The background of this question is that i’d like to make a RGB lightbulb work as a traffic light telling family members when the electricity is cheap… The winter is coming.
Well, not sure about Nord Pool, however, as far as I know, the spot market prices are the same for all suppliers. Well, the price itself obviously not, but the curve. Meaning, when Nord Pool offers the cheapest price, other spot market enabled providers would have the cheapest price too. This in turn means you should be able to use the existing awattar plugin for your use case.
The prices are country specific. Some countries have multiple zone also. It probably depens on what is the portfolio of energy sources(wind, nuclear etc…)
I found a ready-made plugin called aWATTar DE that was sort of suitable for energy pricing statistics. There is some tax-related calculation which I have not yet understood so the price is not totally accurate, but pretty close.
I use HTTP Request - plugin for the actual price - request and then store the price to the aWATTar - plugin for statistics.
Currently I only get the current spot price - not sure if it is possible to expand from there or whether it would be easier just to write completely new plugin for the purpose.
HTTP Request plugin is configured with address https://api.spot-hinta.fi/JustNow and port 443
aWATTar is configured with default values
Anyway here is the script if it helps anyone. You could - using this - have some events emitted in the case price exceeding / going below some tresholds or alike.
I will post if I make any further progress
import QtQuick 2.0
import nymea 1.0
Item {
ThingAction {
thingId: "http-plugin-id-here" // Get Spot Price Just Now
id: spotPrice
actionName: "request"
}
ThingState {
id:spotPriceResponse
thingId: "http-plugin-id-here" // Get Spot Price Just Now
stateName: "response"
}
ThingState {
id:spotPriceStatus
thingId: "http-plugin-id-here" // Get Spot Price Just Now
stateName: "status"
}
ThingState {
id: currentMarketPrice
thingId: "aWATTar-id-here" // aWattar Energy meter
stateName: "currentMarketPrice"
}
ThingState {
thingId: "aWATTar-id-here" // aWattar Energy meter
stateName: "validUntil"
id: currentPriceValidUntil
}
Timer {
running: true
id:timer
interval: 1000 // Fire almost immediately
repeat: true
onTriggered: {
timer.interval = 10*60*1000 // every 10 min
spotPrice.execute({"body": "", "method": "GET"});
console.log("status: ", spotPriceStatus.value, " response: ", spotPriceResponse.value );
currentMarketPrice.value = parseFloat(JSON.parse(spotPriceResponse.value)["PriceWithTax"]);
// console.log("spotPriceResponse:", parseFloat(JSON.parse(spotPriceResponse.value)["PriceWithTax"]));
console.log("currentMarketPrice: ", currentMarketPrice.value);
//console.log("dateTime", Date.parse(JSON.parse(spotPriceResponse.value)["DateTime"])+3600*1000);
currentPriceValidUntil.value = (Date.parse(JSON.parse(spotPriceResponse.value)["DateTime"])+3600*1000); // DateTime + 1 hour
console.log("currentPriceValidUntil:", currentPriceValidUntil.value );
}
}
}
The log looks like and the script fires every N minutes (10 currently in the example)
There is some calculus about the time – API returns start time of a slot while aWATTar has the end- timestamp.
Hi, Yes i did replace those, there are no errors.
The line: currentMarketPrice.value = parseFloat(JSON.parse(spotPriceResponse.value)["PriceWithTax"]);
just does nothing and the currentMarketPrice is the German current price.
At the moment the testing is somewhat difficult because the prices are the same in FI&DE. After couple hours there will be difference.
If I change the code to “currentMarketPrice.value = 123;”, the output remains the same…
Have I misundertood something(could very well be so)?