Electricity Day Ahead Prices for Home Assistant using Node-Red and Entso-E API

Yeah,

Checking again the Restful API it says the following:

It is important to take area’s timezone into consideration, as well as winter/summer time. For example, consider the day of February 2 2016 in CET. This is during winter time and hence using UTC this day is considered to start at 2016-01-01 at 23:00 and end at 2016-01-02 at 23:00. As another example, the day of July 5 2016 in CET is during summer time and using UTC this day is considered to start at 2016-07-04 at 22:00 and end at 2016-07-05 at 22:00.

…which means that we actually do not need the DST checking at all. The server also makes the one hour shift in it’s response, so we can remove the check DST route.

The other interesting thing is, that there actually is one extra value for 30.10., the 3:00 value is doubled and altogether we get 25 values for that day, which is correct in this situation though. The two 03:00 values are also different, which also makes sense; there of course is a bit different pricing environment for both these 03:00 hours.

Because of this there was a 1 hour shift for the rest of the day, this kind of indexed method of getting the values did not “see that coming”

Also, the periodEnd value of all the url’s generated in the 3 generate urls blocks should be set to 22:00 to avoid the range from going to another day’s range, in which case it would return two 24 hour sets of values.

So the url should be e.g. in yesterday url of form:

https://web-api.tp.entsoe.eu/api?securityToken=MY_TOKEN_HERE&documentType=A44&in_Domain=10YFI-1--------U&out_Domain=10YFI-1--------U&periodStart="+yesterdayString+"0000&periodEnd="+yesterdayString+"2200"

Let’s keep an eye on it after the changes for few days… However, with this structure I can foresee similar hassle in the spring again, not because of the DST change itself, but because of the missing hour, there will be one day with only 23 values for the day returned…

Anyway, because of the general debate around this DST, it could be that we do not have it anymore in the spring

Thank you for this! Something like this I was also about to conclude inbthe morning but it helps to get another opinion for this!

And yes the weird value as the first price value today was truly the 24th hour (index 23) and it also didn’t know the 25th (no index 24) hour of the day. Small error and happens only twice per year :blush:

I installed it and al data is coming in! Nice work!,
I live in a appartement and no space voor pv panels. It would be wonderfull if natural gas price can be added in a coming version. Then I can compare price MJoule eletricity with price MJoule natural gas.
Then I could try switching between heating with gas or electricity.

1 Like

Hello,
I did made copy configuration of Hhalewijn.
But I get the same problem.
node-red is working.
Mqtt get some messages, but not data in homeassist. logging

time=“2023-01-07T13:51:33+01:00” level=debug msg=“Superuser check with backend Files”
time=“2023-01-07T13:51:33+01:00” level=debug msg=“Superuser check with backend HTTP”
time=“2023-01-07T13:51:33+01:00” level=debug msg=“http request approved for leon”
time=“2023-01-07T13:51:33+01:00” level=debug msg=“superuser leon acl authenticated with backend HTTP”
time=“2023-01-07T13:51:33+01:00” level=debug msg=“setting acl cache (granted = true) for xxxx”
time=“2023-01-07T13:51:33+01:00” level=debug msg=“to auth record: [97 99 108 45 108 101 111 110 45 101 110 115 116 111 101 47 100 97 121 45 97 104 101 97 100 45 110 111 100 101 114 101 100 95 57 52 52 101 55 57 102 57 53 99 51 100 50 52 51 52 45 50 218 57 163 238 94 107 75 13 50 85 191 239 149 96 24 144 175 216 7 9]\n”
time=“2023-01-07T13:51:33+01:00” level=debug msg=“Acl is true for user xxxx”

Day-ahead-price and others say still unkown.

Anyone any idee?

Hi, have you been able to just download the data from ENTSO using the URL with you API-code? this is a way to check if ENTSO is accepting your request. If that succeeds, you can carry on with Node Red and HA.
regards, Harold

Check out Electricity price right now - Home Assistant REST integration for a simpler alternative utilizing entso-e and rest integration, also has currency conversion and support for extra fees and VAT factor. And no api key needed :slight_smile:

Pull requests welcome!

Description page

Hi,
I get the following debug message on triggering the first timestamp:

“TypeError: Cannot read properties of undefined (reading ‘TimeSeries’)”

any hints where to search for a solution?

Please help, after 14/2/2023 I’m now getting an error, - I’ve updated the token to see if it was the problem, - and no it was not :confused:

My URL have been working for over 9 months:

var urlAddr = “https://transparency.entsoe.eu/api?securityToken=XXXXXXXXXXX&documentType=A44&in_Domain=10YDK-2--------M&out_Domain=10YDK-2--------M&periodStart=” + todayString + “0000&periodEnd=” + todayString + “2300”

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="icon" type="image/png" href="favicon.png"/>
    <title>ENTSO-E Transparency Platform</title>
    <style type="text/css" media="screen">

        object:focus {
            outline: none;
        }

        /**     * Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)     * http://cssreset.com     */
        html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
            margin: 0;
            padding: 0;
  ...

Since mid february '23 the old address has stopped working, so from now on the new address as mentioned is mandatory:

"https://web-api.tp.entsoe.eu/api...

Yeah, that has been used as you see from posts above. No problems in that. Nor in anything else currently.

Entso-e was having some issues but lately been reliable again.

Now system running more than half a year… few problems from Entso-e and momentarily issues from heatpump loosing connection to internet (and also local grid). Experience so far is that this home assistant system has been working nice… approx. 15…30% savings in energy price compared to Nordpool average price for the month.

Soon we are getting 15min price system in Finland, if I understood from Fingrid’s information. We need to update the system for 96 row system instead of 24 :slight_smile:

Entso-e made some changes to their API: for example if positions (hours, later 15min slots) 1 and 2 are with the same price the API skips the position number 2.

Have you found a way to modify this Node-RED approach so that it works with the changes?

Here my “generate today array” function, works for me but i am sure there is more efficient way to do this.

var priceArray=[];
var points = msg.payload.Publication_MarketDocument.TimeSeries[0].Period[0].Point;
var n = 0;
var pricepoint = 0;

for (let i = 0; i < points.length; i++) { 
    // First fill in the gaps if any with previous data
    while (n < points[i]["position"][0] - 1) {
        if(n>=6 && n<21){
            priceArray[n] = Math.round(100 * (0.5 + 2.827515 + 5.11 + 0.1 * 1.255 * pricepoint)) / 100;
        }else{
            priceArray[n] = Math.round(100 * (0.5 + 2.827515 + 3.12 + 0.1 * 1.255 * pricepoint)) / 100;
        }
        n++;
    }
    pricepoint = points[i]["price.amount"][0];
    if(n>=6 && n<21){
        priceArray[n] = Math.round(100 * (0.5 + 2.827515 + 5.11 + 0.1 * 1.255 * pricepoint)) / 100;
    }else{
        priceArray[n] = Math.round(100 * (0.5 + 2.827515 + 3.12 + 0.1 * 1.255 * pricepoint)) / 100;
    }
    n++;
}

while (n < 24) {
    if (n >= 6 && n < 21) {
        priceArray[n] = Math.round(100 * (0.5 + 2.827515 + 5.11 + 0.1 * 1.255 * pricepoint)) / 100;
    } else {
        priceArray[n] = Math.round(100 * (0.5 + 2.827515 + 3.12 + 0.1 * 1.255 * pricepoint)) / 100;
    }
    n++;
}
flow.set("pArray", priceArray);
msg.payload= { "day_ahead_price": priceArray};
return msg ;

Similar way can be applied to generate yesterday array and tomorrow array

1 Like