Custom Component: ENTSO-e Day Ahead Energy Prices

I am working on a custom component to fetch energy prices and information from the ENTSO-e Transparency Platform (https://transparency.entsoe.eu/).
Day ahead energy prices are added as a sensor and can be used in automations to switch equipment.

This integration is in a very early state and a work in progress. All feedback and help is welcome!

API Access

You need an ENTSO-e Restful API key for this integration. To request this API key, register on the Transparency Platform and send an email to [email protected] with “Restful API access” in the subject line.

Sensors

The integration adds the following sensors:

  • Average Day-Ahead Electricity Price Today
  • Highest Day-Ahead Electricity Price Today
  • Lowest Day-Ahead Electricity Price Today
  • Current Day-Ahead Electricity Price
6 Likes

Brilliant! Exactly what I need with my upcoming dynamic energy contract and home battery. Ideally I would like to have all values for the upcoming 24hrs - use case is 1) charge car if/when electricity is cheapest 2) determine buy and sell optimum for home battery; typically there are 2 peaks per day.

Will try your component and see if I can help out a bit; my python is not that good though - really curious about other use cases.

1 Like

Would be nice to have also a sensor with the time of the cheapest hour(s)

Thanks! It’s good to know about use cases to determine what way to go with this integration.

My use cases are similar; also charging a car at cheap hours and buffering my heat pump at low prices.

I am also looking into a home battery.

How would an automation with 24 values look like for you? I am hesitant to add all hours, as it could make it a bit messy, and am not sure if this has value.

I was already looking into this. Will probably be added by the end of next week if it is not that difficult. Already done! You can now see the cheapest and most expensive hours.

Hi Jacco, that’s a good question. I want to build some logic to determine the trough and the peak, essentially any value which is next to/surrounded by 2 values which are higher is the trough (buying point) and any value which is next to 2 values which are higher is the peak (selling point)

This logic can be built in an automation within HA (input_datetime.nextpeak /next trough); second automation which triggers charge battery and triggers discharge battery.

Alternatively this could be built into python directly I suppose. Will take this further on GitHub.

Even better would be to link this with emhass; this tool optimizes usage based on expected solar production and historic usage of the house.

1 Like

@JaccoR I use ANWB energy (EnergyZero reseller). When I asked if there was a API I got this answer:

API
On JSON basis we provide the following API:

We provide this without any support.

As I am not a programmer, I need some help to get the info into home-assistant and was wondering if it is possible for you to integrate this into your API-reading component, as there seems to be a ENTSO-e reference in the 2nd API link.

Hope you have time to look into this, much appreciated!

1 Like

The current integration provides all electricity prices. But perhaps the energy zero one can be used to add the gas price as well?

Great work, the amsleser from amsleser.no also has this integration, though it doesn’t export it to HA yet.

That would be nice!

In the meantime, this might be helpful to you to get current EnergyZero prices into HA. It worked for me, though I’m still looking for a way to get all-in prices.

1 Like

It seems like the the links you send just give the day ahead prices, right? This is what my custom component does as well. You can then just use this integration.

1 Like

Very interesting, especially the cost modifier template part! Unfortunately, the Energyzero prices are not completely the same as what the ENTSO api shows.

Would you consider to integrating other api’s like Energyzero into this integration? Or should any deviations from the ENTSO data be fixed with the cost modifier?

The idea is that the cost modifyer is for deviations of individual suppliers from the day ahead prices. Getting API’s from all individual energy suppliers is a lot of work, so I am not planning on doing that. I opened a discussion to share modifyer templates:

EnergyZero is not in there yet though.

Just installed the component, and it seems like a massive opportunity for significant savings on energy bills.

Does anyone have any blueprints to share how to actually build automations around the sensor data we get?

Also, it would be quite interesting to have “cheapest x hour(s) slot/interval” available, so tasks consuming electricity for multiple hours (washing machine, EV charging etc.) could be scheduled accordingly. Is this already doable?

1 Like

I do not have any blueprint I can share, but you can make a template with Tibbers “PriceLevel” using the Entsoe price sensors.

