From c2a632940858b944f42a91c80f7b7a91a69b83a3 Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Sat, 18 Nov 2023 16:58:25 -0700 Subject: [PATCH] [mqtt.homeassistant] Handle empty device name (#15918) Follow on to #15427 ring-mqtt sends `"name": ""`, not `"name": null` or simply omitting it, so be sure to handle that way as well Signed-off-by: Cody Cutrer --- .../homeassistant/internal/component/AbstractComponent.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/component/AbstractComponent.java b/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/component/AbstractComponent.java index 87625305d..ebe696ee0 100644 --- a/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/component/AbstractComponent.java +++ b/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/component/AbstractComponent.java @@ -86,7 +86,8 @@ public abstract class AbstractComponent this.haID = componentConfiguration.getHaID(); - if (channelConfiguration.getName() != null) { + String name = channelConfiguration.getName(); + if (name != null && !name.isEmpty()) { String groupId = this.haID.getGroupId(channelConfiguration.getUniqueId()); this.channelGroupTypeUID = new ChannelGroupTypeUID(MqttBindingConstants.BINDING_ID, groupId);