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

[stiebeleltron] Initial commit #7718

Merged
merged 20 commits into from
Aug 27, 2020
Merged

[stiebeleltron] Initial commit #7718

merged 20 commits into from
Aug 27, 2020

Conversation

pail23
Copy link
Contributor

@pail23 pail23 commented May 21, 2020

[stiebeleltron] Initial contribution of a ISG Binding (Modbus)

This is a initial contribution for a binding to connect to the Internet Service Gateway of Stiebel Eltron heat pumps through modbus. The binding is heavily inspired by and based on the modbus spunspec binding.
A test version of the binding can be downloaded here.

@pail23 pail23 requested a review from a team as a code owner May 21, 2020 18:43
@cpmeister cpmeister added the new binding If someone has started to work on a binding. For a new binding PR. label May 21, 2020
@TravisBuddy
Copy link

Travis tests were successful

Hey @pail23,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.


| Channel ID | Item Type | Read only | Description |
| --------------------------- | ------------------ | --------- | ------------------------------------------- |
| operation-mode | Number | false | The current operation mode of the heat pump |
Copy link
Member

Choose a reason for hiding this comment

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

Can you specify what the numbers refer to?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added the possible values for the operation mode


| Channel ID | Item Type | Read only | Description |
| ----------------------- | ------------- | --------- | ------------------------------------------------ |
| production_heat_today | Number:Energy | true | The heat quantity delivered today |
Copy link
Member

Choose a reason for hiding this comment

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

The above channel IDs use dashes for sepration. Is there a reason why you use underscores, here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Fixed. Thanks


| Thing | Description |
| ------------------------ | -------------------------------------------------- |
| Stiebel Eltron ISG | A stiebel eltron heat pump connected through a ISG |
Copy link
Member

Choose a reason for hiding this comment

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

Can you mention the ThingID here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Done.

Comment on lines 43 to 45
/**
* Reference to the modbus manager
*/
Copy link
Member

Choose a reason for hiding this comment

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

This comment has no benefit. You could remove it. Same for similar. Private fields don't need to be commented.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment removed

@@ -0,0 +1,17 @@
# FIXME: please substitute the xx_XX with a proper locale, ie. de_DE
Copy link
Member

Choose a reason for hiding this comment

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

Did this file find its way into your binding by intention?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

File removed

Copy link
Member

Choose a reason for hiding this comment

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

Again with the unchecked exception. The user could configure an unsupported unit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess this comment goes to StiebelEltronHandler (and not to the .properties file)


<channel-type id="fek-temperature-type">
<item-type>Number:Temperature</item-type>
<label>FFK temperature</label>
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed on all occasions

bundles/pom.xml Outdated
@@ -1,501 +1,982 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
Copy link
Member

Choose a reason for hiding this comment

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

Can you remove the formatting from this file?

@pail23
Copy link
Contributor Author

pail23 commented Jun 17, 2020

@fwolter many thanks for your review. I tried to address all your comments.

@pail23 pail23 added rebuild Triggers Jenkins PR build and removed rebuild Triggers Jenkins PR build labels Jun 17, 2020
Copy link
Member

@fwolter fwolter left a comment

Choose a reason for hiding this comment

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

Did you notice my comments in the handler file?

private static final String BINDING_ID = ModbusBindingConstants.BINDING_ID;

// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_SAMPLE = new ThingTypeUID(BINDING_ID, "heatpump");
Copy link
Member

Choose a reason for hiding this comment

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

The field is named THING_TYPE_SAMPLE.

@pail23
Copy link
Contributor Author

pail23 commented Jun 18, 2020

@fwolter Thanks for the hint. It should be fixed now

@fwolter
Copy link
Member

fwolter commented Jun 18, 2020

Did you click on "Load more ..."? There are 19 comments, you didn't react to.

@pail23
Copy link
Contributor Author

pail23 commented Jun 19, 2020

@fwolter Indeed I did not see the 19 other review comments before. Thanks!

@pail23
Copy link
Contributor Author

