evcc-io / evcc

Sonne tanken ☀️🚘
https://evcc.io
MIT License
3.32k stars 606 forks source link

Integrate with ENTSO-E Day ahead pricing #5291

Closed bsmout closed 11 months ago

bsmout commented 1 year ago

Lots of dynamic tarifs are based on day ahead pricing for the specific region (country). It would be great if tariffs could be based on those day ahead prices. For example ENTSO-E is an Europe funded service that provides a free API.

Clients for the API are available on Github.

More info: https://transparency.entsoe.eu/content/static_content/Static%20content/web%20api/Guide.html

andig commented 1 year ago

Why would you want to do that?

bsmout commented 1 year ago

To charge when electricity prices are the lowest ? If you have a dynamic rate tarif that changes every hour you want to charge your EV as cheap as possible.

andig commented 1 year ago

Sure. But then you would integrate that tariff as we‘re already doing, not Entso.

andig commented 1 year ago

When https://github.com/evcc-io/evcc/pull/5445 is finished, we can add additional plan data for target charging. Same approach as discussed in https://github.com/evcc-io/evcc/pull/5445#issuecomment-1346809709.

RTTTC commented 1 year ago

OK, after more consideration looks like ENTSO-E Day ahead pricing would be the best one to use, and pricing matches my local market pricing data exactly, using mac/safari (For some reason it showed wrong pricing when I used iphone to browse it) So Nordpool data api is not needed.

RTTTC commented 1 year ago

Could we reopen this?

andig commented 1 year ago

Now that we have a planner it would be nice to add minimal-CO2 planning. I'm not so keen on ENTSO prices as that's not what the user pays anyway, but would prefer CO2 load. Would appreciate suggestions for finding the relevant ENTSO reports and example data interpretation.

andig commented 1 year ago

/cc @thorstenwagner

RTTTC commented 1 year ago

"Smart rate" is supposedly most popular utility option in Scandinavia, where customers have smart meters and electricity price is different every hour, as per Nordpool (ENTSO) local area day ahead pricing (plus margin and any taxes)

bsmout commented 1 year ago

Now that we have a planner it would be nice to add minimal-CO2 planning. I'm not so keen on ENTSO prices as that's not what the user pays anyway, but would prefer CO2 load. Would appreciate suggestions for finding the relevant ENTSO reports and example data interpretation.

Based on what are you stating that ? I'm paying ENTSO pricing (with a very small margin and taxes).

andig commented 1 year ago

At least not in Germany. I‘m interested in co2 minimization.

RTTTC commented 1 year ago

More info: https://transparency.entsoe.eu/content/static_content/Static%20content/web%20api/Guide.html

4.2.10. Day Ahead Prices [12.1.D] for day-ahead pricing API

RTTTC commented 1 year ago

This integration would be such a great evolution of evcc!

scholdan commented 1 year ago

There is missing a lot of tariffs providers. Maybe look at this https://github.com/MTrab/energidataservice and convert it? or just pull the data form homeassistant?

andig commented 1 year ago

@duckfullstop if you want to take a stab? Entso prices would be nice but the API is a complex.

duckfullstop commented 1 year ago

4.2.10. Day Ahead Prices [12.1.D] for day-ahead pricing API

This looks quite achievable (even if it does mean working with XML), I can take a bit more of a look into it in the coming week hopefully?

I'm not sure about CO2 forecasting, I don't think specific data on that is provided by ENTSO-E and we'd probably have to calculate estimates ourselves, which is a pretty big task, arguably out of scope for evcc, and unfortunately probably done best at the continent level by services like electricitymaps, etc. (Someone feel free to correct me but I couldn't find anything relevant in the documentation from a quick look)

andig commented 1 year ago

Year, CO2 means mangling production and consumption plus specific CO2 per production type. I wouldn't try that honestly.

duckfullstop commented 1 year ago

Spent a little time reading the documentation for ENTSO-E in more detail, and section 2. has some specific requirements for requesting an API key:

To request access to the Restful API, please register on the Transparency Platform (link) and send an email to transparency@entsoe.eu with “Restful API access” in the subject line. Indicate the email address you entered during registration in the email body. The ENTSO-E Helpdesk will make their best efforts to respond to your request within 3 working days.

https://transparency.entsoe.eu/content/static_content/Static%20content/web%20api/Guide.html#_authentication_and_authorisation

This feels like they don't intend this API for use by end users - I'm still happy to request a key and implement it, but it will substantially limit user friendliness if you have to register an account and then wait 3 days before you can request an API key.

RTTTC commented 1 year ago

Maybe we could all use one key ? evcc as an organisation?

duckfullstop commented 1 year ago

Maybe we could all use one key ? evcc as an organisation?

Doesn't seem to be the case, these keys seem to be private use only:

If you suspect that the token has been compromised, you must reset the token by yourself. If the token is missing or invalid (including suspended account), the system will respond with Http 401 Unauthorized.

I'm pretty sure some of these calls could be quite heavy (like repeatedly calling for decades of complex data at once), so it's not a surprise this restriction exists.

Handling this in evcc cloud is an option (maybe with some heavy caching), but feels like possibly the wrong route to take, as it creates a single point of failure under our control.

duckfullstop commented 1 year ago

The Home Assistant ENTSO-E plugin has just come to my attention, and that seems to be popular enough even with the API key restriction, so I'll go ahead and request a key and look into implementing this. @andig reopen this issue?

duckfullstop commented 1 year ago

I have received an API key, starting work on implementing this now. Should have something rudimentary by next week at the latest (my health's a bit up and down!).

duckfullstop commented 1 year ago

@bsmout @RTTTC @djfanatix Hey there! I'm busy implementing this for you now in #9794, but as someone that's never really dealt with european tariffs, it would be beneficial to know how you would expect this to work once it's finished.

Does your provider give you a specific ENTSO-E domain code (i.e 10YDE-ENBW-----N for DETransnetW, for example), or would you expect to just define something like DETransnetW or NL for example?

And when it comes to how you get charged based on these rates, is it a simple multiplier (say 115% of the ENTSO-E cost), or would more advanced math be needed (say (rate * 1.15) + 0.02)?

Many thanks in advance!

djfanatix commented 1 year ago

Hi,

Speaking for Belgium, but I think for the netherlands, germany and some other countries it is the same. We have only 1 spot price, so BE,NL,DE,.. will be sufficient.

The different providers use a calculation which is complicated:

(((Entsoespot 1.15) + 0.02)tax) + government costs)

andig commented 1 year ago

Tbo, we don‘t necessarily need the exact costs. I‘d prefer to keep an identical model across tariffs, currently in embed.go.

RTTTC commented 1 year ago

I would expect to use country code (LT) There are a couple of countries in EU that have few regions per country, such as Sweden, UK, Norway. In such case there is NO1, NO2 etc. (As per ENTSO-E)

For meprice = (rate + fixed addon fees)*1,21 (VAT) https://github.com/evcc-io/evcc/pull/7437 integration works perfectly for me (may be helpful to check out it's implementation?)

  planner:
    # planner tariff can be used for target charging if no grid tariff is specified
    type: elering
    region: lt
    charges: 0.07825 # EUR/kWh
    tax: 0.21 # This would be 21% VAT

This way I get exact cost, and I love it! ❤️

andig commented 1 year ago

Think that is https://github.com/evcc-io/evcc/blob/master/tariff/embed.go