]> git.basschouten.com Git - openhab-addons.git/commitdiff
[ipcamera] Fix multiple WARNs when HIK camera does not support alarm inputs (#13606)
authorMatthew Skinner <matt@pcmus.com>
Thu, 27 Oct 2022 06:28:27 +0000 (17:28 +1100)
committerGitHub <noreply@github.com>
Thu, 27 Oct 2022 06:28:27 +0000 (08:28 +0200)
* Fix never ending WARN when HIK camera does not support alarm inputs.
* Streamline code.

Signed-off-by: Matthew Skinner <matt@pcmus.com>
bundles/org.openhab.binding.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/HikvisionHandler.java
bundles/org.openhab.binding.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/handler/IpCameraHandler.java

index 0e6dda744d03fcdd3f6f7a671c0ca570fb5d06ff..824b480d042502cbcc6c1824d1d18065799e0f96 100644 (file)
@@ -15,7 +15,6 @@ package org.openhab.binding.ipcamera.internal;
 import static org.openhab.binding.ipcamera.internal.IpCameraBindingConstants.*;
 
 import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
@@ -423,12 +422,4 @@ public class HikvisionHandler extends ChannelDuplexHandler {
                 return;
         }
     }
-
-    // If a camera does not need to poll a request as often as snapshots, it can be
-    // added here. Binding steps through the list.
-    public ArrayList<String> getLowPriorityRequests() {
-        ArrayList<String> lowPriorityRequests = new ArrayList<String>(1);
-        lowPriorityRequests.add("/ISAPI/System/IO/inputs/" + nvrChannel + "/status"); // must stay in element 0.
-        return lowPriorityRequests;
-    }
 }
index 1e15c338035a8d1c484d44a7c61f85b1fb98bd73..12b3daf2dc1e59dfb23ae5177c7d861a7a1a28ab 100644 (file)
@@ -1270,9 +1270,6 @@ public class IpCameraHandler extends BaseThingHandler {
             case HIKVISION_THING:
                 HikvisionHandler hikvisionHandler = new HikvisionHandler(getHandle(), cameraConfig.getNvrChannel());
                 hikvisionHandler.handleCommand(channelUID, command);
-                if (lowPriorityRequests.isEmpty()) {
-                    lowPriorityRequests = hikvisionHandler.getLowPriorityRequests();
-                }
                 break;
             case FOSCAM_THING:
                 FoscamHandler foscamHandler = new FoscamHandler(getHandle(), cameraConfig.getUser(),
@@ -1631,6 +1628,9 @@ public class IpCameraHandler extends BaseThingHandler {
                 if (snapshotUri.isEmpty()) {
                     snapshotUri = "/ISAPI/Streaming/channels/" + cameraConfig.getNvrChannel() + "01/picture";
                 }
+                if (lowPriorityRequests.isEmpty()) {
+                    lowPriorityRequests.add("/ISAPI/System/IO/inputs/" + cameraConfig.getNvrChannel() + "/status");
+                }
                 break;
             case INSTAR_THING:
                 if (snapshotUri.isEmpty()) {