pail23 commented Jun 22, 2020

@fwolter All your comments should be fixed now. Many thanks for your review. Please let me know if there are other things I should change.

Copy link
Member

@fwolter fwolter left a comment

Choose a reason for hiding this comment

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

Your changes look good. I found another few minor things, I overlooked at the first review.

openHAB 2.5.6 has been released. Can you rebase your code and change the version number to 2.5.7-SNAPSHOT?

There are some formatting issues. You can view them with mvn spotless:check -Dspotless.check.skip=false and fix them with mvn spotless:apply.

*/
public class SystemParameterBlock {

public Integer operation_mode;
Copy link
Member

Choose a reason for hiding this comment

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

See above (camel case)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to camel case

*/
public class SystemParameterBlock {

public Integer operation_mode;
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason why you use complex type? Can this be int? Same for below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to int

*/
public class SystemStateBlock {

public Integer state;
Copy link
Member

Choose a reason for hiding this comment

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

See above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to int

public void bridgeStatusChanged(ThingStatusInfo bridgeStatusInfo) {
super.bridgeStatusChanged(bridgeStatusInfo);

logger.debug("Thing status changed to {}", this.getThing().getStatus().name());
Copy link
Member

Choose a reason for hiding this comment

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

See above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

Comment on lines 686 to 647
if (getThing().getStatus() == ThingStatus.ONLINE) {
startUp();
} else if (getThing().getStatus() == ThingStatus.OFFLINE) {
tearDown();
}
Copy link
Member

Choose a reason for hiding this comment

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

You are checking for the Thing status here. Do you want to check the bridge status?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point. I have changed it to the bridge status

/**
* Reset communication status to ONLINE if we're in an OFFLINE state
*/
protected void resetCommunicationError() {
Copy link
Member

Choose a reason for hiding this comment

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

Is this method used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have inserted the method call in the polling data handlers


<config-description uri="thing-type:stiebeleltron:modbusconfig">

<parameter name="refresh" type="integer" min="0" unit="s">
Copy link
Member

Choose a reason for hiding this comment

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

Did you test 0? If I see correctly it will be passed to the modbus code, which will throw an IllegalArgumentException.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed it to one

@TravisBuddy
Copy link

Travis tests were successful

Hey @pail23,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

1 similar comment
@TravisBuddy
Copy link

Travis tests were successful

Hey @pail23,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

@pail23
Copy link
Contributor Author

pail23 commented Jun 24, 2020

@fwolter Thanks once again. All your comments should be reflected, except the one regarding the Status Update

Copy link
Member

@fwolter fwolter left a comment

Choose a reason for hiding this comment

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

LGTM

Since this is a new binding, another maintainer needs to review your code. This can take some time, because the backlog is quite extensive. Please be patient.

@fwolter fwolter added the cre Coordinated Review Effort label Jun 24, 2020
@cpmeister
Copy link
Contributor

Since PR #7994 makes improvements to the modbus api that this PR would use, I'll hold back on reviewing this PR until the API changes have gone through.

@TravisBuddy
Copy link

Travis tests have failed

Hey @pail23,
please read the following log in order to understand the failure reason. There might also be some helpful tips along the way.
It will be awesome if you fix what is wrong and commit the changes.

@TravisBuddy
Copy link

Travis tests were successful

Hey @pail23,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

Copy link
Member

@fwolter fwolter 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 implementing the new API.

if (getThing().getStatus() != ThingStatus.ONLINE) {
updateStatus(ThingStatus.ONLINE);
}
}, failure -> {StiebelEltronHandler.this.handleReadError(failure);});
Copy link
Member

Choose a reason for hiding this comment

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

Syntactical sugar. Same for below.

Suggested change
}, failure -> {StiebelEltronHandler.this.handleReadError(failure);});
}, StiebelEltronHandler.this::handleReadError);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to your proposal

Comment on lines 308 to 311
String msg = "";
String cls = "";
cls = error.getClass().getName();
msg = error.getMessage();
Copy link
Member

Choose a reason for hiding this comment

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