template:
  - sensor:
      - name: "PrisnivĂĄ"
        unique_id: "pricelevel"
        state: >-
          {% if states('sensor.current_electricity_market_price')|float(0.5) >= states('sensor.average_electricity_price_today')|float(0.5) *0.9
              and states('sensor.current_electricity_market_price')|float(0.5) < states('sensor.average_electricity_price_today')|float(0.5) *1.15 %}
              NORMAL
          {% elif states('sensor.current_electricity_market_price')|float(0) >= states('sensor.average_electricity_price_today')|float(0) *0.6
              and states('sensor.current_electricity_market_price')|float(0) < states('sensor.average_electricity_price_today')|float(0) *0.9 %}
              CHEAP
          {% elif states('sensor.current_electricity_market_price')|float(0) < states('sensor.average_electricity_price_today')|float(0) *0.6 %}
              VERY_CHEAP
          {% elif states('sensor.current_electricity_market_price')|float(0) >= states('sensor.average_electricity_price_today')|float(0) *1.15
              and states('sensor.current_electricity_market_price')|float(0) < states('sensor.average_electricity_price_today')|float(0) *1.4 %}
              EXPENSIVE
          {% elif states('sensor.current_electricity_market_price')|float(0) >= states('sensor.average_electricity_price_today')|float(0) *1.4
              and states('sensor.current_electricity_market_price')|float(0) < states('sensor.average_electricity_price_today')|float(0) *2.0 %}
              VERY_EXPENSIVE
          {% elif states('sensor.current_electricity_market_price')|float(0) >= states('sensor.average_electricity_price_today')|float(0) *2.0 %}
              EXTREMELY_EXPENSIVE
          {% endif %}

Then you can make a template binary sensor which is ON when the price is expensive and OFF when price is normal or cheap. With this you can make a automation which use the binary sensor to heat when it is off and lower the temperature when it is on.

  - binary_sensor:
      - name: "Dyr strom"
        state: "{{ states('sensor.prisniva') == 'EXPENSIVE' or states('sensor.prisniva') == 'VERY_EXPENSIVE' or states('sensor.prisniva') == 'EXTREMELY_EXPENSIVE' }}"

You can also modify this blueprint which use Tibber price data to use Entsoe price data.

This code for finding the cheapest 1-2 hours and 1-3 hours with Entsoe is from @stigvi from this norwegian forum: Strømpriser - Side 2 - Home Assistant - Hjemmeautomasjon

    - unique_id: billigste_timer_1_2
      name: billigste_timer_1_2
      state: >-
        {% set l=state_attr('sensor.average_electricity_price_today', 'prices')[14:]|sort(attribute='price') %}
        {% set t = now() %}
        {{ (t >= as_datetime(l[0].time) and t <= as_datetime(l[0].time) + timedelta(hours = 1))
          or (t >= as_datetime(l[1].time) and t <= as_datetime(l[1].time) + timedelta(hours = 1)) }}
    - unique_id: billigste_timer_1_3
      name: billigste_timer_1_3
      state: >-
        {% set l=state_attr('sensor.average_electricity_price_today', 'prices')[14:]|sort(attribute='price') %}
        {% set t = now() %}
        {{ (t >= as_datetime(l[0].time) and t <= as_datetime(l[0].time) + timedelta(hours = 1))
          or (t >= as_datetime(l[1].time) and t <= as_datetime(l[1].time) + timedelta(hours = 1))
          or (t >= as_datetime(l[2].time) and t <= as_datetime(l[2].time) + timedelta(hours = 1)) }}
2 Likes

Hi!
I have previously set up the NordPool Diff sensor in HA (can’t find the link right now) and with the latest version it uses your ENTSO-e integration. I now try to get it up and running.
I have a question regarding the API key. I have requested the key from the transparency platform support team yesterday but haven’t got it yet. Probably it will show up.
But I can’t find where to add the key in the configuration. Can you please share an example? Thanks!
/M

You won’t get the API key from them. You need to setup an account, request activation of api and subsequently you can generate a key in your account details.

Team are really helpful but can take 24 -48 hours to get response.

Ok, thanks!
They have responded and I may now generate an api key in the entso-e platform. But once I have it, where do I paste it into HA? I can’t find anywhere in the HACS integration to insert it. Please advise!

Not sure what you mean by hacs integration. You add the custom repository in hacs, install entsoe, restart HA, in integrations you add entsoe and follow the config flow. There it’s one of the parameters you need to fill. Steps are all on the GitHub page of @JaccoR