Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Nordpool tariff api #17628

Merged
merged 4 commits into from
Dec 7, 2024
Merged

Add Nordpool tariff api #17628

merged 4 commits into from
Dec 7, 2024

Conversation

andig
Copy link
Member

@andig andig commented Dec 7, 2024

Fix #17464
Fix #17479
Fix #17580

Replace #17607

@andig andig added the tariffs Specific tariff support label Dec 7, 2024
@andig andig marked this pull request as draft December 7, 2024 11:38
@andig andig changed the title Add Nordpool Add Nordpool tariff api Dec 7, 2024
@andig andig marked this pull request as ready for review December 7, 2024 13:23
@andig andig merged commit 93210dd into master Dec 7, 2024
6 checks passed
@andig andig deleted the feat/nordpool branch December 7, 2024 13:28
@RTTTC
Copy link
Contributor

RTTTC commented Dec 12, 2024

Have tried to configure this in UI, without success. (0.131.9)
Could you please post a sample config for UI ?

@andig
Copy link
Member Author

andig commented Dec 12, 2024

without success

That's pretty unspecific ;)

@RTTTC
Copy link
Contributor

RTTTC commented Dec 12, 2024

Well, I have assumed that it was my configuration mistake..
(I have simply replaced elering with nordpool in my UI config)
Thats why I have asked for config sample - since nothing in the documentation yet.

Screenshot 2024-12-12 at 15 24 47

@andig
Copy link
Member Author

andig commented Dec 12, 2024

@RTTTC
Copy link
Contributor

RTTTC commented Dec 12, 2024

Thank you.
(The link in UI "Tariffs" configuration seems to link to a wrong place then ? https://docs.evcc.io/en/docs/reference/configuration/tariffs )

@RTTTC
Copy link
Contributor

RTTTC commented Dec 12, 2024

There is something wrong with unit conversion, as currently it shows value that is 1000 times too large.
Current Nordpool price is 200.04 EUR/MW
At the same time evcc shows it as 20,004.0 ct

@RTTTC
Copy link
Contributor

RTTTC commented Dec 12, 2024

Also charges and tax seems to be messed up, not sure if it is related to 1000x or something else is wrong, I was unable to comprehend this.

@Millox
Copy link
Contributor

Millox commented Dec 12, 2024

See
#17702

pricing downloaded from Nordpool is in EUR/MWh but evcc expects it to be EUR/kWh (or other currency)

@RTTTC
Copy link
Contributor

RTTTC commented Dec 13, 2024

Thank you all, now everything works nicely! 😎

@Millox
Copy link
Contributor

Millox commented Dec 13, 2024

No, it doesn't. I have unfortunately been unable to determine where to change the code. If the json body of the http request is empty the error is returned "unexpected end of JSON" which is due to the empty string returned. This happens between 00:00 and 13:00 every day. During this time it is not possible to start evcc, and if it is running the tariff and pricing is unavailable.

I will try to fix it, but if I'm unsuccessful tomorrow I will submit a bugreport, unless anyone could give me a tip on where to look for the parsing function.

@RTTTC
Copy link
Contributor

RTTTC commented Dec 13, 2024

Tested after midnight, same error, planner: tariff not available: cannot create tariff type 'template': cannot create tariff type 'custom': unexpected end of JSON input
For me evcc started OK despite the error ( no planner pricing data present )

@andig
Copy link
Member Author

andig commented Dec 13, 2024

This needs a trace log, preferable inclusing http headers

@Millox
Copy link
Contributor

Millox commented Dec 14, 2024

I've added a few traces to try to pinpoint the fault, but I was only able to find that it comes from the forecastG-function in tariff/tariff.go

s, err := forecastG()

And this function is retrieved from the registry
https://github.com/evcc-io/evcc/blob/d4cb42f78121af1129c12aee2b3326f6521d10b5/tariff/tariff.go#L69C3-L69C73

but I was unable to determine where it was actually defined.

See trace:

[feedin] TRACE 2024/12/14 07:29:29 GET https://dataportal-api.nordpoolgroup.com/api/DayAheadPrices?market=DayAhead&date=2024-12-15&deliveryArea=SE4&currency=SEK
[grid  ] TRACE 2024/12/14 07:29:29 GET https://dataportal-api.nordpoolgroup.com/api/DayAheadPrices?market=DayAhead&date=2024-12-15&deliveryArea=SE4&currency=SEK
[tariff] TRACE 2024/12/14 07:29:29 forecastG() returned "",%!w(*fmt.wrapError=&fmt.wrapError{msg:"tomorrow: unexpected end of JSON input", err:(*backoff.PermanentError)(0xc002049de0)})
[tariff] TRACE 2024/12/14 07:29:29 backoffPermanentError(&fmt.wrapError{msg:"tomorrow: unexpected end of JSON input", err:(*backoff.PermanentError)(0xc002049de0)}) : unexpected end of JSON input
[tariff] ERROR 2024/12/14 07:29:29 unexpected end of JSON input
[main  ] ERROR 2024/12/14 07:29:29 creating tariff grid failed: cannot create tariff type 'template': cannot create tariff type 'custom': unexpected end of JSON input
[tariff] TRACE 2024/12/14 07:29:29 forecastG() returned "",%!w(*fmt.wrapError=&fmt.wrapError{msg:"tomorrow: unexpected end of JSON input", err:(*backoff.PermanentError)(0xc001d02380)})
[tariff] TRACE 2024/12/14 07:29:29 backoffPermanentError(&fmt.wrapError{msg:"tomorrow: unexpected end of JSON input", err:(*backoff.PermanentError)(0xc001d02380)}) : unexpected end of JSON input
[tariff] ERROR 2024/12/14 07:29:29 unexpected end of JSON input
[main  ] ERROR 2024/12/14 07:29:29 creating tariff feedin failed: cannot create tariff type 'template': cannot create tariff type 'custom': unexpected end of JSON input
grid:
[main  ] FATAL 2024/12/14 07:29:29 tariff not available: cannot create tariff type 'template': cannot create tariff type 'custom': unexpected end of JSON input
)

I added two traces to the code in tariff/tariff.go

                if err := backoff.Retry(func() error {
                        s, err := forecastG()
                        t.log.TRACE.Printf("forecastG() returned \"%s\",%#w",s,err)
                        if err != nil {
                                t.log.TRACE.Printf("backoffPermanentError(%#v) : %v",err,errors.Unwrap(err))
                                return backoffPermanentError(err)
                        }

But as I said above, the func forecastG() comes from the registry and I can't seem to find where it is actually defined.

@RTTTC
Copy link
Contributor

RTTTC commented Dec 24, 2024

Any progress with this issue ?

@andig
Copy link
Member Author

andig commented Dec 24, 2024

Please open issue with trace log.

jonilala796 pushed a commit to jonilala796/evcc that referenced this pull request Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tariffs Specific tariff support
Projects
None yet
3 participants