-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Jørgen Melhus <jmelhus@outlook.com>
Please add label new binding, i do not seem to have the necessary rights to do so. |
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 |
Thank you for creating this PR to contribute this binding. 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 |
There was a problem hiding this 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.
bundles/org.openhab.binding.entsoe/src/main/resources/OH-INF/thing/thing-types.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.entsoe/src/main/resources/OH-INF/thing/thing-types.xml
Outdated
Show resolved
Hide resolved
....openhab.binding.entsoe/src/main/java/org/openhab/binding/entsoe/internal/entsoeHandler.java
Outdated
Show resolved
Hide resolved
....openhab.binding.entsoe/src/main/java/org/openhab/binding/entsoe/internal/entsoeHandler.java
Outdated
Show resolved
Hide resolved
....openhab.binding.entsoe/src/main/java/org/openhab/binding/entsoe/internal/entsoeHandler.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/openhab/binding/entsoe/internal/exception/entsoeUnexpectedException.java
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.entsoe/src/main/resources/OH-INF/i18n/entsoe.properties
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.entsoe/src/main/resources/OH-INF/thing/thing-types.xml
Outdated
Show resolved
Hide resolved
...enhab.binding.entsoe/src/main/java/org/openhab/binding/entsoe/internal/client/EntsoData.java
Outdated
Show resolved
Hide resolved
...binding.entsoe/src/main/java/org/openhab/binding/entsoe/internal/entsoeBindingConstants.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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.
....openhab.binding.entsoe/src/main/java/org/openhab/binding/entsoe/internal/client/Client.java
Outdated
Show resolved
Hide resolved
....openhab.binding.entsoe/src/main/java/org/openhab/binding/entsoe/internal/client/Client.java
Outdated
Show resolved
Hide resolved
....openhab.binding.entsoe/src/main/java/org/openhab/binding/entsoe/internal/client/Client.java
Show resolved
Hide resolved
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>
@jlaur , thanks for the review. I have implemented the changes. For the httpclient i suggest to implement that in next release. |
There was a problem hiding this 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.
....openhab.binding.entsoe/src/main/java/org/openhab/binding/entsoe/internal/client/Client.java
Outdated
Show resolved
Hide resolved
....openhab.binding.entsoe/src/main/java/org/openhab/binding/entsoe/internal/EntsoeHandler.java
Outdated
Show resolved
Hide resolved
....openhab.binding.entsoe/src/main/java/org/openhab/binding/entsoe/internal/EntsoeHandler.java
Outdated
Show resolved
Hide resolved
....openhab.binding.entsoe/src/main/java/org/openhab/binding/entsoe/internal/EntsoeHandler.java
Outdated
Show resolved
Hide resolved
....openhab.binding.entsoe/src/main/java/org/openhab/binding/entsoe/internal/EntsoeHandler.java
Outdated
Show resolved
Hide resolved
....openhab.binding.entsoe/src/main/java/org/openhab/binding/entsoe/internal/EntsoeHandler.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Jørgen Melhus <jmelhus@outlook.com>
Signed-off-by: Jørgen Melhus <jmelhus@outlook.com>
@jlaur Thanks for the second review, i have looked into them and implemented the changes. |
Signed-off-by: Jørgen Melhus <jmelhus@outlook.com>
There was a problem hiding this 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.
....openhab.binding.entsoe/src/main/java/org/openhab/binding/entsoe/internal/EntsoeHandler.java
Outdated
Show resolved
Hide resolved
....openhab.binding.entsoe/src/main/java/org/openhab/binding/entsoe/internal/EntsoeHandler.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
private State getPriceState(BigDecimal kwhPrice) { | ||
if (baseUnit == null || fromUnit == null) { |
There was a problem hiding this comment.
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);
....openhab.binding.entsoe/src/main/java/org/openhab/binding/entsoe/internal/EntsoeHandler.java
Outdated
Show resolved
Hide resolved
....openhab.binding.entsoe/src/main/java/org/openhab/binding/entsoe/internal/EntsoeHandler.java
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.entsoe/src/main/resources/OH-INF/thing/thing-types.xml
Outdated
Show resolved
Hide resolved
Signed-off-by: Jørgen Melhus <jmelhus@outlook.com>
There was a problem hiding this 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); |
There was a problem hiding this comment.
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.
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); |
} catch (EntsoeResponseException | EntsoeConfigurationException e) { | ||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} 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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<label>Day ahead prices</label> | |
<label>Day-ahead prices</label> |
No description provided.