Skip to content

Commit

Permalink
[ipcamera] Fix hikvision camera going offline when requesting I/O status
Browse files Browse the repository at this point in the history
It might happen that a IP camera (Hikvision) replies with HTTP 401 but
does not add a WWW-Authenticate header for our reconnect logic while we
request the status of it's I/O ports.

This fix offers an advanced config option to deactivate requesting the
I/O ports.

Fixes #15413

Signed-off-by: Stefan Triller <github@stefantriller.de>
  • Loading branch information
t2000 committed Dec 9, 2023
1 parent 2de14d2 commit 13ffd5c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class CameraConfig {
public boolean useToken = true;
private int onvifMediaProfile;
private int pollTime;
private boolean hasExternalAlarmInputs = false;
private String ffmpegInput = "";
private String snapshotUrl = "";
private String mjpegUrl = "";
Expand Down Expand Up @@ -138,6 +139,10 @@ public int getPollTime() {
return pollTime;
}

public boolean getHasExternalAlarmInputs() {
return hasExternalAlarmInputs;
}

public int getOnvifPort() {
return onvifPort;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,7 @@ public void initialize() {
if (snapshotUri.isEmpty()) {
snapshotUri = "/ISAPI/Streaming/channels/" + cameraConfig.getNvrChannel() + "01/picture";
}
if (lowPriorityRequests.isEmpty()) {
if (cameraConfig.getHasExternalAlarmInputs() && lowPriorityRequests.isEmpty()) {
lowPriorityRequests.add("/ISAPI/System/IO/inputs/" + cameraConfig.getNvrChannel() + "/status");
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1986,6 +1986,14 @@
<advanced>true</advanced>
</parameter>

<parameter name="hasExternalAlarmInputs" type="boolean" groupName="Settings">
<label>Has External Alarm Inputs</label>
<description>Select if your camera supports external alarm inputs (i.e. for externally connected PIR sensors, etc.).
</description>
<default>false</default>
<advanced>true</advanced>
</parameter>

</config-description>
</thing-type>

Expand Down

0 comments on commit 13ffd5c

Please sign in to comment.