mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[ipcamera] Add channel Privacy Mode to Amcrest and Dahua handlers (#9092)
* Add channel Privacy Mode to Amcrest and Dahua handlers Signed-off-by: Thomas <thomas@boerkel.de>
This commit is contained in:
parent
b806ed45d0
commit
8c3a488a30
@ -246,6 +246,7 @@ The channels are kept consistent as much as possible from brand to brand to make
|
||||
| `pan` | Dimmer | Works with ONVIF cameras that can be moved. |
|
||||
| `parkingAlarm` | Switch (read only) | When an API camera detects a car, this will turn ON. |
|
||||
| `pirAlarm` | Switch (read only) | When a camera with PIR ability detects motion, this turns ON. |
|
||||
| `privacyMode` | Switch | Enable or disable the Privacy Mode of newer Amcrest/Dahua cameras. The camera will move the lens way down and stop the stream. |
|
||||
| `recordingGif` | Number (read only) | How many seconds recording to GIF for. 0 when file ready. |
|
||||
| `recordingMp4` | Number (read only) | How many seconds recording to MP4 for. 0 when file ready. |
|
||||
| `rtspUrl` | String | The URL for the cameras auto detected RTSP stream. |
|
||||
|
@ -95,6 +95,13 @@ public class AmcrestHandler extends ChannelDuplexHandler {
|
||||
String value = ipCameraHandler.returnValueFromString(content, "table.AudioDetect[0].MutationThreold=");
|
||||
ipCameraHandler.setChannelState(CHANNEL_THRESHOLD_AUDIO_ALARM, PercentType.valueOf(value));
|
||||
}
|
||||
// Privacy Mode on/off
|
||||
if (content.contains("Code=LensMaskOpen;") || content.contains("table.LeLensMask[0].Enable=true")) {
|
||||
ipCameraHandler.setChannelState(CHANNEL_ENABLE_PRIVACY_MODE, OnOffType.ON);
|
||||
} else if (content.contains("Code=LensMaskClose;")
|
||||
|| content.contains("table.LeLensMask[0].Enable=false")) {
|
||||
ipCameraHandler.setChannelState(CHANNEL_ENABLE_PRIVACY_MODE, OnOffType.OFF);
|
||||
}
|
||||
} finally {
|
||||
ReferenceCountUtil.release(msg);
|
||||
ctx.close();
|
||||
@ -118,6 +125,9 @@ public class AmcrestHandler extends ChannelDuplexHandler {
|
||||
case CHANNEL_ENABLE_MOTION_ALARM:
|
||||
ipCameraHandler.sendHttpGET("/cgi-bin/configManager.cgi?action=getConfig&name=MotionDetect[0]");
|
||||
return;
|
||||
case CHANNEL_ENABLE_PRIVACY_MODE:
|
||||
ipCameraHandler.sendHttpGET("/cgi-bin/configManager.cgi?action=getConfig&name=LeLensMask[0]");
|
||||
return;
|
||||
}
|
||||
return; // Return as we have handled the refresh command above and don't need to
|
||||
// continue further.
|
||||
@ -205,6 +215,15 @@ public class AmcrestHandler extends ChannelDuplexHandler {
|
||||
ipCameraHandler.sendHttpGET("/cgi-bin/configManager.cgi?action=setConfig&AlarmOut[1].Mode=0");
|
||||
}
|
||||
return;
|
||||
case CHANNEL_ENABLE_PRIVACY_MODE:
|
||||
if (OnOffType.OFF.equals(command)) {
|
||||
ipCameraHandler
|
||||
.sendHttpGET("/cgi-bin/configManager.cgi?action=setConfig&LeLensMask[0].Enable=false");
|
||||
} else if (OnOffType.ON.equals(command)) {
|
||||
ipCameraHandler
|
||||
.sendHttpGET("/cgi-bin/configManager.cgi?action=setConfig&LeLensMask[0].Enable=true");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,6 +143,13 @@ public class DahuaHandler extends ChannelDuplexHandler {
|
||||
} else if (content.contains("table.VideoAnalyseRule[0][1].Enable=false")) {
|
||||
ipCameraHandler.setChannelState(CHANNEL_ENABLE_LINE_CROSSING_ALARM, OnOffType.OFF);
|
||||
}
|
||||
// Privacy Mode on/off
|
||||
if (content.contains("Code=LensMaskOpen;") || content.contains("table.LeLensMask[0].Enable=true")) {
|
||||
ipCameraHandler.setChannelState(CHANNEL_ENABLE_PRIVACY_MODE, OnOffType.ON);
|
||||
} else if (content.contains("Code=LensMaskClose;")
|
||||
|| content.contains("table.LeLensMask[0].Enable=false")) {
|
||||
ipCameraHandler.setChannelState(CHANNEL_ENABLE_PRIVACY_MODE, OnOffType.OFF);
|
||||
}
|
||||
} finally {
|
||||
ReferenceCountUtil.release(msg);
|
||||
}
|
||||
@ -164,6 +171,9 @@ public class DahuaHandler extends ChannelDuplexHandler {
|
||||
case CHANNEL_ENABLE_MOTION_ALARM:
|
||||
ipCameraHandler.sendHttpGET("/cgi-bin/configManager.cgi?action=getConfig&name=MotionDetect[0]");
|
||||
return;
|
||||
case CHANNEL_ENABLE_PRIVACY_MODE:
|
||||
ipCameraHandler.sendHttpGET("/cgi-bin/configManager.cgi?action=getConfig&name=LeLensMask[0]");
|
||||
return;
|
||||
}
|
||||
return; // Return as we have handled the refresh command above and don't need to
|
||||
// continue further.
|
||||
@ -251,6 +261,15 @@ public class DahuaHandler extends ChannelDuplexHandler {
|
||||
ipCameraHandler.sendHttpGET("/cgi-bin/configManager.cgi?action=setConfig&AlarmOut[1].Mode=0");
|
||||
}
|
||||
return;
|
||||
case CHANNEL_ENABLE_PRIVACY_MODE:
|
||||
if (OnOffType.OFF.equals(command)) {
|
||||
ipCameraHandler
|
||||
.sendHttpGET("/cgi-bin/configManager.cgi?action=setConfig&LeLensMask[0].Enable=false");
|
||||
} else if (OnOffType.ON.equals(command)) {
|
||||
ipCameraHandler
|
||||
.sendHttpGET("/cgi-bin/configManager.cgi?action=setConfig&LeLensMask[0].Enable=true");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,4 +129,5 @@ public class IpCameraBindingConstants {
|
||||
public static final String CHANNEL_LAST_MOTION_TYPE = "lastMotionType";
|
||||
public static final String CHANNEL_GOTO_PRESET = "gotoPreset";
|
||||
public static final String CHANNEL_START_STREAM = "startStream";
|
||||
public static final String CHANNEL_ENABLE_PRIVACY_MODE = "enablePrivacyMode";
|
||||
}
|
||||
|
@ -642,6 +642,7 @@
|
||||
<channel id="rtspUrl" typeId="rtspUrl"/>
|
||||
<channel id="imageUrl" typeId="imageUrl"/>
|
||||
<channel id="hlsUrl" typeId="hlsUrl"/>
|
||||
<channel id="enablePrivacyMode" typeId="enablePrivacyMode"/>
|
||||
</channels>
|
||||
<config-description>
|
||||
|
||||
@ -934,6 +935,7 @@
|
||||
<channel id="rtspUrl" typeId="rtspUrl"/>
|
||||
<channel id="imageUrl" typeId="imageUrl"/>
|
||||
<channel id="hlsUrl" typeId="hlsUrl"/>
|
||||
<channel id="enablePrivacyMode" typeId="enablePrivacyMode"/>
|
||||
</channels>
|
||||
<config-description>
|
||||
|
||||
@ -2663,6 +2665,12 @@
|
||||
<category>Light</category>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="enablePrivacyMode">
|
||||
<item-type>Switch</item-type>
|
||||
<label>Enable Privacy Mode</label>
|
||||
<description>Turn the Privacy Mode on and off.</description>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="autoLED" advanced="true">
|
||||
<item-type>Switch</item-type>
|
||||
<label>Auto LED</label>
|
||||
|
Loading…
Reference in New Issue
Block a user