Is it possible to enable/disable In-camera event detection through external command (http, onvif, etc) ?

sumguy

Getting the hang of it
Joined
Jan 23, 2016
Messages
106
Reaction score
21
I have a Raspberry that I could configure to monitor the status of my old alarm system so it would know when the alarm is enabled or disabled. What I'd really like to do then is have the Pi send a command to my Dahua cameras to enable or disable their in-camera event detection based on whether or not I have enabled the alarm system. Is that possible by talking to the camera (ie sending the right data) to port 80 or some other control port? Maybe OnVif?

Do the various home automation programs know how to do this?

What would be really useful is if the camera generated a string associated with event enable and disable and then showed you the string (ie a URL sent to the camera) during web configuration. You cut and past that string to what-ever device is going to send the commands to the camera. No log-in required (if the string is sufficiently long and randomized).
 

chaosengine

Getting the hang of it
Joined
Dec 11, 2017
Messages
131
Reaction score
71
Location
Germany
HTTP API could be the way. This seems to be the latest version: Amcrest HTTP API SDK

E.g.
Code:
curl --digest "http://admin:yourpassword@x.x.x.x/cgi-bin/configManager.cgi?action=getConfig&name=VideoAnalyseRule[0]" | grep Enable=true
table.VideoAnalyseRule[0][0].EventHandler.SnapshotEnable=true
table.VideoAnalyseRule[0][0].EventHandler.SnapshotTitleEnable=true
table.VideoAnalyseRule[0][1].Config.FeatureEnable=true
table.VideoAnalyseRule[0][1].EventHandler.SnapshotEnable=true
table.VideoAnalyseRule[0][1].EventHandler.SnapshotTitleEnable=true
table.VideoAnalyseRule[0][2].Config.FeatureEnable=true
...

Disable rule 5:
Code:
curl --digest "http://admin:yourpassword@x.x.x.x/cgi-bin/configManager.cgi?action=setConfig&VideoAnalyseRule[0][5].Enable=false"
 

sumguy

Getting the hang of it
Joined
Jan 23, 2016
Messages
106
Reaction score
21
I used wget (just trying this from a windoze pc) and I got this response:

Connecting to 192.168.2.163:80... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Connecting to 192.168.2.163:80... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Authorization failed.

But the http request does work in a browser. I get a big table listing.

I see some similar stuff here:

This command gets me a table list: cgi-bin/configManager.cgi?action=getConfig&name=VideoAnalyseRule[0]

But anything other than zero in the last [ ] bracket (ie like 1 or 2) gives me

Error: Error -1 getting param in name=VideoAnalyseRule[2]

The first few lines of the table output when I use [0] is this:

table.VideoAnalyseRule[0][0].Class=FaceDetection
table.VideoAnalyseRule[0][0].Config.FeatureFilter=false
table.VideoAnalyseRule[0][0].Config.FilterUnAliveEnable=false
table.VideoAnalyseRule[0][0].Config.HumanFaceTypes[0]=Normal
table.VideoAnalyseRule[0][0].Config.MinDuration=10
table.VideoAnalyseRule[0][0].Config.MinQuality=70

This is strange - I don't think my camera has face detection (I don't see it in the web gui).
 
Last edited:

chaosengine

Getting the hang of it
Joined
Dec 11, 2017
Messages
131
Reaction score
71
Location
Germany
use curl

also keep an eye on format:
table.VideoAnalyseRule[0][0]
table.VideoAnalyseRule[0][1]
table.VideoAnalyseRule[0][2]
...


Not everything from API made it into the WebGUI.

Does someone know what this option does?
table.VideoAnalyseRule[0][11].Config.TrackDuration=5

Some cams have =30 others =5
 
Last edited:

sumguy

Getting the hang of it
Joined
Jan 23, 2016
Messages
106
Reaction score
21
Alright, this seems to work (from a browser anyways)
cgi-bin/configManager.cgi?action=setConfig&MotionDetect[0].Enable=false
cgi-bin/configManager.cgi?action=setConfig&MotionDetect[0].Enable=true

I'm using http - I haven't turned on the https option in the camera. Is there curl for windoze? I suppose there is. For now throwing those urls into a browser is working.

I grabbed the Dahua API from here:
Thankyou Stefanov.
 
Top