[ipcamera] Fix multiple WARNs when HIK camera does not support alarm inputs (#13606)

* Fix never ending WARN when HIK camera does not support alarm inputs.
* Streamline code.

Signed-off-by: Matthew Skinner <matt@pcmus.com>
This commit is contained in:
Matthew Skinner 2022-10-27 17:28:27 +11:00 committed by GitHub
parent a68ff57c17
commit 234d354a2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 12 deletions

View 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;
}
}

View 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()) {