Dahua IVS API or other external way to enable/disable IVS rules

just_me

n3wb
Aug 31, 2020
5
0
Earth
Dear all,

For a few days I'm the proud owner of new Dahua cams together with a Dahua NVR. I'm very happy with everything and amazed about the quality, funtionallity and over all experience but I'm missing a important feature and maybe someone else too.

Simply, is there a other programmable way to externally enable / disable IVS rules? For the IVS it's only possible to set rules based on time, but for me at home this isn't really a option. I would like a way to enable and disable rules based on user interaction, just like a alarm.

Now I found the Dahua HTTP API documentation, which is pretty big with lots of options, my version 2.76 (I wasn't able to find the latest anywhere). The document has a AI chapter with the face recognition etc. Also a tiny part about getting IVS rules but noting about how to enable or disable them. I know its possible to enable motion detection by api, so I think this is also possible but documented in a later version. Does anyone know if there is and what for a API URL I need to enable / disable rules?

My plan is making a NodeRED flow that listen to a message from mattermost (chatting app) and enable or disable the rules. Later I would like to extend it by using a button, numpad or as external trigger from my alarm. If I manage to fix it, I will share it here so maybe someone else can use it too.

Thanks in advance.

Kees
 
When Im at home and want to disable email notifications I open SmartPSS, choose 'Device Config", select the NVR and 'Network" and untick the SMTP enable box and Save.

It takes 60 seconds.
 
When Im at home and want to disable email notifications I open SmartPSS, choose 'Device Config", select the NVR and 'Network" and untick the SMTP enable box and Save.

It takes 60 seconds.
I don't leave a PC running, particularly as I don't generally use it through the day's comings and goings. These can be frequent.
 
Looking for the same exact thing! I see how to do it for Motion detect in the API but nothing on IVS. Does it have something to do with the "event handler" configuration?
 
The primary goal I hope to achieve is to automate it, preferably trought the API of the NVR. This is more stable, secure and cuts out any middleware. While keeping all the good features the NVR has to offer, mail and push notifications by the apps (what I hope to use). If its easy and integratable, it will be used by more people.

Besides this, disableling or enabling specific rules gives is lots of options in how we program our logic. Maybe we want to keep some notifications or like to make different IVS rules for day/night, alarm on/off, at home or not, dogs outside (what would be really really cool). Endless posibilities.

Last, I think it should be possible. I think there are people on this forum who has access to the file, can check if its there and hopefully will share this little part or just the URL. So who will make us happy :)
 
Last edited:
I have it, last time i send to Fenderman for the BI integration, you can check which part you can use, i can send to you that part only.

4 1.Preface This document details the API of Dahua video products. Programmers can access and configure Dahua video products follows the API. This document with version 1.10 is available with firmware version 2.0 and above. This document with version 1.20, 1.21, 1.22, 1.23, 1.24,1,25,1,26,1,27,1,28 is available with firmware 2.210 and above.This document with version 1. 29 , 1.30, 1.31, 1.32, 1.33, 1.34, 1.35, 1.36 is available with firmware 2.210 and above.This document with version 1.37,1.38 is available with firmware 2.212, 2.4 and above. This document with version 1.39 is available with firmware 2.42 and above. 2.Catalog Document History......................................................................................................................................................................................................2 1.Preface....................................................................................................................................................................................................................4 2.Catalog....................................................................................................................................................................................................................4 3.HTTP API Transaction............................................................................................................................................................................................11 3.1 Transaction.................................................................................................................................................................................................11 3.2 Format .......................................................................................................................................................................................................12 3.3 Authentication ...........................................................................................................................................................................................12 3.4 Response....................................................................................................................................................................................................13 4.Camera..................................................................................................................................................................................................................13 4.1Stream ........................................................................................................................................................................................................13 4.1.1 GetStream.......................................................................................................................................................................................13 4.1.2 GetMaxExtraStreamCounts.............................................................................................................................................................14 4.1.3 GetSnapshot ...................................................................................................................................................................................14 4.1.4 GetVideo.........................................................................................................................................................................................14 4.1.5 PlayBack..........................................................................................................................................................................................15 4.1.6 LoadFile...........................................................................................................................................................................................15 4.1.7 GetStream By Http ..........................................................................................................................................................................15 4.1.8 Playback By Http .............................................................................................................................................................................15 4.2VideoColor..................................................................................................................................................................................................16 4.2.1 GetVideoColorConfig......................................................................................................................................................................16 4.2.2 SetVideoColorConfig.......................................................................................................................................................................17 4.3VideoInOptions...........................................................................................................................................................................................17 4.3.1 GetVideoInputCaps.........................................................................................................................................................................17 4.3.2 GetVideoInOptionsConfig...............................................................................................................................................................19 4.3.3 SetVideoInOptionsConfig................................................................................................................................................................22 4.4VideoEncode...............................................................................................................................................................................................26 4.4.1 GetVideoConfigCaps.......................................................................................................................................................................26 4.4.2 Resolution .......................................................................................................................................................................................27 4.4.3 GetVideoEncodeConfig...................................................................................................................................................................28 4.4.4 SetVideoEncodeConfig ...................................................................................................................................................................29 5 4.5AudioEncode...............................................................................................................................................................................................30 4.5.1 GetAudioConfigCaps.......................................................................................................................................................................30 4.5.2 GetAudioEncodeConfig...................................................................................................................................................................30 4.5.3 SetAudioEncodeConfig....................................................................................................................................................................31 4.6 SnapEncode ...............................................................................................................................................................................................32 4.6.1 GetSnapConfigCaps.........................................................................................................................................................................32 4.6.2 GetSnapEncodeConfig ....................................................................................................................................................................32 4.6.3 SetSnapEncodeConfig .....................................................................................................................................................................33 4.7ChannelTitle ...............................................................................................................................................................................................34 4.7.1 GetChannelTitleConfig....................................................................................................................................................................34 4.7.2 SetChannelTitleConfig ....................................................................................................................................................................34 4.8VideoStandard............................................................................................................................................................................................34 4.8.1 GetVideoStandardConfig ................................................................................................................................................................34 4.8.2 SetVideoStandardConfig.................................................................................................................................................................34 4.9VideoWidget...............................................................................................................................................................................................35 4.9.1 GetVideoWidgetConfig...................................................................................................................................................................35 4.9.2 SetVideoWidgetConfig ...................................................................................................................................................................36 4.10VideoIn .....................................................................................................................................................................................................38 4.10.1 getCollect......................................................................................................................................................................................38 4.11VideoOut ..................................................................................................................................................................................................38 4.11.1 GetVideoOutConfig.......................................................................................................................................................................38 4.11.2 SetVideoOutConfig .......................................................................................................................................................................38 4.12FlashLight..................................................................................................................................................................................................39 4.12.1 GetFlashLightConfig ......................................................................................................................................................................39 4.12.2 SetFlashLightConfig.......................................................................................................................................................................39 5.NetWork ...............................................................................................................................................................................................................40 5.1NetInterfaces..............................................................................................................................................................................................40 5.1.1 GetInterfaces...................................................................................................................................................................................40 5.2BasicConfig..................................................................................................................................................................................................41 5.2.1 GetBasicConfig................................................................................................................................................................................41 5.2.2 SetBasicConfig.................................................................................................................................................................................41 5.3PPPoE..........................................................................................................................................................................................................42 5.3.1 GetPPPoEConfig ..............................................................................................................................................................................42 5.3.2 SetPPPoEConfig...............................................................................................................................................................................42 5.4DDNS...........................................................................................................................................................................................................42 5.4.1 GetDDNSConfig...............................................................................................................................................................................42 5.4.2 SetDDNSConfig................................................................................................................................................................................43 5.5Email...........................................................................................................................................................................................................44 5.5.1 GetEmailConfig ...............................................................................................................................................................................44 5.5.2 SetEmailConfig................................................................................................................................................................................44 5.6Wlan ...........................................................................................................................................................................................................45 5.6.1 GetWlanConfig................................................................................................................................................................................45 5.6.2 SetWlanConfig ................................................................................................................................................................................45 5.6.3 ScanWlanDevices............................................................................................................................................................................46 5.7UPnP ...........................................................................................................................................................................................................47 6 5.7.1 GetUPnPConfig ...............................................................................................................................................................................47 5.7.2 SetUPnPConfig ................................................................................................................................................................................47 5.7.3 GetUPnPStatus................................................................................................................................................................................47 5.8NTP .............................................................................................................................................................................................................48 5.8.1 GetNTPConfig..................................................................................................................................................................................48 5.8.2 SetNTPConfig ..................................................................................................................................................................................48 5.9RTSP............................................................................................................................................................................................................49 5.9.1 GetRTSPConfig ................................................................................................................................................................................49 5.9.2 SetRTSPConfig.................................................................................................................................................................................49 5.10Telnet........................................................................................................................................................................................................50 5.10.1 GetTelnetConfig ............................................................................................................................................................................50 5.10.2 SetTelnetConfig .............................................................................................................................................................................50 6.Events ...................................................................................................................................................................................................................50 6.1EventHandler..............................................................................................................................................................................................50 6.1.1 GetEventHandler.............................................................................................................................................................................50 6.1.2 SetEventHandler .............................................................................................................................................................................52 6.2Alarm ..........................................................................................................................................................................................................53 6.2.1 GetAlarmConfig ..............................................................................................................................................................................53 6.2.2 SetAlarmConfig ...............................................................................................................................................................................54 6.2.3 GetAlarmOutConfig.........................................................................................................................................................................54 6.2.4 SetAlarmOutConfig .........................................................................................................................................................................54 6.2.5 GetInSlots........................................................................................................................................................................................55 6.2.6 GetOutSlots.....................................................................................................................................................................................55 6.2.7 GetInState .......................................................................................................................................................................................55 6.2.8 GetOutState ....................................................................................................................................................................................55 6.2.9 GetChannelInState..........................................................................................................................................................................55 6.2.10 GetChannelOutState .....................................................................................................................................................................56 6.3MotionDetect .............................................................................................................................................................................................56 6.3.1 GetMotionDetectConfig..................................................................................................................................................................56 6.3.2 SetMotionDetectConfig ..................................................................................................................................................................56 6.4BlindDetect.................................................................................................................................................................................................58 6.4.1 GetBlindDetectConfig .....................................................................................................................................................................58 6.4.2 SetBlindDetectConfig ......................................................................................................................................................................58 6.5LossDetect ..................................................................................................................................................................................................58 6.5.1 GetLossDetectConfig.......................................................................................................................................................................58 6.5.2 SetLossDetectConfig .......................................................................................................................................................................58 6.6LoginFailureAlarm.......................................................................................................................................................................................59 6.6.1 GetLoginFailureAlarmConfig ...........................................................................................................................................................59 6.6.2 SetLoginFailureAlarmConfig............................................................................................................................................................59 6.7 StorageAbnormal.......................................................................................................................................................................................59 6.7.1 GetStorageNotExistConfig...............................................................................................................................................................59 6.7.2 SetStorageNotExistConfig ...............................................................................................................................................................60 6.7.3 Get StorageFailureConfig ................................................................................................................................................................60 6.7.4 Set StorageFailureConfig.................................................................................................................................................................60 6.7.5 GetStorageLowSpaceConfig ............................................................................................................................................................60 7 6.7.6 SetStorageLowSpaceConfig.............................................................................................................................................................60 6.8 NetAbnormal .............................................................................................................................................................................................61 6.8.1 GetNetAbortConfig .........................................................................................................................................................................61 6.8.2 SetNetAbortConfig..........................................................................................................................................................................61 6.8.3 GetIPConflictConfig.........................................................................................................................................................................61 6.8.4 SetIPConflictConfig .........................................................................................................................................................................61 6.9 GetEventIndexes........................................................................................................................................................................................62 6.10 Attach.......................................................................................................................................................................................................62 7.PTZ........................................................................................................................................................................................................................64 7.1PTZConfig....................................................................................................................................................................................................64 7.1.1 GetPTZConfig ..................................................................................................................................................................................64 7.1.2 SetPTZConfig...................................................................................................................................................................................64 7.1.3 GetPtzAutoMovementConfig..........................................................................................................................................................65 7.1.4 SetPtzAutoMovementConfig ..........................................................................................................................................................65 7.2PTZControl ..................................................................................................................................................................................................66 7.2.1 GetProtocolList................................................................................................................................................................................66 7.2.2 GetCurrentProtocolCaps.................................................................................................................................................................66 7.2.3 PTZ control commands ...................................................................................................................................................................67 7.3PTZStatus....................................................................................................................................................................................................70 7.3.1 PTZ GetStatus..................................................................................................................................................................................70 8.RecordSnap...........................................................................................................................................................................................................71 8.1Record.........................................................................................................................................................................................................71 8.1.1 GetRecordConfig.............................................................................................................................................................................71 8.1.2 SetRecordConfig..............................................................................................................................................................................71 8.1.3 GetRecordModeConfig ...................................................................................................................................................................72 8.1.4 SetRecordModeConfig ....................................................................................................................................................................72 8.2Snap............................................................................................................................................................................................................72 8.2.1 GetSnapConfig ................................................................................................................................................................................72 8.2.2 SetSnapConfig.................................................................................................................................................................................73 8.2.3 attachFileProc .................................................................................................................................................................................73 8.3MediaGlobal ...............................................................................................................................................................................................74 8.3.1 GetMediaGlobalConfig....................................................................................................................................................................74 8.3.2 SetMediaGlobalConfig ....................................................................................................................................................................74 8.4Holiday........................................................................................................................................................................................................74 8.4.1 GetHolidayConfig ............................................................................................................................................................................74 8.4.2 SetHolidayConfig.............................................................................................................................................................................75 9.System ..................................................................................................................................................................................................................75 9.1General .......................................................................................................................................................................................................75 9.1.1 GetGeneralConfig............................................................................................................................................................................75 9.1.2 SetGeneralConfig ............................................................................................................................................................................76 9.2SystemTime ................................................................................................................................................................................................76 9.2.1 GetCurrentTime..............................................................................................................................................................................76 9.2.2 SetCurrentTime...............................................................................................................................................................................76 9.3Locales........................................................................................................................................................................................................76 9.3.1 GetLocalesConfig ............................................................................................................................................................................76 8 9.3.2 SetLocalesConfig .............................................................................................................................................................................77 9.4Language.....................................................................................................................................................................................................78 9.4.1 GetLanguageCaps ...........................................................................................................................................................................78 9.4.2 GetLanguageConfig.........................................................................................................................................................................78 9.4.3 SetLanguageConfig..........................................................................................................................................................................79 9.5AccessFilter.................................................................................................................................................................................................79 9.5.1 GetAccessFilterConfig .....................................................................................................................................................................79 9.5.2 SetAccessFilterConfig......................................................................................................................................................................79 9.6AutoMaintain..............................................................................................................................................................................................80 9.6.1 GetAutoMaintainConfig ..................................................................................................................................................................80 9.6.2 SetAutoMaintainConfig...................................................................................................................................................................80 9.7UserManager..............................................................................................................................................................................................81 9.7.1 Group..............................................................................................................................................................................................81 9.7.2 GetGroupInfo ..................................................................................................................................................................................81 9.7.3 GetGroupInfoAll..............................................................................................................................................................................81 9.7.4 AddUser ..........................................................................................................................................................................................81 9.7.5 DeleteUser ......................................................................................................................................................................................82 9.7.6 ModifyUser .....................................................................................................................................................................................82 9.7.7 ModifyPassword .............................................................................................................................................................................82 9.7.8 GetUserInfo.....................................................................................................................................................................................83 9.7.9 GetUserInfoAll.................................................................................................................................................................................83 9.7.10 GetActiveUserInfoAll.....................................................................................................................................................................83 9.8System Operation .......................................................................................................................................................................................84 9.8.1 Reboot ............................................................................................................................................................................................84 9.8.2 Shutdown........................................................................................................................................................................................84 9.8.3 GetDeviceType................................................................................................................................................................................84 9.8.4 GetHardwareVersion.......................................................................................................................................................................84 9.8.5 GetSerialNo.....................................................................................................................................................................................84 9.8.6 GetMachineName...........................................................................................................................................................................84 9.8.7 GetSystemInfo.................................................................................................................................................................................85 9.8.8 GetVendor.......................................................................................................................................................................................85 9.8.9 GetSoftwareVersion ........................................................................................................................................................................85 9.8.10 GetOnvifVersion............................................................................................................................................................................85 9.8.11 getUUID ........................................................................................................................................................................................85 9.9 Log .............................................................................................................................................................................................................86 9.9.1 StartFind .........................................................................................................................................................................................86 9.9.2 DoFind.............................................................................................................................................................................................86 9.9.3 StopFind..........................................................................................................................................................................................87 9.9.4 Clear................................................................................................................................................................................................87 9.10 UserGlobal ...............................................................................................................................................................................................87 9.10.1 GetUserGlobalConfig ....................................................................................................................................................................87 9.10.2 SetUserGlobalConfig .....................................................................................................................................................................87 9.11 IntervideoManager..................................................................................................................................................................................87 9.11.1 GetCGIVersion...............................................................................................................................................................................87 9.12 ConfigRestore...........................................................................................................................................................................................88 9 9.12.1 Restore..........................................................................................................................................................................................88 9.12.1 RestoreExcept ...............................................................................................................................................................................88 10.Storage................................................................................................................................................................................................................88 10.1 File Finding ..............................................................................................................................................................................................88 10.1.1 Create............................................................................................................................................................................................88 10.1.2 StartFind .......................................................................................................................................................................................88 10.1.3 FindNextFile..................................................................................................................................................................................89 10.1.4 Close .............................................................................................................................................................................................90 10.1.5 Destroy..........................................................................................................................................................................................90 10.2 Storage Device .........................................................................................................................................................................................90 10.2.1 GetStorageDeviceCollect ..............................................................................................................................................................90 10.2.2 getDeviceAllInfo............................................................................................................................................................................90 10.2.3 setStorageDevice ..........................................................................................................................................................................91 10.2.4 getCaps .........................................................................................................................................................................................91 10.3 Work Group .............................................................................................................................................................................................91 10.3.1 GetWorkGroupCollect...................................................................................................................................................................91 10.4 Work Directory.........................................................................................................................................................................................92 10.4.1 GetWorkDirectoryCollect..............................................................................................................................................................92 10.5 NAS ..........................................................................................................................................................................................................92 10.5.1 GetNASConfig ...............................................................................................................................................................................92 10.5.2 SetNASConfig ................................................................................................................................................................................92 10.6 Storage Point............................................................................................................................................................................................93 10.6.1 GetRecordStoragePointConfig ......................................................................................................................................................93 10.6.2 SetRecordStoragePointConfig .......................................................................................................................................................93 10.6.3 GetStorageGroupConfig................................................................................................................................................................94 10.6.4 SetStorageGroupConfig.................................................................................................................................................................94 11.Audio ..................................................................................................................................................................................................................94 11.1 Audio MIME type.....................................................................................................................................................................................94 11.2 Post Audio................................................................................................................................................................................................95 11.2.1 Example for singlepart ..................................................................................................................................................................95 11.2.2 Example for multipart ...................................................................................................................................................................95 11.3 Get Audio.................................................................................................................................................................................................96 11.3.1 Example for singlepart ..................................................................................................................................................................96 11.3.2 Example for multipart ...................................................................................................................................................................96 11.4 Audio Input..............................................................................................................................................................................................97 11.4.1 getCollect......................................................................................................................................................................................97 11.5 Audio Output ...........................................................................................................................................................................................97 11.5.1 getCollect......................................................................................................................................................................................97 12.Appendix.............................................................................................................................................................................................................97 12.1 Stream Format.........................................................................................................................................................................................97 13.VedioInput ........................................................................................................................................................................................................100 13.1 AdjustFocus............................................................................................................................................................................................100 13.2 AdjustFocusContinuously.......................................................................................................................................................................100 13.3 AutoFocus..............................................................................................................................................................................................100 13.4 GetFocusStatus......................................................................................................................................................................................100
 
  • Like
Reactions: bigredfish
Will ask dahua if can send me the latest new one tomorrow.
 
Thanks Andy, V2.76 of the API is already available on this site. Thanks for trying to get us the latest version. Could you also please confirm the API call to do the following as I don't see it in the v2.76 documentation so it might be missing from the latest one also. I want to enable and disable the alarm on IVS rule #1 on camera channel 1.
I'm guessing it looks something like an http GET call like:
cgi-bin/configManager.cgi?action=setConfig&Alarm[0].AlarmOutEnable=true
but I'm not sure how to specify that it is the intrusion IVS rule #1.

Thanks
 
So I've got my system with Dahua NVR and multiple Dahua POE cameras working pretty well but I still am trying to be able to enable and disable having an IVS rule trigger an alarm or an email via the http API. I've searched a number of the latest Dahua http API documents and still can't find an http command that deals with IVS rules specifically. I can enable and disable non IVS Motion detect no problem just not IVS rules. Has anyone else learned how to do this? Andy hasn't been able to get me an answer from Dahua.

I'm guessing it looks something like an http GET call like:
http://192.168.1.108/cgi-bin/configManager.cgi?action=setConfig&Alarm[0].AlarmOutEnable=true but that doesn't work.

It might also be related to the event manager API which I don't understand. Does anyone have any examples that have worked for them?
 
I need to be able to disable / enable specific IVS rules and SMD for my automation system via API. I haven't had any luck locating enough API information to do this outside of this here:

@EMPIRETECANDY do you have the API info for this?
I will check for you tomorrow morning.
 
Thanks @EMPIRETECANDY

In the mean time, for anyone interested, I was able to to at least go through the code and figure out how to enable and disable Dahua IVS rules via a simple http get.

How to enable or disable Dahua IVS rules for automation with HomeSeer, etc.

Notes for the instructions below
Replace X.X.X.X with your camera's IP or hostname
Replace username and password with your username and password for the camera

Code:
First, to list all the rules in the camera, do this:
http://username:password@X.X.X.X/cgi-bin/configManager.cgi?action=getConfig&name=VideoAnalyseRule
(You'll get the hang of how to set any parameter in the configuration from the this.)

Then, you need to find the index number of the rule you want to automate. Note that this will change if you update rules. To do this, search by your rule name, or just search by the keyword ".name" .

Once you find the index number, to enable or disable the rule, it's simply a matter of setting Enable to true or false
Example to enable rule with index 4:
http://username:password@X.X.X.X/cgi-bin/configManager.cgi?action=setConfig&VideoAnalyseRule[0][4].Enable=true
Example to disable rule with index 3:
http://username:password@X.X.X.X/cgi-bin/configManager.cgi?action=setConfig&VideoAnalyseRule[0][4].Enable=false

Example to enable logging for IVS rule (seems to only be available to set via API, and logging for IVS rules is disabled by default for some reason
http://username:password@X.X.X.X/cgi-bin/configManager.cgi?action=setConfig&VideoAnalyseRule[0][4].EventHandler.LogEnable=true
 
Last edited:
  • Like
Reactions: stamp22
Here's some more helpful example commands. I'm still wanting to find a way just to disable push notifications for a single IVS rule since I want to get notified for some, but not others.


API Examples for Managing Dahua Motion Detection for Automation
Code:
Get Motion Detection Configuration
http://username:password@X.X.X.X/cgi-bin/configManager.cgi?action=getConfig&name=MotionDetect

Disable motion detection
http://username:password@X.X.X.X/cgi-bin/configManager.cgi?action=setConfig&MotionDetect[0].Enable=false
Enable motion detection
http://username:password@X.X.X.X/cgi-bin/configManager.cgi?action=setConfig&MotionDetect[0].Enable=true


Disable email on motion detection
http://username:password@X.X.X.X/cgi-bin/configManager.cgi?action=setConfig&MotionDetect[0].EventHandler.MailEnable=false

Enable email on motion detection
http://username:password@X.X.X.X/cgi-bin/configManager.cgi?action=setConfig&MotionDetect[0].EventHandler.MailEnable=true
 
Last edited: