evcc-io / evcc

Solar Charging ☀️🚘
https://evcc.io
MIT License
3.67k stars 688 forks source link

Tariffs calculated incorrectly with data source from ENTSOE when currency is other than EUR #17580

Closed Millox closed 2 minutes ago

Millox commented 13 hours ago

Describe the bug

The calculation of the current price for electricity is done incorrectly when using other than EUR for the ENTSOE tariff price source. The api always fetches the price in EUR, but the presentation is in local currency, which in the case of SEK leads to an underestimation of the electricity price by a factor of 10.

Currently (2024-12-04, 08:00-09:00) the price in SE4 is 3.13 SEK/kWh which is 0.27 EUR/kWh

Calculation from EVCC: image

Expected (with configuration as below): (3.13 + 0.73744) * 1.25 = 4.8 SEK / kWh

Actual: (0.270 + 0.73744) * 1.25 = 1.26 SEK / kWh

Steps to reproduce

  1. Configure tariffs with currency other than EUR
  2. Configure price fetching from entso-e

Configuration details

tariffs:
  currency: SEK
  grid:
    type: entsoe
    domain: BZN|SE4
    securitytoken: xxx
    charges: 0.73744
    tax: 0.25

Log details

-

What type of operating system are you running?

Linux

Nightly build

Version

0.137.7

andig commented 12 hours ago

The api always fetches the price in EUR

I'm not familiar with it- does it offer anything else? Maybe we could also return local currency.

but the presentation is in local currency

Presentation is as configured by user. If you have EUR data you'll need to configure EUR or convert the currency. evcc does not do any automatic conversion.

Alternative solution: use a formula for currency conversion using https://github.com/evcc-io/evcc/pull/17002

bartashevich commented 9 hours ago

I think ENTSO-e only provides EUR Tariff.

Try following to convert to your local currency:

tariffs:
  currency: SEK
  grid:
    type: entsoe
    domain: BZN|SE4
    securitytoken: xxx
    charges: 0
    tax: 0
    formula: (price*11.5765 + 0.73744) * 1.25
Millox commented 15 minutes ago

Yeah, so... Obviously I wasn't very happy with this response, static exchange rate will always be a hack, and apparently ENTSO-E only provides EUR data as stated above. SOOO, I kinda fixed it in another way

./evcc -c evcc.yaml tariff -l debug [main ] INFO 2024/12/04 21:32:40 evcc 0.131.8 (55d3c8eb) [main ] INFO 2024/12/04 21:32:40 using config file: evcc.yaml [db ] INFO 2024/12/04 21:32:40 using sqlite database: /home/mattias/.evcc/evcc.db [mqtt ] INFO 2024/12/04 21:32:40 connecting evcc-586182962 at tcp://localhost:1883 [mqtt ] DEBUG 2024/12/04 21:32:40 tcp://localhost:1883 connected [nordpool] DEBUG 2024/12/04 21:32:40 downloading price data grid: From To Price/Cost 2024-12-04 23:00:00 2024-12-05 00:00:00 0.652 2024-12-05 00:00:00 2024-12-05 01:00:00 0.646 2024-12-05 01:00:00 2024-12-05 02:00:00 0.648 2024-12-05 02:00:00 2024-12-05 03:00:00 0.642 2024-12-05 03:00:00 2024-12-05 04:00:00 0.642 2024-12-05 04:00:00 2024-12-05 05:00:00 0.664 2024-12-05 05:00:00 2024-12-05 06:00:00 1.059 2024-12-05 06:00:00 2024-12-05 07:00:00 1.620 2024-12-05 07:00:00 2024-12-05 08:00:00 1.595 2024-12-05 08:00:00 2024-12-05 09:00:00 1.481 2024-12-05 09:00:00 2024-12-05 10:00:00 1.405 2024-12-05 10:00:00 2024-12-05 11:00:00 1.207 2024-12-05 11:00:00 2024-12-05 12:00:00 0.894 2024-12-05 12:00:00 2024-12-05 13:00:00 0.833 2024-12-05 13:00:00 2024-12-05 14:00:00 0.739 2024-12-05 14:00:00 2024-12-05 15:00:00 0.736 2024-12-05 15:00:00 2024-12-05 16:00:00 0.721 2024-12-05 16:00:00 2024-12-05 17:00:00 0.709 2024-12-05 17:00:00 2024-12-05 18:00:00 0.615 2024-12-05 18:00:00 2024-12-05 19:00:00 0.483 2024-12-05 19:00:00 2024-12-05 20:00:00 0.371 2024-12-05 20:00:00 2024-12-05 21:00:00 0.375 2024-12-05 21:00:00 2024-12-05 22:00:00 0.416 2024-12-05 22:00:00 2024-12-05 23:00:00 0.346

This was based on the energinet tariff source, but uses Nordpool data instead which have SE/NO/DK and other areas as well. Will create pull request as soon as I have figured out how to. And cleaned up the code somewhat.

Maybe close this bug report with a documentation update only and then I will provide the Nordpool tariff source later.

andig commented 2 minutes ago

Don‘t eneginet and elering also provide Nordpool data? If we can get them from the source that wouldn‘t hurt 👍🏻