]> git.basschouten.com Git - openhab-addons.git/commitdiff
[zoneminder] Only update state options if they've changed (#11463)
authorMark Hilbush <mark@hilbush.com>
Sun, 31 Oct 2021 10:12:22 +0000 (06:12 -0400)
committerGitHub <noreply@github.com>
Sun, 31 Oct 2021 10:12:22 +0000 (11:12 +0100)
* Only update state options if they've changed

Signed-off-by: Mark Hilbush <mark@hilbush.com>
* Fix update of state options

Signed-off-by: Mark Hilbush <mark@hilbush.com>
bundles/org.openhab.binding.zoneminder/src/main/java/org/openhab/binding/zoneminder/internal/handler/ZmBridgeHandler.java

index 4fd9a2362e9e52baf7047bdb469939bb67f0535f..5e31c7df003ac4cddd7ad811875dc48dc16122d8 100644 (file)
@@ -318,11 +318,12 @@ public class ZmBridgeHandler extends BaseBridgeHandler {
                         monitorList.add(monitor);
                         options.add(new StateOption(monitorDTO.id, "Monitor " + monitorDTO.id));
                     }
-                    stateDescriptionProvider
-                            .setStateOptions(new ChannelUID(getThing().getUID(), CHANNEL_IMAGE_MONITOR_ID), options);
-                    stateDescriptionProvider
-                            .setStateOptions(new ChannelUID(getThing().getUID(), CHANNEL_VIDEO_MONITOR_ID), options);
                 }
+                // Update state options
+                stateDescriptionProvider.setStateOptions(new ChannelUID(getThing().getUID(), CHANNEL_IMAGE_MONITOR_ID),
+                        options);
+                stateDescriptionProvider.setStateOptions(new ChannelUID(getThing().getUID(), CHANNEL_VIDEO_MONITOR_ID),
+                        options);
                 // Only update alarm and event info for monitors whose handlers are initialized
                 Set<String> ids = monitorHandlers.keySet();
                 for (Monitor m : monitorList) {