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

Grid cost not loaded using PUN template #17174

Closed
1 task done
MobilettoSoft opened this issue Nov 10, 2024 · 9 comments · May be fixed by #17900
Closed
1 task done

Grid cost not loaded using PUN template #17174

MobilettoSoft opened this issue Nov 10, 2024 · 9 comments · May be fixed by #17900
Labels
bug Something isn't working tariffs Specific tariff support

Comments

@MobilettoSoft
Copy link
Contributor

Describe the bug

Using the PUN template causes the cost of grid electricity is not showed; the issue is not affected by using or not using charges, tax or formula .

(the site https://www.mercatoelettrico.org/it/ has been recently updated in its layout: I dont' know if this could be the root cause of this issue)

Steps to reproduce

  1. Use PUN template in evcc.yaml

Configuration details

tariffs:
  currency: EUR # three letter ISO-4217 currency code (default EUR)
  grid:
    type: template
    template: pun
    charges: 0.130267926
    tax: 0.1
    formula: math.Max((1.1 * price + charges) * (1 + tax), 0.0)

Log details

The logs in evcc UI don't show anything related to grid tariff

In the homeassistant add-on logs, when using the PUN tariff this message is reported shortly after add-on startup:

Error unmarshalling XML:  expected element type <NewDataSet> but have <html>

When using other tariff templates, the message disappears

What type of operating system are you running?

HomeAssistant Add-on

Nightly build

  • I have verified that the issue is reproducible with the latest nightly build

Version

0.131.5

@andig
Copy link
Member

andig commented Nov 10, 2024

Please show

evcc tariff —log trace,db:error

@andig andig added the tariffs Specific tariff support label Nov 10, 2024
@MobilettoSoft
Copy link
Contributor Author

grid:
Error unmarshalling XML: expected element type but have
Error unmarshalling XML: expected element type but have
From To Price/Cost

@andig
Copy link
Member

andig commented Nov 10, 2024

Missing requested log.

@andig andig closed this as completed Nov 10, 2024
@MobilettoSoft
Copy link
Contributor Author

Well, nice attitude to someone hinting you a possible bug and even the possible reason (the way you're pulling data from www.mercatoelettrico.org doesn't work anymore because they completely overhauled their website).

However, the CLI command you suggested (evcc tariff -log trace,db:error) didn't work, so I used this:

evcc tariff -l trace,db:error

And I got this:

[main  ] INFO 2024/11/10 23:00:53 evcc 0.131.5
[main  ] INFO 2024/11/10 23:00:53 using config file: C:\Users\abern\Downloads\evcc\evcc.yaml
grid:
Error unmarshalling XML:  expected element type <NewDataSet> but have <html>
Error unmarshalling XML:  expected element type <NewDataSet> but have <html>
From    To    Price/Cost

I didn't think the first two lines were essential, so excuse me.

I hope this can be useful for other users possibly encountering this issue. I reverted to the method I was already using (importing the electricity cost via REST API from homeassistant and its nice PUN integration).

@andig
Copy link
Member

andig commented Nov 11, 2024

I see. Missing log is a bug in the tariff. Will fix that and then we can double check.

@andig andig reopened this Nov 11, 2024
@andig andig added the bug Something isn't working label Nov 11, 2024
@andig
Copy link
Member

andig commented Nov 12, 2024

@motze92 do you want to take a look? I've added the logging but test is broken since server returns a different response.

@MobilettoSoft
Copy link
Contributor Author

MobilettoSoft commented Nov 14, 2024

I've got no experience developing in go, so I can't help with code, but maybe I can help with some info. Take a look at these discussions from the Homeassistant PUN plugin repo.

Starting from october 1 until december 31 there is a temporary workaround to access the old mercatoelettrico.org site:
virtualdj/pun_sensor#59

The new site uses a different API as explained here (look at the last post):
virtualdj/pun_sensor#42

@MobilettoSoft
Copy link
Contributor Author

It seems that only changing the endpoint from www.mercatoelettrico.org to storico.mercatoelettrico.org temporarily fixes the problem. If you want I can make some tests and then open a PR.

At least we have a solution until december 31.

@andig
Copy link
Member

andig commented Nov 16, 2024

Fixed for now thanks to @MobilettoSoft but will stop working end of year. /cc @motze92

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tariffs Specific tariff support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants