Disable/enable "Disarming" by API?

The North Face

Getting the hang of it
Joined
Jul 28, 2019
Messages
108
Reaction score
56
Location
North of the wall
Has anyone managed to control "Disarming" as available in newer Dahua firmware by the API?

1607171716000.png
 

MyDaHua

Getting the hang of it
Joined
Jul 10, 2020
Messages
91
Reaction score
37
Location
Poland
Dahua like to classify his new API as TopSecret and did not leaked here yet.
 

The North Face

Getting the hang of it
Joined
Jul 28, 2019
Messages
108
Reaction score
56
Location
North of the wall
Yeah, I know. Bummer.

I did a workaround and made a Python script where you can specify the names of IVS rules you want the script to enable/disable. I use the script with the Domoticz home automation platform, so I can turn an arbitrary number of IVS rules on or off with the click of a button within Domoticz.

Can share if anyone’s interested. No rocket science but requires basic Linux/Python/Domoticz knowledge to set up. The Python script can be used standalone on any platform to enable/disable the rules though, Domoticz just acts as the triggering interface.

Edit: I tried to snoop the HTTP traffic to figure out how the camera sends commands from the web interface, but the JavaScript mess that Dahua implements just wasn’t worth the time.
 
Last edited:

The North Face

Getting the hang of it
Joined
Jul 28, 2019
Messages
108
Reaction score
56
Location
North of the wall
I had another request about the script, so I’ll upload it to GitHub in the next few days.

Were you interested in the Domoticz setup too?
 

genelit

Getting comfortable
Joined
Jan 4, 2018
Messages
264
Reaction score
395
Location
Sweden
Just one thought , I'm guessing so please be gentle to me :)
Isn't this arm/disarm feature only for the active deterrence cams, to enable/disable the alarm and to enable/disable IVS in general?

 

genelit

Getting comfortable
Joined
Jan 4, 2018
Messages
264
Reaction score
395
Location
Sweden
Hi again,

just to share how I "switch" on/off IVS using Home Assistant (redneck version).
This is done on my PTZ so I actually don't turn the IVS rules of but simply changing preset (controlled by HA)
So, first create 2 presets, in the example below preset 1 is with IVS rules and preset 6 is without.

shell_command:
ptz1: 'curl --digest -u "username:code" -g " 1&arg3=0"'

ptz6: 'curl --digest -u "username:code" -g " 6&arg3=0"'

Calling these shell commands changes preset on the PTZ, in my case I also have some PIR sensors around the house that tells HA about movement and send the PTZ there. And calls back PTZ to default position after a while.
When HA detects my presence - phone connects to wifi, camera goes to position 6. After bedtime the PTZ returns to position 1 - IVS activated.
So, this is similar to the PTZ Linkage function in the NVR - but can be controlled by other devices/sensors as well.
 

genelit

Getting comfortable
Joined
Jan 4, 2018
Messages
264
Reaction score
395
Location
Sweden
Yes, please share here or on github.
I'm pretty sure there will be more people asking for this as the active deterrence models seem very popular.
If you don't mind I'll share it in some Swedish Home automation face book groups.

Good job!
 

The North Face

Getting the hang of it
Joined
Jul 28, 2019
Messages
108
Reaction score
56
Location
North of the wall
Yes, please share here or on github.
I'm pretty sure there will be more people asking for this as the active deterrence models seem very popular.
If you don't mind I'll share it in some Swedish Home automation face book groups.

Good job!
Thank you. Here you go: AblazeWoland/dahua-toggle-ivs

Would you mind providing the link to Facebook, if you post there? I'd love to see where this ends up. Please encourage people to pull and improve. The scripts are very basic and should be merged into one, I'll do that as soon as I care to learn how to properly parse command line options in Python :cool:
 

genelit

Getting comfortable
Joined
Jan 4, 2018
Messages
264
Reaction score
395
Location
Sweden
Great!
I will test it myself and see if it's applicable to my setup, even thought don't have any active deterrence models.
 

wasabi

Getting the hang of it
Joined
Apr 26, 2016
Messages
113
Reaction score
23
Location
Sydney
Hi sorry to hi-jack this post.

Seems like the latest update V4.001.0000003.2 build 10-10-20 has created a red bell icon on the top right hand side, any idea how to remove it ?

thanks
 

runraid

Getting the hang of it
Joined
May 22, 2020
Messages
155
Reaction score
83
Location
Seattle
Anyone interested in doing this via home assistant? If so I can add it in to my custom integration.
 

runraid

Getting the hang of it
Joined
May 22, 2020
Messages
155
Reaction score
83
Location
Seattle
Yup! hand up

I just released a new version of rroller/dahua that supports the "Disarming Linkage" as a binary switch.
You can install that into Home Assistant manually or with HACS. It looks like this...

1623622111289.png

If you aren't running Home Assistant and which to use a script... here's how you'll do it (remember this needs to use Digest Authentication)
Code:
# Get the current value
http://IP_ADDRESS/cgi-bin/configManager.cgi?action=getConfig&name=DisableLinkage

# Disable
http://IP_ADDRESS/cgi-bin/configManager.cgi?action=setConfig&DisableLinkage[0].Enable=false

# Enable
http://IP_ADDRESS/cgi-bin/configManager.cgi?action=setConfig&DisableLinkage[0].Enable=true
 

wittaj

IPCT Contributor
Joined
Apr 28, 2019
Messages
23,858
Reaction score
46,167
Location
USA
@runraid - thanks!

This will be a nice thing to add to BI in BI alerts so that I can just change a profile to turn these off and on!

It is a pain to go into the camera gui to turn off or on when I have someone over or someone working in the yard LOL.
 

runraid

Getting the hang of it
Joined
May 22, 2020
Messages
155
Reaction score
83
Location
Seattle
@wittaj do you use Home Assistant? I'm curious how your use of BI compares to my Home Assistant setup? Dahua cameras + Home Assistant + Deepstack seems to be the sweet spot for me. It gives me the ability to totally integrate any and everything. As an example, at night, if a human is detected by my cams, all my outside lights turn on for 5 minutes. I only record on motion to my NAS so in general, I don't have a central server processing all the video feed 24/7.
 
Top