Nordpool spot prices

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.

BR,Olli

1 Like

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 brand new api for Finnish prices:
http://spot-hinta.fi/
Its in Finnish, but chromes translator may work?
The API itself is in english:
https://api.spot-hinta.fi/swagger/ui

If only i would have the knowhow on bulding a plugin…

Br,Olli

Hi

Found this thread as a quite recent Nymea -user

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.

44: status: 200 response: { "Rank": 19, "DateTime": "2022-12-06T15:00:00+02:00", "PriceNoTax": 0.3200, "PriceWithTax": 0.3520 }
47: currentMarketPrice: 44.61
50: currentPriceValidUntil: 1670331600

Best Regards
// Marko

Hi Marko!

I just tried that script and looks like storing the currentMarketPrice.value is not working in it.

BR, Olli

What is the exact error?
What do you see in the logs?
Have you installed both of the plugins?

Not sure if we can have a version difference - not sure how to check the plugin versions.

Trying also to think if there is any other plugin that would be significant in this case.

// Marko

And did you replace the thing-id:s with your own values?

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)?

-Olli

:man_facepalming:
You are correct.
Happened to be exactly same prices when I was testing.

It needs a conversion for the finnish api / similar implementation. Not sure when I would have time for such.

Hey folks.

That’s a pretty cool hack you did there with the http commander plugin + script engine :slight_smile:

Thanks for collecting all the information and the API. That made it easy to create a plugin for it:

It’s currently building in experimental. I’ll need to ask if we can make a feature freeze exception to include it in the 1.6 release still…

Yes, we can add this to the 1.6 release still.