]> git.basschouten.com Git - openhab-addons.git/commitdiff
[freeboxos] Fix creation of properties and dynamic channels at init (#17081)
authorlolodomo <lg.hc@free.fr>
Tue, 16 Jul 2024 15:52:57 +0000 (17:52 +0200)
committerGitHub <noreply@github.com>
Tue, 16 Jul 2024 15:52:57 +0000 (17:52 +0200)
This was bypassed in bridgeStatusChanged.

Fix #17078
Fix #17079

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/handler/ApiConsumerHandler.java

index 4e8406bc555fab5f061443dabc83eeea9309a2f4..a4052acec03091ac95236211f1a09eabbac3b536 100644 (file)
@@ -58,7 +58,7 @@ import org.slf4j.LoggerFactory;
 import inet.ipaddr.IPAddress;
 
 /**
- * The {@link ServerHandler} is a base abstract class for all devices made available by the FreeboxOs bridge
+ * The {@link ApiConsumerHandler} is a base abstract class for all devices made available by the FreeboxOs bridge
  *
  * @author GaĆ«l L'hopital - Initial contribution
  */
@@ -80,7 +80,10 @@ public abstract class ApiConsumerHandler extends BaseThingHandler implements Api
         if (bridgeHandler == null) {
             return;
         }
+        initializeOnceBridgeOnline(bridgeHandler);
+    }
 
+    private void initializeOnceBridgeOnline(FreeboxOsHandler bridgeHandler) {
         Map<String, String> properties = editProperties();
         if (properties.isEmpty()) {
             try {
@@ -132,8 +135,9 @@ public abstract class ApiConsumerHandler extends BaseThingHandler implements Api
 
     @Override
     public void bridgeStatusChanged(ThingStatusInfo bridgeStatusInfo) {
-        if (checkBridgeHandler() != null) {
-            startRefreshJob();
+        FreeboxOsHandler bridgeHandler = checkBridgeHandler();
+        if (bridgeHandler != null) {
+            initializeOnceBridgeOnline(bridgeHandler);
         } else {
             stopJobs();
         }