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

Check return currency before accepting data #52

Closed
jschlyter opened this issue Feb 9, 2021 · 5 comments
Closed

Check return currency before accepting data #52

jschlyter opened this issue Feb 9, 2021 · 5 comments

Comments

@jschlyter
Copy link

Version of the custom_component

Configuration

sensor:

  - platform: nordpool
    VAT: true
    currency: SEK
    low_price_cutoff: 0.95
    region: SE3
    precision: 3
    price_type: kWh

Describe the bug

The component currently assumes that if you query for currency X, the result will contain prices in currency X. For several reasons, including kipe/nordpool#17, this may not be true and it would be most useful if the component could reject data in the wrong currency. No further information should be required.

Fixing this would not have prevented, but would have mitigated, #51

@jschlyter
Copy link
Author

Will be fixed via kipe/nordpool#19 but the exception needs to be handled by the component.

@Hellowlol
Copy link
Collaborator

In this case it will only make the component crash and burn. We could catch the exception and retry the request in another way to get the correct currency. I’m hoping that the data from the endpoints that does provide the correct currency has the same format. As there are several issues that we have to work around.

I’m under the weather atm, so I’ll have to come back for this later. In the meantime all prices are in EUR regardless of settings used.

If anybody want to fixed this in the meantime a PR is highly appreciated.

@jschlyter
Copy link
Author

The fix should really be in https://github.com/kipe/nordpool, you don't need to do anything (except handle the exception that I have a PR for (or feel the heat))

@Hellowlol
Copy link
Collaborator

Your PR is fine but it does not fix the issue. The api only returns the prices in EUR regards of currency used (for the api point that the Python library uses)

@jschlyter
Copy link
Author

Correct, that PR only stops prices with the wrong currency. The real issue still needs to be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants