-
-
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
[enphase] Initial contribution #9883
Conversation
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/new-binding-enphase-envoy-solar-system-gateway/44449/41 |
Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
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 hope some of these are useful feedback, if not just ignore as some may reflect my lack of java and coding knowledge.
...ding.enphase/src/main/java/org/openhab/binding/enphase/internal/EnphaseBindingConstants.java
Outdated
Show resolved
Hide resolved
...ding.enphase/src/main/java/org/openhab/binding/enphase/internal/EnphaseBindingConstants.java
Show resolved
Hide resolved
...b.binding.enphase/src/main/java/org/openhab/binding/enphase/internal/EnvoyConfiguration.java
Show resolved
Hide resolved
...ing.enphase/src/main/java/org/openhab/binding/enphase/internal/EnvoyConnectionException.java
Show resolved
Hide resolved
bundles/org.openhab.binding.enphase/src/main/resources/OH-INF/thing/thing-types.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.enphase/src/main/resources/OH-INF/thing/thing-types.xml
Show resolved
Hide resolved
bundles/org.openhab.binding.enphase/src/main/resources/OH-INF/thing/thing-types.xml
Outdated
Show resolved
Hide resolved
Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
...main/java/org/openhab/binding/enphase/internal/discovery/EnphaseDevicesDiscoveryService.java
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.
LGTM
.../src/main/java/org/openhab/binding/enphase/internal/discovery/EnvoyDiscoveryParticipant.java
Show resolved
Hide resolved
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Serial Number is not valid"); | ||
} | ||
if (configuration.hostname.isEmpty()) { | ||
updateStatus(ThingStatus.ONLINE, ThingStatusDetail.CONFIGURATION_PENDING, |
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.
Can it really be considered online at this point?
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.
Yes good question. I didn't know how to handle it otherwise. Looking at the status table: https://www.openhab.org/docs/concepts/things.html#status-details This comes closest to what would give some meaningful status in this case. Other status are not expected to have details and thus are not expected to have additional detail text. If you have another idea let me know.
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've changed this so set to UNKNOWN
at this point, and to set to OFF_LINE if it doesn't have an ip address.
...g.enphase/src/main/java/org/openhab/binding/enphase/internal/handler/EnvoyBridgeHandler.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
Today i change some wiring and forgot to plug the ethernet cable in. :-| The Envoy remained in Status Online / config_pending / waiting to retrieve ip address of the envoy gateway. This was there for hours. I'm not sure how to fix, but i would have expected an offline state after a while, Device unreachable or something like that. |
@lsiepel I did some checks. At first sight it looks like the underlying mdns discovery in openhab-core doesn't recover correctly from a situation where network is reconnected. This means it won't work in the enphase binding here as the setting of the ip address depends on the discovery. A restart of openHAB with network connected should fix the issue or edit the thing, click advanced and add the ip address manually. |
@lsiepel I did some tests. It looks like the underlying mdns of openhab-core isn't able to correctly recover from network changes. A restart of openHAB seems to be required. In this case you can also manually configure the ip address by clicking show advanced on the thing configuration in the ui. |
I fixed it by attaching the cable ;-) and disabling/enabling the thing, so no worries. The point i tried to make was that the error was not related to the configuration and waiting any longer would not help. Not a big issue'but i would expected a status offline. |
} catch (final EnvoyNoHostnameException e) { | ||
// ignore hostname exception here. It's already handled by others. | ||
} catch (final EnvoyConnectionException e) { | ||
logger.trace("refreshInverters connection problem", e); |
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.
It seems unreasonable to log the stacktrace when the network fails.
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.
It's therefor logged to trace. To have the ability to get debug information just in case something explainable is triggered.
private final EnvoyConnector connector; | ||
private final EnvoyHostAddressCache envoyHostnameCache; | ||
|
||
private @NonNullByDefault({}) EnvoyConfiguration configuration; |
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.
You could assign an empty configuration object to get rid of the null disabling.
logger.info( | ||
"This Ephase Envoy device ({}) doesn't seem to support json data. So not all channels are set.", | ||
getThing().getUID()); |
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.
Logging to info should be used sparsely e.g. a newly started component or a user file that has been loaded. This could be debug. Please check all.
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.
The logging here is done to inform the user about available of certain features of their devices. It's only done at startup of the thing. The other logging is to log a configuration setting has been automatically adjusted. Therefor I think is within the spirit of of log to info.
envoy.cond_flags.acb_ctrl.cellminvoltagewarning=Cell Min Voltage Warning | ||
envoy.cond_flags.acb_ctrl.cibcanerror=CIB CAN Error | ||
envoy.cond_flags.acb_ctrl.cibimageerror=CIB Image Error | ||
envoy.cond_flags.acb_ctrl.cibspierror=CIB SPI Error" |
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.
Is the "
inteded? Same for below.
Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
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.
LGTM
Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl> Signed-off-by: John Marshall <john.marshall.au@gmail.com>
Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
Temporary install until merged:
Open console:
And install binding: