]> git.basschouten.com Git - openhab-addons.git/commitdiff
[mqtt.homeassistant] Handle empty device name (#15918)
authorCody Cutrer <cody@cutrer.us>
Sat, 18 Nov 2023 23:58:25 +0000 (16:58 -0700)
committerGitHub <noreply@github.com>
Sat, 18 Nov 2023 23:58:25 +0000 (00:58 +0100)
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 <cody@cutrer.us>
bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/component/AbstractComponent.java

index 87625305d300b84a1977ba1f758305761587f55b..ebe696ee01aa5e5087dd02ac38ccc81e3116b6df 100644 (file)
@@ -86,7 +86,8 @@ public abstract class AbstractComponent<C extends AbstractChannelConfiguration>
 
         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);