]> git.basschouten.com Git - openhab-addons.git/commitdiff
[intesis] Fix channel state options not set when channel exists (#8963)
authorHans-Jörg Merk <github@hmerk.de>
Thu, 5 Nov 2020 19:58:41 +0000 (20:58 +0100)
committerGitHub <noreply@github.com>
Thu, 5 Nov 2020 19:58:41 +0000 (11:58 -0800)
Signed-off-by: Hans-Jörg Merk <github@hmerk.de>
bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/handler/IntesisBoxHandler.java
bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/handler/IntesisHomeHandler.java

index eb363bac10eccda09f956084139204bdf0645797..56ce19df3b2d30b935c66a06046e0468c3558d84 100644 (file)
@@ -347,16 +347,14 @@ public class IntesisBoxHandler extends BaseThingHandler implements IntesisBoxCha
                     .withType(channelTypeUID).withKind(ChannelKind.STATE).build();
             thingBuilder.withChannel(channel);
             updateThing(thingBuilder.build());
-
-            if (limits.containsKey(channelId)) {
-                List<StateOption> options = new ArrayList<>();
-                for (String mode : limits.get(channelId)) {
-                    options.add(new StateOption(mode,
-                            mode.substring(0, 1).toUpperCase() + mode.substring(1).toLowerCase()));
-                }
-                intesisStateDescriptionProvider.setStateOptions(new ChannelUID(getThing().getUID(), channelId),
-                        options);
+        }
+        if (limits.containsKey(channelId)) {
+            List<StateOption> options = new ArrayList<>();
+            for (String mode : limits.get(channelId)) {
+                options.add(
+                        new StateOption(mode, mode.substring(0, 1).toUpperCase() + mode.substring(1).toLowerCase()));
             }
+            intesisStateDescriptionProvider.setStateOptions(new ChannelUID(getThing().getUID(), channelId), options);
         }
     }
 
index 194a50db15c6ea9a56abc2fce3bbac45d14b10dc..35aea4fd9549bc1c0942bac2134e9c6e3038880b 100644 (file)
@@ -262,14 +262,14 @@ public class IntesisHomeHandler extends BaseThingHandler {
                     .withType(channelTypeUID).withKind(ChannelKind.STATE).build();
             thingBuilder.withChannel(channel);
             updateThing(thingBuilder.build());
-
-            if (options != null) {
-                final List<StateOption> stateOptions = options.stream()
-                        .map(e -> new StateOption(e, e.substring(0, 1) + e.substring(1).toLowerCase()))
-                        .collect(Collectors.toList());
-                logger.trace("StateOptions : '{}'", stateOptions);
-                intesisStateDescriptionProvider.setStateOptions(channel.getUID(), stateOptions);
-            }
+        }
+        if (options != null) {
+            final List<StateOption> stateOptions = options.stream()
+                    .map(e -> new StateOption(e, e.substring(0, 1) + e.substring(1).toLowerCase()))
+                    .collect(Collectors.toList());
+            logger.trace("StateOptions : '{}'", stateOptions);
+            intesisStateDescriptionProvider.setStateOptions(new ChannelUID(getThing().getUID(), channelId),
+                    stateOptions);
         }
     }