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

[energidataservice] Add UoM support for energy prices #16070

Merged
merged 1 commit into from
Dec 16, 2023

Conversation

jlaur
Copy link
Contributor

@jlaur jlaur commented Dec 16, 2023

Related to openhab/openhab-core#3503

Tested with latest snapshot and custom built org.openhab.core-4.1.0-SNAPSHOT.jar and org.openhab.core.config.core-4.1.0-SNAPSHOT.jar from main.

@jlaur jlaur added enhancement An enhancement or new feature for an existing add-on additional testing preferred The change works for the pull request author. A test from someone else is preferred though. labels Dec 16, 2023
@jlaur jlaur force-pushed the energidataservice-uom-energyprice branch 7 times, most recently from 3f38ccd to 338e57c Compare December 16, 2023 14:52
@jlaur jlaur marked this pull request as ready for review December 16, 2023 14:53
@jlaur jlaur removed the additional testing preferred The change works for the pull request author. A test from someone else is preferred though. label Dec 16, 2023
@jlaur jlaur requested review from J-N-K and kaikreuzer December 16, 2023 14:53
Copy link
Contributor

@lolodomo lolodomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question.

@jlaur jlaur force-pushed the energidataservice-uom-energyprice branch from 338e57c to 5e18d23 Compare December 16, 2023 15:22
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
@jlaur jlaur force-pushed the energidataservice-uom-energyprice branch from 5e18d23 to 1249faa Compare December 16, 2023 15:24
Copy link
Contributor

@lolodomo lolodomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@lolodomo lolodomo merged commit 413ce08 into openhab:main Dec 16, 2023
@lolodomo lolodomo added this to the 4.1 milestone Dec 16, 2023
Comment on lines +52 to +53
| spot-price | Number:EnergyPrice | Spot price in DKK or EUR per kWh | no |
| grid-tariff | Number:EnergyPrice | Grid tariff in DKK per kWh. Only available when `gridCompanyGLN` is configured | no |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably add that - with the current implementations of CurrencyProvider - only one currency can be used.

Copy link
Contributor Author

@jlaur jlaur Dec 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, it seems I still don't fully understand even after your explanations in openhab/openhab-core#3503 (comment).

I ran some more extensive tests now:

State Provider Configuration Result
0.33126001 kr./kWh LocaleBasedCurrencyProvider Denmark 0.33126001 kr./kWh
0.33126001 DKK/kWh LocaleBasedCurrencyProvider Denmark java.lang.IllegalArgumentException: Invalid Quantity value: 0.33126001 DKK/kWh
0.33126001 kr./kWh LocaleBasedCurrencyProvider Sweden java.lang.IllegalArgumentException: Invalid Quantity value: 0.33126001 kr./kWh
0.33126001 kr./kWh FixedCurrencyProvider DKK 0.33126001 kr./kWh
0.33126001 kr./kWh FixedCurrencyProvider EUR 0.33126001 €./kWh
0.33126001 DKK/kWh FixedCurrencyProvider DKK java.lang.IllegalArgumentException: Invalid Quantity value: 0.33126001 DKK/kWh
0.044770 €/kWh FixedCurrencyProvider DKK java.lang.IllegalArgumentException: Invalid Quantity value: 0.044770 €/kWh
0.044770 €/kWh FixedCurrencyProvider EUR 0.044770 €/kWh

I have one channel which can be configured as either DKK or EUR, and all other channels are DKK. I guess this cannot work with UoM because it's not possible mix currencies? Also it seems that it's not possible to use any currency other than the configured one, although I'm a bit confused why case 3 and 5 have different results?

Perhaps you can advise how to avoid IllegalArgumentException? Can/should the binding check something before trying to update state with a specific currency that won't be accepted?

EDIT: @kaikreuzer - tagging you also since you have reviewed openhab/openhab-core#3503 - in case you'd be interested in this topic.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@J-N-K - I don't know if you are receiving notifications without being tagged explicitly, so just to be sure, please see above when you find time.

@jlaur jlaur deleted the energidataservice-uom-energyprice branch December 17, 2023 12:22
austvik pushed a commit to austvik/openhab-addons that referenced this pull request Mar 27, 2024
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
joni1993 pushed a commit to joni1993/openhab-addons that referenced this pull request Oct 15, 2024
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants