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

[freecurrency] Initial contribution #16194

Merged
merged 2 commits into from
Jan 15, 2024
Merged

[freecurrency] Initial contribution #16194

merged 2 commits into from
Jan 15, 2024

Conversation

J-N-K
Copy link
Member

@J-N-K J-N-K commented Jan 3, 2024

This is the first "real" CurrencyProvider that makes full use of the UoM currency capability introduced in openHAB 4.1. By getting a free API key 33 common currencies can be automatically converted.

Signed-off-by: Jan N. Klug <github@klug.nrw>
@J-N-K J-N-K added the new binding If someone has started to work on a binding. For a new binding PR. label Jan 3, 2024
@J-N-K J-N-K requested a review from a team as a code owner January 3, 2024 14:55
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/freecurrency-4-2-0-0-4-2-999/152632/1

xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">

<thing-type id="info" extensible="exchange-rate">
Copy link
Member

Choose a reason for hiding this comment

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

info is a bit too generic and may not age well if the API starts providing more info. So perhaps it can be more specific?

I see the API differentiates between latest and historical exchange rates so maybe that can be reflected in the name?

Copy link
Member Author

Choose a reason for hiding this comment

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

In general I agree. But unfortunately I'm out of ideas what would be a better naming.

@jlaur
Copy link
Contributor

jlaur commented Jan 6, 2024

@J-N-K - I wanted to give this a test run, but failed so far by just providing a JAR:

2024-01-06 00:23:24.792 [WARN ] [ore.thing.internal.ThingRegistryImpl] - Cannot create thing. No binding found that supports creating a thing of type 'freecurrency:info'.

Is there anything special that needs to be done?

Signed-off-by: Jan N. Klug <github@klug.nrw>
@J-N-K
Copy link
Member Author

J-N-K commented Jan 6, 2024

Did you configure the API key? If not, then the FreecurrencyProvider will not be activated and that prevents the activation of the HandlerFactory, which would result in your error message.

@jlaur
Copy link
Contributor

jlaur commented Jan 6, 2024

Did you configure the API key? If not, then the FreecurrencyProvider will not be activated and that prevents the activation of the HandlerFactory, which would result in your error message.

I totally missed that this has to be configured at binding level. 😳 I did wonder where to put it. 😄 Thanks, now it works much better.

@jlaur
Copy link
Contributor

jlaur commented Jan 6, 2024

@J-N-K - I ran into a situation where USD became quite sticky for an item without unit metadata and after having configured DKK as base currency. Updating to "1 DKK/kWh" or "1 EUR/kWh" resulted in "1 USD/kWh". After bundle:restart org.openhab.binding.freecurrency it started working. I will run some more tests and provide some more detailed feedback.

@jlaur
Copy link
Contributor

jlaur commented Jan 14, 2024

I ran into a situation where USD became quite sticky for an item without unit metadata and after having configured DKK as base currency. Updating to "1 DKK/kWh" or "1 EUR/kWh" resulted in "1 USD/kWh". After bundle:restart org.openhab.binding.freecurrency it started working. I will run some more tests and provide some more detailed feedback.

@J-N-K - I finally found time to run more tests, and so far I was not able to reproduce this issue. So this should not block the PR (FYI @wborn). I will naturally be testing this some more with Energi Data Service binding, and if I run into any issues later, I will isolate and report them. Thanks for this new feature!

One question: Is it possible for a binding for detect changes in country or currency provider, so that channels can be updated automatically in these cases?

Copy link
Member

@wborn wborn 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 for the new binding!

@wborn wborn merged commit 9400ced into openhab:main Jan 15, 2024
3 checks passed
@wborn wborn added this to the 4.2 milestone Jan 15, 2024
@J-N-K J-N-K deleted the freecurrency branch January 16, 2024 06:40
andrasU pushed a commit to andrasU/openhab-addons that referenced this pull request Jan 27, 2024
Signed-off-by: Jan N. Klug <github@klug.nrw>
Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
austvik pushed a commit to austvik/openhab-addons that referenced this pull request Mar 27, 2024
Signed-off-by: Jan N. Klug <github@klug.nrw>
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: Jan N. Klug <github@klug.nrw>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new binding If someone has started to work on a binding. For a new binding PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants