]> git.basschouten.com Git - openhab-addons.git/commitdiff
[digitalstrom] remove unnecessary call to bridgeStatusChanged (#9263)
authorJ-N-K <J-N-K@users.noreply.github.com>
Mon, 7 Dec 2020 20:35:35 +0000 (21:35 +0100)
committerGitHub <noreply@github.com>
Mon, 7 Dec 2020 20:35:35 +0000 (12:35 -0800)
Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/BridgeHandler.java
bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/CircuitHandler.java
bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/DeviceHandler.java
bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/SceneHandler.java
bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/ZoneTemperatureControlHandler.java

index 43db8ef76db80cbb0085689121a27696d40e2de0..91f32ab773b456c98ce4ff292dcc7df37a68c1f4 100644 (file)
@@ -64,7 +64,6 @@ import org.openhab.core.thing.ThingStatusDetail;
 import org.openhab.core.thing.ThingTypeUID;
 import org.openhab.core.thing.binding.BaseBridgeHandler;
 import org.openhab.core.thing.binding.ThingHandler;
-import org.openhab.core.thing.binding.builder.ThingStatusInfoBuilder;
 import org.openhab.core.types.Command;
 import org.openhab.core.types.RefreshType;
 import org.slf4j.Logger;
@@ -367,14 +366,8 @@ public class BridgeHandler extends BaseBridgeHandler
 
     @Override
     public void handleRemoval() {
-        for (Thing thing : getThing().getThings()) {
-            // Inform Thing-Child's about removed bridge.
-            final ThingHandler thingHandler = thing.getHandler();
-            if (thingHandler != null) {
-                thingHandler.bridgeStatusChanged(ThingStatusInfoBuilder.create(ThingStatus.REMOVED).build());
-            }
-        }
-        if (StringUtils.isNotBlank((String) super.getConfig().get(APPLICATION_TOKEN))) {
+        String applicationToken = (String) super.getConfig().get(APPLICATION_TOKEN);
+        if (applicationToken != null && !applicationToken.isEmpty()) {
             if (connMan == null) {
                 Config config = loadAndCheckConnectionData(this.getConfig());
                 if (config != null) {
index e315acddcbef96ea73cf2b019decc7d140f9020d..b5579dcd4e94b8a7a36cb7c13a1ef600d50604e6 100644 (file)
@@ -151,9 +151,6 @@ public class CircuitHandler extends BaseThingHandler implements DeviceStatusList
         if (bridgeStatusInfo.getStatus().equals(ThingStatus.OFFLINE)) {
             updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE);
         }
-        if (bridgeStatusInfo.getStatus().equals(ThingStatus.REMOVED)) {
-            updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, "Bridge has been removed.");
-        }
         logger.debug("Set status to {}", getThing().getStatusInfo());
     }
 
index 4f6a3ccfe570dc7320ebc42d833588eeffba1103..73233af40dd61b90592140b80b9583f758815593 100644 (file)
@@ -176,9 +176,6 @@ public class DeviceHandler extends BaseThingHandler implements DeviceStatusListe
         if (bridgeStatusInfo.getStatus().equals(ThingStatus.OFFLINE)) {
             updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE);
         }
-        if (bridgeStatusInfo.getStatus().equals(ThingStatus.REMOVED)) {
-            updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, "Bridge has been removed.");
-        }
         logger.debug("Set status to {}", getThing().getStatusInfo());
     }
 
index bd903694abaf4d3ba23b408db096ddcd575c7d0b..13515077d98a3be3d9b82b5ed69b513bf6e0d068 100644 (file)
@@ -171,9 +171,6 @@ public class SceneHandler extends BaseThingHandler implements SceneStatusListene
         if (bridgeStatusInfo.getStatus().equals(ThingStatus.OFFLINE)) {
             updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE);
         }
-        if (bridgeStatusInfo.getStatus().equals(ThingStatus.REMOVED)) {
-            updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, "Bridge has been removed.");
-        }
         logger.debug("Set status to {}", getThing().getStatusInfo());
     }
 
index 1308bf201331ffcabc8647c828cbd5eb64c68ecb..41f8b9ef98db22beba17486e62cfbb6fe1c83404 100644 (file)
@@ -186,9 +186,6 @@ public class ZoneTemperatureControlHandler extends BaseThingHandler implements T
         if (bridgeStatusInfo.getStatus().equals(ThingStatus.OFFLINE)) {
             updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE);
         }
-        if (bridgeStatusInfo.getStatus().equals(ThingStatus.REMOVED)) {
-            updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, "Bridge has been removed.");
-        }
         logger.debug("Set status to {}", getThing().getStatusInfo());
     }