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

[entsoe] Initial contribution #17416

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

[entsoe] Initial contribution #17416

wants to merge 13 commits into from

Conversation

jmelhus
Copy link
Contributor

@jmelhus jmelhus commented Sep 14, 2024

No description provided.

Signed-off-by: Jørgen Melhus <jmelhus@outlook.com>
@jmelhus jmelhus requested a review from a team as a code owner September 14, 2024 09:50
@jmelhus
Copy link
Contributor Author

jmelhus commented Sep 14, 2024

Please add label new binding, i do not seem to have the necessary rights to do so.

@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/entsoe-binding-4-0-0-5-0-0/149699/50

@lsiepel lsiepel added the new binding If someone has started to work on a binding. For a new binding PR. label Sep 14, 2024
@lsiepel
Copy link
Contributor

lsiepel commented Sep 14, 2024

Thank you for creating this PR to contribute this binding.
To manage expectations; review capacity is somewhat limited so don’t expect an immediate full review. To speed up the process you can already perform a self-review by checking this list: https://github.com/openhab/openhab-addons/wiki/Review-Checklist

Have not looked at this PR yet, it may be of very good quality. But common review comments for new bindings are about thing structure (xml), naming convention and log levels. So you might double check those areas.

It will also help to have a summary OP, with testable jar etc

Copy link
Contributor

@jlaur jlaur left a comment

Choose a reason for hiding this comment

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

Many thanks for contributing this new binding! 👍

I have had a very quick initial look, please find my comments below. Also I see some issues with naming convention compliance and null annotations, please have a look at the SAT report and compiler warnings.

@jlaur jlaur changed the title [entsoe] initial contribution [entsoe] Initial contribution Sep 14, 2024
Copy link
Contributor

@jlaur jlaur left a comment

Choose a reason for hiding this comment

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

I have added a few additional comments.

jmelhus and others added 8 commits September 15, 2024 18:21
Signed-off-by: Jørgen Melhus <jmelhus@outlook.com>
…ion.java

Signed-off-by: Jørgen Melhus <5099412+jmelhus@users.noreply.github.com>
Signed-off-by: Jørgen Melhus <5099412+jmelhus@users.noreply.github.com>
…java

Signed-off-by: Jørgen Melhus <5099412+jmelhus@users.noreply.github.com>
Signed-off-by: Jørgen Melhus <5099412+jmelhus@users.noreply.github.com>
Signed-off-by: Jørgen Melhus <5099412+jmelhus@users.noreply.github.com>
Signed-off-by: Jørgen Melhus <5099412+jmelhus@users.noreply.github.com>
Signed-off-by: Jørgen Melhus <5099412+jmelhus@users.noreply.github.com>
@jmelhus
Copy link
Contributor Author

jmelhus commented Sep 15, 2024

@jlaur , thanks for the review. I have implemented the changes. For the httpclient i suggest to implement that in next release.

Copy link
Contributor

@jlaur jlaur left a comment

Choose a reason for hiding this comment

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

Thanks for quickly addressing review comments. I have added a few more on top of the few remaining comments not yet addressed.

I do not expect to find anything major going forward, so probably we are approaching a final round.

There are also a few compiler warnings left to address.

Signed-off-by: Jørgen Melhus <jmelhus@outlook.com>
Signed-off-by: Jørgen Melhus <jmelhus@outlook.com>
@jmelhus
Copy link
Contributor Author

jmelhus commented Sep 16, 2024

@jlaur Thanks for the second review, i have looked into them and implemented the changes.

Signed-off-by: Jørgen Melhus <jmelhus@outlook.com>
@jlaur jlaur added rebuild Triggers Jenkins PR build and removed rebuild Triggers Jenkins PR build labels Sep 18, 2024
Copy link
Contributor

@jlaur jlaur left a comment

Choose a reason for hiding this comment

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

I have added a few more comments - I consider this my last round. I hope to give the binding a test run this weekend.

Please note that there are also some unresolved/uncommented comments from the first two rounds. You might have to click "Load more..." to see hidden conversations.

bundles/org.openhab.binding.entsoe/README.md Outdated Show resolved Hide resolved
bundles/org.openhab.binding.entsoe/README.md Outdated Show resolved Hide resolved
bundles/org.openhab.binding.entsoe/README.md Outdated Show resolved Hide resolved
bundles/org.openhab.binding.entsoe/README.md Outdated Show resolved Hide resolved
bundles/org.openhab.binding.entsoe/README.md Outdated Show resolved Hide resolved
}

private State getPriceState(BigDecimal kwhPrice) {
if (baseUnit == null || fromUnit == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe neither baseUnit or fromUnit is never null since they are set in lines 69-70 and never changed:

private Unit<Currency> baseUnit = CurrencyUnits.BASE_CURRENCY;
private Unit<Currency> fromUnit = new CurrencyUnit(EntsoeBindingConstants.ENTSOE_CURRENCY, null);

Signed-off-by: Jørgen Melhus <jmelhus@outlook.com>
Copy link
Contributor

@jlaur jlaur left a comment

Choose a reason for hiding this comment

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

@jmelhus - I'm wondering if you are in GitHub self-review mode and did not publish any of your own comments yet? Or did you actually not respond to any of my comments?


private void refreshPrices() {
if (!isLinked(EntsoeBindingConstants.CHANNEL_SPOT_PRICE)) {
logger.debug("Channel {} is not linked, cant update channel", EntsoeBindingConstants.CHANNEL_SPOT_PRICE);
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually we can, we just don't need to. It's an optimization.

Suggested change
logger.debug("Channel {} is not linked, cant update channel", EntsoeBindingConstants.CHANNEL_SPOT_PRICE);
logger.debug("Channel {} is not linked, skipping channel update", EntsoeBindingConstants.CHANNEL_SPOT_PRICE);

Comment on lines +220 to +221
} catch (EntsoeResponseException | EntsoeConfigurationException e) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
} catch (EntsoeResponseException | EntsoeConfigurationException e) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
} catch (EntsoeResponseException e) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
} catch (EntsoeConfigurationException e) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, e.getMessage());


<thing-type id="day-ahead">

<label>Day ahead prices</label>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<label>Day ahead prices</label>
<label>Day-ahead prices</label>

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