diff --git a/bundles/org.openhab.binding.enphase/src/main/java/org/openhab/binding/enphase/internal/discovery/EnvoyDiscoveryParticipant.java b/bundles/org.openhab.binding.enphase/src/main/java/org/openhab/binding/enphase/internal/discovery/EnvoyDiscoveryParticipant.java index 5c55cb49ec2ce..beae1cabfed10 100644 --- a/bundles/org.openhab.binding.enphase/src/main/java/org/openhab/binding/enphase/internal/discovery/EnvoyDiscoveryParticipant.java +++ b/bundles/org.openhab.binding.enphase/src/main/java/org/openhab/binding/enphase/internal/discovery/EnvoyDiscoveryParticipant.java @@ -128,7 +128,7 @@ public String getLastKnownHostAddress(final String serialNumber) { if (getServiceType().equals(info.getType())) { final String serial = info.getPropertyString(DISCOVERY_SERIAL); - logger.debug("Discovered an Envoy with id '{}'", serial); + logger.debug("Discovered an Envoy with serial number '{}'", serial); return new ThingUID(THING_TYPE_ENPHASE_ENVOY, serial); } return null; diff --git a/bundles/org.openhab.binding.enphase/src/main/java/org/openhab/binding/enphase/internal/handler/EnvoyBridgeHandler.java b/bundles/org.openhab.binding.enphase/src/main/java/org/openhab/binding/enphase/internal/handler/EnvoyBridgeHandler.java index e561fcc1ab100..9110327e2de06 100644 --- a/bundles/org.openhab.binding.enphase/src/main/java/org/openhab/binding/enphase/internal/handler/EnvoyBridgeHandler.java +++ b/bundles/org.openhab.binding.enphase/src/main/java/org/openhab/binding/enphase/internal/handler/EnvoyBridgeHandler.java @@ -12,7 +12,12 @@ */ package org.openhab.binding.enphase.internal.handler; -import static org.openhab.binding.enphase.internal.EnphaseBindingConstants.*; +import static org.openhab.binding.enphase.internal.EnphaseBindingConstants.CONFIG_HOSTNAME; +import static org.openhab.binding.enphase.internal.EnphaseBindingConstants.ENVOY_CHANNELGROUP_CONSUMPTION; +import static org.openhab.binding.enphase.internal.EnphaseBindingConstants.ENVOY_WATTS_NOW; +import static org.openhab.binding.enphase.internal.EnphaseBindingConstants.ENVOY_WATT_HOURS_LIFETIME; +import static org.openhab.binding.enphase.internal.EnphaseBindingConstants.ENVOY_WATT_HOURS_SEVEN_DAYS; +import static org.openhab.binding.enphase.internal.EnphaseBindingConstants.ENVOY_WATT_HOURS_TODAY; import java.time.Duration; import java.time.temporal.ChronoUnit; @@ -77,7 +82,7 @@ private enum FeatureStatus { private final EnvoyConnector connector; private final EnvoyHostAddressCache envoyHostnameCache; - private @NonNullByDefault({}) EnvoyConfiguration configuration; + private EnvoyConfiguration configuration = new EnvoyConfiguration(); private @Nullable ScheduledFuture updataDataFuture; private @Nullable ScheduledFuture updateHostnameFuture; private @Nullable ExpiringCache> invertersCache; @@ -134,12 +139,11 @@ public Collection> getServices() { public void initialize() { configuration = getConfigAs(EnvoyConfiguration.class); if (!EnphaseBindingConstants.isValidSerial(configuration.serialNumber)) { - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Serial Number is not valid"); + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Serial number is not valid"); return; } if (configuration.hostname.isEmpty()) { - updateStatus(ThingStatus.ONLINE, ThingStatusDetail.CONFIGURATION_PENDING, - "Waiting to retrieve ip address of the envoy gateway. Can take up to a minute."); + updateStatus(ThingStatus.UNKNOWN); } else { updateStatus(ThingStatus.ONLINE); } @@ -367,6 +371,8 @@ private void updateHostname() { final String lastKnownHostname = envoyHostnameCache.getLastKnownHostAddress(configuration.serialNumber); if (lastKnownHostname.isEmpty()) { + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, + "No ip address known of the envoy gateway. If this isn't updated in a few minutes check your connection."); scheduleHostnameUpdate(true); } else { final Configuration config = editConfiguration(); @@ -399,8 +405,7 @@ public void dispose() { * @return Returns true if the bridge is online and not has an configuration pending. */ public boolean isOnline() { - return getThing().getStatus() == ThingStatus.ONLINE - && getThing().getStatusInfo().getStatusDetail() == ThingStatusDetail.NONE; + return getThing().getStatus() == ThingStatus.ONLINE; } @Override diff --git a/bundles/org.openhab.binding.enphase/src/main/resources/OH-INF/i18n/enphase_en.properties b/bundles/org.openhab.binding.enphase/src/main/resources/OH-INF/i18n/enphase_en.properties index f6420ed5e0e4d..db42ff05d51e0 100644 --- a/bundles/org.openhab.binding.enphase/src/main/resources/OH-INF/i18n/enphase_en.properties +++ b/bundles/org.openhab.binding.enphase/src/main/resources/OH-INF/i18n/enphase_en.properties @@ -74,7 +74,7 @@ envoy.cond_flags.pcu_ctrl.pwrgenoffbycmd=Power generation off by command envoy.cond_flags.pcu_ctrl.runningonac=Running on AC envoy.cond_flags.pcu_ctrl.tpmtest=Transient Grid Profile envoy.cond_flags.pcu_ctrl.unexpectedreset=Unexpected Reset -envoy.cond_flags.pcu_ctrl.watchdogreset=Watchdog Reset" +envoy.cond_flags.pcu_ctrl.watchdogreset=Watchdog Reset envoy.cond_flags.rgm_chan.check_meter=Meter Error -envoy.cond_flags.rgm_chan.power_quality=Poor Power Quality" +envoy.cond_flags.rgm_chan.power_quality=Poor Power Quality