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)?
I know it’s an old topic but may I suggest the API offered by ENTSOE? An organization located in Brussels; probably under EU umbrella. They describe themselves as following: “Central collection and publication of electricity generation, transportation and consumption data and information for the pan-European market.”
This REST API works for Europe and prices from Nordpool and others are collected by ENTSOE. This means only one API/plugin that covers Europe and delivers hourly prices in Euro per region within each country.
The following link gives all the details on the API and how to obtain a userid/token: Static Content
Another possibility I want to mention is the smart meter device from https://amsleser.no/. I am not affiliated to them in any way.
The device gives you a website with all the info from your smart meter including hourly prices (btw through ENTSOE) in your currency of choice and for your own region. For the purpose of automation it has both a REST API and MQTT interface. Works with most European smart meters. Their code is on github so if you’re handy with ESP286 you could save yourself some money probably.
I was planning to use the ENTSOE API directly but then amsleser.no did a major upgrade what gives me all prices details.
A bit off-topic but what I still miss is an API with prediction of prices for the next couple of days. Based on current trading prices it should be possible for Nordpool and others to publish a forecast. But such is for sure outside of the mandate for Nordpool and ENTSOE. It would help me great in deciding eg. when to charge my car; is it best to do this today or tomorrow or in the weekend? Right now I just have to guess; sometimes I could have charged the car for half the price or less only if I would have guessed better.