]> git.basschouten.com Git - openhab-addons.git/commitdiff
[deconz] fix websocketId creation (#9019)
authorJ-N-K <J-N-K@users.noreply.github.com>
Fri, 13 Nov 2020 23:02:21 +0000 (00:02 +0100)
committerGitHub <noreply@github.com>
Fri, 13 Nov 2020 23:02:21 +0000 (15:02 -0800)
Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/DeconzBridgeHandler.java

index b24be497ae1e441665b7938327599f20e6e084b0..cc19c64f4ad9a3cfa80cfdff7605b72da06b510f 100644 (file)
@@ -83,7 +83,11 @@ public class DeconzBridgeHandler extends BaseBridgeHandler implements WebSocketC
         this.http = http;
         this.gson = gson;
         String websocketID = thing.getUID().getAsString().replace(':', '-');
-        websocketID = websocketID.length() < 3 ? websocketID : websocketID.substring(websocketID.length() - 20);
+        if (websocketID.length() < 4) {
+            websocketID = "openHAB-deconz-" + websocketID;
+        } else if (websocketID.length() > 20) {
+            websocketID = websocketID.substring(websocketID.length() - 20);
+        }
         this.websocket = new WebSocketConnection(this, webSocketFactory.createWebSocketClient(websocketID), gson);
     }