Initialization with empty strings has no effect, since they are overwritten below. You can initialize them with the intended values at once.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the initialization with the empty strings

@pail23
Copy link
Contributor Author

pail23 commented Jul 13, 2020

Thanks @fwolter for your review. I have implemented the 2 proposed changes.

@TravisBuddy
Copy link

Travis tests were successful

Hey @pail23,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

Copy link
Member

@Hilbrand Hilbrand 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 your contribution. Just some minor comments.


This extension adds support for the Stiebel Eltron modbus protocol.

An Internet Service Gateway (ISG) with an installed modbus extension is required in order to run this binding. In case the modbus extension is not yet installed on the ISG, the ISG Updater Tool for the update can be found here: https://www.stiebel-eltron.de/de/home/produkte-loesungen/erneuerbare_energien/regelung_energiemanagement/internet_servicegateway/isg_web/downloads.html
Copy link
Member

Choose a reason for hiding this comment

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

Can you put each line on a new line so it makes it easier to review (future) improvements to the documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It think I implemented your feedback. Please have a look and let me know in case I didn't understand your review comment properly.

bundles/pom.xml Outdated
@@ -230,7 +231,7 @@
<module>org.openhab.binding.snmp</module>
<module>org.openhab.binding.solaredge</module>
<module>org.openhab.binding.solarlog</module>
<module>org.openhab.binding.somfymylink</module>
<module>org.openhab.binding.somfymylink</module>
Copy link
Member

Choose a reason for hiding this comment

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

Please revert this indentation change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

<parent>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>2.5.7-SNAPSHOT</version>
Copy link
Member

Choose a reason for hiding this comment

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

Please rebase/update to 2.5.8-SNAPSHOT

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

pail23 and others added 13 commits August 27, 2020 07:58
Signed-off-by: Paul Frank <[email protected]>
Signed-off-by: Paul Frank <[email protected]>
…/org/openhab/binding/modbus/stiebeleltron/internal/dto/SystemInformationBlock.java

Co-authored-by: Fabian Wolter <[email protected]>
Signed-off-by: Paul Frank <[email protected]>
…/org/openhab/binding/modbus/stiebeleltron/internal/handler/StiebelEltronHandler.java

Co-authored-by: Fabian Wolter <[email protected]>
Signed-off-by: Paul Frank <[email protected]>
Signed-off-by: Paul Frank <[email protected]>
Signed-off-by: Paul Frank <[email protected]>
Signed-off-by: Paul Frank <[email protected]>
Signed-off-by: Paul Frank <[email protected]>
@TravisBuddy
Copy link

Travis tests have failed

Hey @pail23,
please read the following log in order to understand the failure reason. There might also be some helpful tips along the way.
It will be awesome if you fix what is wrong and commit the changes.

Signed-off-by: Paul Frank <[email protected]>
@TravisBuddy
Copy link

Travis tests were successful

Hey @pail23,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

Signed-off-by: Paul Frank <[email protected]>
@TravisBuddy
Copy link

Travis tests were successful

Hey @pail23,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

@pail23
Copy link
Contributor Author

pail23 commented Aug 27, 2020

Thanks @Hilbrand for the review! I tried to implement your feedback.

Copy link
Member

@Hilbrand Hilbrand left a comment

Choose a reason for hiding this comment

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

LGTM

@Hilbrand Hilbrand merged commit 1857a42 into openhab:2.5.x Aug 27, 2020
@Hilbrand Hilbrand added this to the 2.5.9 milestone Aug 27, 2020
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
DaanMeijer pushed a commit to DaanMeijer/openhab-addons that referenced this pull request Sep 1, 2020
Signed-off-by: Paul Frank <[email protected]>
Signed-off-by: Daan Meijer <[email protected]>
CSchlipp pushed a commit to CSchlipp/openhab-addons that referenced this pull request Sep 12, 2020
markus7017 pushed a commit to markus7017/openhab-addons that referenced this pull request Sep 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cre Coordinated Review Effort 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.

5 participants