From fa87a1b2f445f3db45ce4f050dd72474a9da779b Mon Sep 17 00:00:00 2001 From: lolodomo Date: Sun, 19 Feb 2023 20:59:18 +0100 Subject: [PATCH] [mycroft] Adjust thread name for web socket client (#14342) Signed-off-by: Laurent Garnier --- .../openhab/binding/mycroft/internal/MycroftHandler.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/MycroftHandler.java b/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/MycroftHandler.java index bb132c37e823c..7b00fa0318632 100644 --- a/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/MycroftHandler.java +++ b/bundles/org.openhab.binding.mycroft/src/main/java/org/openhab/binding/mycroft/internal/MycroftHandler.java @@ -43,6 +43,7 @@ import org.openhab.core.thing.ThingStatus; import org.openhab.core.thing.ThingStatusDetail; import org.openhab.core.thing.binding.BaseThingHandler; +import org.openhab.core.thing.util.ThingWebClientUtil; import org.openhab.core.types.Command; import org.openhab.core.types.State; import org.slf4j.Logger; @@ -126,13 +127,7 @@ public void initialize() { logger.debug("Start initializing Mycroft {}", thing.getUID()); - String websocketID = thing.getUID().getAsString().replace(':', '-'); - if (websocketID.length() < 4) { - websocketID = "mycroft-" + websocketID; - } - if (websocketID.length() > 20) { - websocketID = websocketID.substring(websocketID.length() - 20); - } + String websocketID = ThingWebClientUtil.buildWebClientConsumerName(thing.getUID(), null); this.connection = new MycroftConnection(this, webSocketFactory.createWebSocketClient(websocketID)); config = getConfigAs(MycroftConfiguration.class);