Dahua intercom - API for VTH1550CH?

Antori91

n3wb
Joined
Jan 29, 2020
Messages
28
Reaction score
3
Location
France
Hello,

I would like to get/set remotely Alarm config/Alarm state from the VTH1550CH. We can access the VTO2000A using the Dahua HTTP API. But these API don't seem implemented at the VTH side.

Is there anyone who knows how to do that?

Thanks in advance.
 

Antori91

n3wb
Joined
Jan 29, 2020
Messages
28
Reaction score
3
Location
France
Hello Riogrande75,
Your script is for capturing the VTO events. What I would like to do is capturing the VTH events...
 

Antori91

n3wb
Joined
Jan 29, 2020
Messages
28
Reaction score
3
Location
France
Sorry, I've answered to fast!

You said that your script works for VTH also. Could you explain how because as far as I understand your script, it uses the Dahua HTTP API. And none of these API seems to be implemented in the VTH I have.

PS: A nmap against my VTH shows that only ports 5000, 8686 and 37777 are opened
 

riogrande75

Pulling my weight
Joined
Oct 19, 2017
Messages
390
Reaction score
140
Location
AUSTRIA
If you have a look at the script, it uses port 5000 which is open on almost all VTO/VTH devices.
Off course your wish is not yet fully implemented, but this script gives you at least a starting point.
All you have to figure out is the "method" to subscribe (method.attach) you need for alarms.
With a "service all" you get a list of all "methods" (functions) of the device. The rest is "try and error" until you get what you want. Off course, you have to understand the script at least a bit.;)
 

Antori91

n3wb
Joined
Jan 29, 2020
Messages
28
Reaction score
3
Location
France
To get the events, I understand your script uses the following API: http://VTO_IP:5000/cgi-bin/eventManager.cgi?action=attach&codes=[All]

Is this correct? If yes, this url works only at port 80 for my VTO (and not at port 5000) and for the VTH, this url doesn't work at all

Where I'm wrong?

[EDIT Where I'm wrong? Maybe my next post is the answer?]
 
Last edited:

Antori91

n3wb
Joined
Jan 29, 2020
Messages
28
Reaction score
3
Location
France
Off course, you have to understand the script at least a bit.;)
I'm not a php expert at all ! Reading your script again and again, I start to think your script doesn't send http commands at port 5000. Is this correct? If yes, I've found on the web only documentation related to the Dahua Http API. Where can I find a documentation about the commands you use at port 5000?
 

riogrande75

Pulling my weight
Joined
Oct 19, 2017
Messages
390
Reaction score
140
Location
AUSTRIA
No, this has nothing to do with http api. It is based on dahua internal protocol DHIP, unfortunately undocumented. If you don't know either php nor python, I'm afraid you have to find another way.
 

Antori91

n3wb
Joined
Jan 29, 2020
Messages
28
Reaction score
3
Location
France
Thanks Riogrande75 for your support. I've now a clear picture. I will try to run your script against my VTH.

PS: Python or C/C++ or nodejs or Java or Rexx or ... are ok for me. I think I will be able to decode your php script. :)
My github about home automation is here: Antori91/Home_Automation
 

Antori91

n3wb
Joined
Jan 29, 2020
Messages
28
Reaction score
3
Location
France
It seems I'm on the right way. Below are the VTH services/methods I get from a system.listService command at port 5000:

What I would like to do is:
  • get an event from the VTH if someone arms the VTH Alarm (seems now easy to reach this goal with "eventManager.attach" method)
  • be able to arm/disarm the VTH alarm using a remote command. ** Which method do I have to use to do this? **

[+] Login: Login Successed
[+] Started keepAlive thread
[+] Connected to the VTH
[*] Remote Services (70):
[*] Remote Services (70):
system
{
"params": {
"method": [
"system.listService",
"system.multicall",
"system.listMethod",
"system.methodSignature",
"system.methodHelp",
"system.getAPIVersion",
"system.multiSec"
]
}
}
AccessPoint
{
"params": {
"method": [
"AccessPoint.listMethod",
"AccessPoint.getAPLinksInfo"
]
}
}
AgingTest
{
"params": {
"method": [
"AgingTest.attachAgingInfo",
"AgingTest.detachAgingInfo",
"AgingTest.SetTestConfig",
"AgingTest.setSavingResult",
"AgingTest.startTest",
"AgingTest.stopTest",
"AgingTest.listMethod",
"AgingTest.setLampState",
"AgingTest.sendStandardDevInfo",
"AgingTest.getSystemInfo"
]
}
}
AirCondition
{
"params": {
"method": [
"AirCondition.factory.instance",
"AirCondition.destroy",
"AirCondition.open",
"AirCondition.close",
"AirCondition.setTemperature",
"AirCondition.adjustTemperature",
"AirCondition.setMode",
"AirCondition.setWindMode",
"AirCondition.listMethod",
"AirCondition.getState"
]
}
}
AroudWifi
{
"params": {
"method": [
"AroudWifi.getCaps",
"AroudWifi.listMethod"
]
}
}
BackgroundMusic
{
"params": {
"method": [
"BackgroundMusic.factory.instance",
"BackgroundMusic.destroy",
"BackgroundMusic.open",
"BackgroundMusic.close",
"BackgroundMusic.setVolume",
"BackgroundMusic.adjustVolume",
"BackgroundMusic.getVolume",
"BackgroundMusic.setAudioSource",
"BackgroundMusic.getAudioSource",
"BackgroundMusic.listMethod",
"BackgroundMusic.getState"
]
}
}
BridgeManager
{
"params": {
"method": [
"BridgeManager.listMethod",
"BridgeManager.getBridgeStatus"
]
}
}
CertManager
{
"params": {
"method": [
"CertManager.importSvrCert",
"CertManager.exportRootCert",
"CertManager.listMethod",
"CertManager.removeSvrCert",
"CertManager.getSvrCertInfo"
]
}
}
Curtain
{
"params": {
"method": [
"Curtain.factory.instance",
"Curtain.destroy",
"Curtain.open",
"Curtain.close",
"Curtain.listMethod",
"Curtain.adjustShading",
"Curtain.stop",
"Curtain.getState"
]
}
}
DataOutputVkManager
{
"params": {
"method": [
"DataOutputVkManager.findPasswd",
"DataOutputVkManager.listMethod"
]
}
}
DebugSvrCtrl
{
"params": {
"method": [
"DebugSvrCtrl.openDebugSvr",
"DebugSvrCtrl.closeDebugSvr",
"DebugSvrCtrl.listMethod"
]
}
}
DigitalCertificate
{
"params": {
"method": [
"DigitalCertificate.getCertReqInfo",
"DigitalCertificate.importCert",
"DigitalCertificate.importCRL",
"DigitalCertificate.listMethod",
"DigitalCertificate.getCertsInfo",
"DigitalCertificate.exportCert",
"DigitalCertificate.deleteCert"
]
}
}
DockUser
{
"params": {
"method": [
"DockUser.addUser",
"DockUser.deleteUser",
"DockUser.modifyUser",
"DockUser.modifyPassword",
"DockUser.getUserInfoAll",
"DockUser.listMethod"
]
}
}
EventRestore
{
"params": {
"method": [
"EventRestore.attach",
"EventRestore.detach",
"EventRestore.ackEvent",
"EventRestore.listMethod"
]
}
}
FactoryTool
{
"params": {
"method": [
"FactoryTool.setInitParam",
"FactoryTool.getInitParam",
"FactoryTool.setBootParams",
"FactoryTool.getAllMacs",
"FactoryTool.listMethod"
]
}
}
FileCompress
{
"params": {
"method": [
"FileCompress.listMethod",
"FileCompress.decompress",
"FileCompress.compress"
]
}
}
FileFindHelper
{
"params": {
"method": [
"FileFindHelper.startFind",
"FileFindHelper.findNext",
"FileFindHelper.stopFind",
"FileFindHelper.getBoundFile",
"FileFindHelper.startMotionFind",
"FileFindHelper.listMethod"
]
}
}
FreshAir
{
"params": {
"method": [
"FreshAir.factory.instance",
"FreshAir.destroy",
"FreshAir.open",
"FreshAir.close",
"FreshAir.setMode",
"FreshAir.listMethod",
"FreshAir.getState"
]
}
}
GroundHeat
{
"params": {
"method": [
"GroundHeat.factory.instance",
"GroundHeat.destroy",
"GroundHeat.open",
"GroundHeat.close",
"GroundHeat.setTemperature",
"GroundHeat.adjustTemperature",
"GroundHeat.setMode",
"GroundHeat.listMethod",
"GroundHeat.getState"
]
}
}
HighAvailability
{
"params": {
"method": [
"HighAvailability.factory.instance",
"HighAvailability.destroy",
"HighAvailability.setHAService",
"HighAvailability.getHAService",
"HighAvailability.startService",
"HighAvailability.stopService",
"HighAvailability.listMethod",
"HighAvailability.getServiceState"
]
}
}
IntervideoClient
{
"params": {
"method": [
"IntervideoClient.factory.instance",
"IntervideoClient.destroy",
"IntervideoClient.getVersion",
"IntervideoClient.listMethod"
]
}
}
IntervideoManager
{
"params": {
"method": [
"IntervideoManager.getVersion",
"IntervideoManager.testConnectivity",
"IntervideoManager.listMethod"
]
}
}
License
{
"params": {
"method": [
"License.setLicense",
"License.getAssistedInfo",
"License.listMethod"
]
}
}
Light
{
"params": {
"method": [
"Light.factory.instance",
"Light.destroy",
"Light.open",
"Light.close",
"Light.setBrightLevel",
"Light.adjustBright",
"Light.keepOn",
"Light.blink",
"Light.openCondition",
"Light.closeCondition",
"Light.brightLevelUp",
"Light.brightLevelDown",
"Light.listMethod",
"Light.getState"
]
}
}
LinkLayerVPNClient
{
"params": {
"method": [
"LinkLayerVPNClient.getVPNStatus",
"LinkLayerVPNClient.getVirtualIfInfo",
"LinkLayerVPNClient.listMethod"
]
}
}
MediaTest
{
"params": {
"method": [
"MediaTest.attach",
"MediaTest.detach",
"MediaTest.listMethod"
]
}
}
MonitorTransSender
{
"params": {
"method": [
"MonitorTransSender.start",
"MonitorTransSender.setIFrame",
"MonitorTransSender.stop",
"MonitorTransSender.listMethod"
]
}
}
MultiCertManager
{
"params": {
"method": [
"MultiCertManager.createCertUnit",
"MultiCertManager.createCSR",
"MultiCertManager.exportCertUnit",
"MultiCertManager.importCertUnit",
"MultiCertManager.getServerCertList",
"MultiCertManager.setActiveServerCert",
"MultiCertManager.getActiveServerCert",
"MultiCertManager.getCertInfo",
"MultiCertManager.removeCert",
"MultiCertManager.listMethod"
]
}
}
Nat
{
"params": {
"method": [
"Nat.factory.instance",
"Nat.destroy",
"Nat.start",
"Nat.stop",
"Nat.listMethod",
"Nat.getTurnStatus"
]
}
}
NetworkSnifferManager
{
"params": {
"method": [
"NetworkSnifferManager.factory.instance",
"NetworkSnifferManager.destroy",
"NetworkSnifferManager.start",
"NetworkSnifferManager.stop",
"NetworkSnifferManager.getSnifferInfo",
"NetworkSnifferManager.listMethod"
]
}
}
OSDManager
{
"params": {
"method": [
"OSDManager.getCaps",
"OSDManager.getCustomCaps",
"OSDManager.addPicture",
"OSDManager.modifyPicture",
"OSDManager.deletePicture",
"OSDManager.getPicture",
"OSDManager.bindPicture",
"OSDManager.unbindPicture",
"OSDManager.listMethod"
]
}
}
OrganizationManager
{
"params": {
"method": [
"OrganizationManager.factory.instance",
"OrganizationManager.destroy",
"OrganizationManager.addNodes",
"OrganizationManager.deleteNodes",
"OrganizationManager.getNodes",
"OrganizationManager.setNode",
"OrganizationManager.listMethod"
]
}
}
PTZAutoTest
{
"params": {
"method": [
"PTZAutoTest.getPTZTemperature",
"PTZAutoTest.getCameraState",
"PTZAutoTest.getVerticalState",
"PTZAutoTest.getHorizontalState",
"PTZAutoTest.setCameraPosition",
"PTZAutoTest.getPhotoresistorState",
"PTZAutoTest.setHorizontalState",
"PTZAutoTest.setVerticalState",
"PTZAutoTest.listMethod"
]
}
}
PasswdFind
{
"params": {
"method": [
"PasswdFind.setContact",
"PasswdFind.getContact",
"PasswdFind.getSecretQuestion",
"PasswdFind.checkQuestionAnswer",
"PasswdFind.listMethod"
]
}
}
PppoeCli
{
"params": {
"method": [
"PppoeCli.getPPPoEDialInfo",
"PppoeCli.listMethod"
]
}
}
RPCTest
{
"params": {
"method": [
"RPCTest.factory.instance",
"RPCTest.destroy",
"RPCTest.listMethod",
"RPCTest.TransmitCmd",
"RPCTest.GetConfig",
"RPCTest.CmdFaceBoardLed",
"RPCTest.readKeyValue",
"RPCTest.checkSD",
"RPCTest.writeSDData",
"RPCTest.readSDData",
"RPCTest.setScreenBackground",
"RPCTest.adjustBackgroundLight",
"RPCTest.stopTalk",
"RPCTest.startTalk",
"RPCTest.testMic",
"RPCTest.testReceiver",
"RPCTest.testLoudspeaker",
"RPCTest.setAlarmTrigger",
"RPCTest.getDIandAI",
"RPCTest.addAllHddtoRaid5",
"RPCTest.testCPU",
"RPCTest.getServerInfo",
"RPCTest.getRTCTime",
"RPCTest.getBasicInfo",
"RPCTest.accessAutoTesting",
"RPCTest.getPhotoresistorState",
"RPCTest.isResetKeySeted",
"RPCTest.getCryptoModuleStatus"
]
}
}
RecordFinder
{
"params": {
"method": [
"RecordFinder.factory.create",
"RecordFinder.destroy",
"RecordFinder.startFind",
"RecordFinder.doFind",
"RecordFinder.stopFind",
"RecordFinder.getQuerySize",
"RecordFinder.doSeekFind",
"RecordFinder.listMethod"
]
}
}
RecordUpdater
{
"params": {
"method": [
"RecordUpdater.factory.instance",
"RecordUpdater.destroy",
"RecordUpdater.import",
"RecordUpdater.insert",
"RecordUpdater.insertEx",
"RecordUpdater.get",
"RecordUpdater.getEx",
"RecordUpdater.update",
"RecordUpdater.updateEx",
"RecordUpdater.remove",
"RecordUpdater.removeEx",
"RecordUpdater.clear",
"RecordUpdater.importFile",
"RecordUpdater.exportFile",
"RecordUpdater.attach",
"RecordUpdater.detach",
"RecordUpdater.listMethod",
"RecordUpdater.getFileImportState",
"RecordUpdater.getFileExportState",
"RecordUpdater.getFileImportData",
"RecordUpdater.exportAsyncFile",
"RecordUpdater.getSchema",
"RecordUpdater.importFileEncrypt",
"RecordUpdater.exportFileEncrypt"
]
}
}
SecretQuestion
{
"params": {
"method": [
"SecretQuestion.setSecretQuestion",
"SecretQuestion.clearSecretQuestion",
"SecretQuestion.getAllQuestion",
"SecretQuestion.resetQuestion",
"SecretQuestion.listMethod"
]
}
}
Security
{
"params": {
"method": [
"Security.getEncryptInfo",
"Security.addUser",
"Security.addUserPlain",
"Security.modifyPasswordByType",
"Security.getConfig",
"Security.setConfig",
"Security.getDefault",
"Security.transferUKey",
"Security.modifyPasswordPlain",
"Security.listMethod"
]
}
}
SmartDevManager
{
"params": {
"method": [
"SmartDevManager.factory.instance",
"SmartDevManager.destroy",
"SmartDevManager.attach",
"SmartDevManager.detach",
"SmartDevManager.acceptSmartDevice",
"SmartDevManager.getDeviceList",
"SmartDevManager.renameDevice",
"SmartDevManager.removeDevice",
"SmartDevManager.sendCmd",
"SmartDevManager.setTimer",
"SmartDevManager.listMethod",
"SmartDevManager.setScheduleItem",
"SmartDevManager.setNetOptions"
]
}
}
SmartHomeManager
{
"params": {
"method": [
"SmartHomeManager.factory.instance",
"SmartHomeManager.destroy",
"SmartHomeManager.start",
"SmartHomeManager.attach",
"SmartHomeManager.detach",
"SmartHomeManager.getSupportBrands",
"SmartHomeManager.getSupportDevice",
"SmartHomeManager.getDeviceList",
"SmartHomeManager.getSceneMode",
"SmartHomeManager.setSceneMode",
"SmartHomeManager.saveSceneMode",
"SmartHomeManager.setScheduleItem",
"SmartHomeManager.removeScheduleItem",
"SmartHomeManager.modifySceneMode",
"SmartHomeManager.removeSceneMode",
"SmartHomeManager.setDeviceInfo",
"SmartHomeManager.listMethod",
"SmartHomeManager.getDeviceDigest",
"SmartHomeManager.setDeviceMode",
"SmartHomeManager.setCallInfo"
]
}
}
SmtpClient
{
"params": {
"method": [
"SmtpClient.sendTestMail",
"SmtpClient.listMethod"
]
}
}
StateManager
{
"params": {
"method": [
"StateManager.factory.instance",
"StateManager.destroy",
"StateManager.set",
"StateManager.get",
"StateManager.attach",
"StateManager.detach",
"StateManager.listMethod"
]
}
}
StorageFunc
{
"params": {
"method": [
"StorageFunc.markFile",
"StorageFunc.getMarkInfo",
"StorageFunc.listMethod"
]
}
}
UPnPPortmap
{
"params": {
"method": [
"UPnPPortmap.getRouterMapping",
"UPnPPortmap.getUPnPStatus",
"UPnPPortmap.listMethod",
"UPnPPortmap.refreshUpnpRouter"
]
}
}
UserLock
{
"params": {
"method": [
"UserLock.listMethod",
"UserLock.startFind",
"UserLock.doFind",
"UserLock.stopFind",
"UserLock.unlock"
]
}
}
UserSecurity
VDPPassThrough
{
"params": {
"method": [
"VDPPassThrough.call",
"VDPPassThrough.attachProc",
"VDPPassThrough.detachProc",
"VDPPassThrough.listMethod"
]
}
}
VideoOutput
Wireless433AutoTest
{
"params": {
"method": [
"Wireless433AutoTest.controlTest",
"Wireless433AutoTest.setTestParam",
"Wireless433AutoTest.getTestStatus",
"Wireless433AutoTest.listMethod"
]
}
}
WlanDevManager
{
"params": {
"method": [
"WlanDevManager.getWifiAPStatus",
"WlanDevManager.getWifiDeviceList",
"WlanDevManager.getWifiAPVersion",
"WlanDevManager.listMethod"
]
}
}
capsManager
{
"params": {
"method": [
"capsManager.factory.instance",
"capsManager.destroy",
"capsManager.set",
"capsManager.get",
"capsManager.alloc",
"capsManager.free",
"capsManager.listMethod"
]
}
}
configManager
{
"params": {
"method": [
"configManager.factory.instance",
"configManager.destroy",
"configManager.getConfig",
"configManager.setConfig",
"configManager.saveFile",
"configManager.deleteConfig",
"configManager.getDefault",
"configManager.setDefault",
"configManager.getMemberNames",
"configManager.restore",
"configManager.attach",
"configManager.detach",
"configManager.restoreExcept",
"configManager.copyConfig",
"configManager.getConfigEx",
"configManager.setConfigEx",
"configManager.exportPackConfig",
"configManager.importPackConfig",
"configManager.setChannelConfig",
"configManager.getVideoAnalyseConfig",
"configManager.setVideoAnalyseConfig",
"configManager.getFailureDetail",
"configManager.deleteFile",
"configManager.setTemporaryConfig",
"configManager.restoreTemporaryConfig",
"configManager.secGetDefault",
"configManager.exportRemoteDeviceList",
"configManager.importRemoteDeviceList",
"configManager.listMethod"
]
}
}
configManagerHelp
{
"params": {
"method": [
"configManagerHelp.importPackConfig",
"configManagerHelp.listMethod"
]
}
}
console
{
"params": {
"method": [
"console.factory.instance",
"console.destroy",
"console.attach",
"console.detach",
"console.runCmd",
"console.listMethod"
]
}
}
ddnsClient
{
"params": {
"method": [
"ddnsClient.factory.instance",
"ddnsClient.destroy",
"ddnsClient.testHostName",
"ddnsClient.listMethod",
"ddnsClient.getStatus",
"ddnsClient.getDomainNames"
]
}
}
deviceDiscovery
{
"params": {
"method": [
"deviceDiscovery.factory.instance",
"deviceDiscovery.destroy",
"deviceDiscovery.attach",
"deviceDiscovery.detach",
"deviceDiscovery.start",
"deviceDiscovery.stop",
"deviceDiscovery.refresh",
"deviceDiscovery.ipScan",
"deviceDiscovery.listMethod",
"deviceDiscovery.setConfig",
"deviceDiscovery.scanDevice"
]
}
}
eventManager
{
"params": {
"method": [
"eventManager.factory.instance",
"eventManager.destroy",
"eventManager.attach",
"eventManager.detach",
"eventManager.notify",
"eventManager.getEventIndexes",
"eventManager.confirmEvent",
"eventManager.confirmEventByPassword",
"eventManager.getCaps",
"eventManager.getEventMask",
"eventManager.getEventData",
"eventManager.receipt",
"eventManager.listMethod",
"eventManager.getEventLink"
]
}
}
global
{
"params": {
"method": [
"global.login",
"global.logout",
"global.keepAlive",
"global.setCurrentTime",
"global.getCurrentTime",
"global.listMethod"
]
}
}
locales
{
"params": {
"method": [
"locales.factory.instance",
"locales.destroy",
"locales.config",
"locales.SetLanguage",
"locales.GetLanguageList",
"locales.GetParsedString",
"locales.getCaps",
"locales.LoadString",
"locales.getVideoStandardList",
"locales.listMethod"
]
}
}
log
{
"params": {
"method": [
"log.factory.instance",
"log.destroy",
"log.getSummary",
"log.startFind",
"log.doFind",
"log.stopFind",
"log.clear",
"log.append",
"log.getCaps",
"log.getCount",
"log.doSeekFind",
"log.stop",
"log.resume",
"log.clearByTypes",
"log.listMethod"
]
}
}
magicBox
{
"params": {
"method": [
"magicBox.factory.instance",
"magicBox.destroy",
"magicBox.getSystemInfo",
"magicBox.config",
"magicBox.exit",
"magicBox.restart",
"magicBox.shutdown",
"magicBox.reboot",
"magicBox.beep",
"magicBox.getProcessInfo",
"magicBox.getDeviceType",
"magicBox.getDeviceClass",
"magicBox.getSerialNo",
"magicBox.getCPUCount",
"magicBox.getCPUUsage",
"magicBox.getMemoryInfo",
"magicBox.getLocalNo",
"magicBox.getMachineName",
"magicBox.getProductDefinition",
"magicBox.getExitTime",
"magicBox.getExitState",
"magicBox.isAppAutoStart",
"magicBox.resetSystem",
"magicBox.getSystemInfoNew",
"magicBox.getVideoChipType",
"magicBox.getProcessInfoEx",
"magicBox.getMainBoardCount",
"magicBox.getCaps",
"magicBox.getUpTime",
"magicBox.getVendor",
"magicBox.setDeviceParam",
"magicBox.getSubModules",
"magicBox.getSoftwareVersion",
"magicBox.getHardwareVersion",
"magicBox.get2DCode",
"magicBox.listMethod",
"magicBox.getEnv",
"magicBox.setEnv",
"magicBox.getBootParameter",
"magicBox.getHardwareType",
"magicBox.needReboot",
"magicBox.getMarketArea",
"magicBox.resetSystemEx",
"magicBox.set2DCode",
"magicBox.rebootDelay"
]
}
}
mobile
{
"params": {
"method": [
"mobile.factory.instance",
"mobile.destroy",
"mobile.getSIMState",
"mobile.getMobileRSSI",
"mobile.getIMSI",
"mobile.getModuleState",
"mobile.listMethod"
]
}
}
netApp
{
"params": {
"method": [
"netApp.factory.instance",
"netApp.destroy",
"netApp.scanWLanDevices",
"netApp.getNetInterfaces",
"netApp.getMobileInterfaces",
"netApp.getDialInfo",
"netApp.sendTestMail",
"netApp.getNetDataStat",
"netApp.getLinkStatus",
"netApp.getPppoeDns",
"netApp.getPppoeIp",
"netApp.getPppoeState",
"netApp.getiSCSITargets",
"netApp.getRemoteDeviceStatus",
"netApp.getUPnPStatus",
"netApp.getVirtualServiceStatus",
"netApp.getCaps",
"netApp.adjustTimeWithNTP",
"netApp.getNetResourceStat",
"netApp.getDefaultEthInfo",
"netApp.getMobileRSSI",
"netApp.checkIPConflict",
"netApp.listMethod",
"netApp.connectByWps",
"netApp.getPingStatus"
]
}
}
printLog
{
"params": {
"method": [
"printLog.factory.instance",
"printLog.destroy",
"printLog.getInfo",
"printLog.startFind",
"printLog.doFind",
"printLog.stopFind",
"printLog.listMethod"
]
}
}
upgrader
{
"params": {
"method": [
"upgrader.factory.instance",
"upgrader.destroy",
"upgrader.prepare",
"upgrader.appendData",
"upgrader.cancel",
"upgrader.execute",
"upgrader.getState",
"upgrader.getChipList",
"upgrader.chooseChip",
"upgrader.check",
"upgrader.start",
"upgrader.setPeripheralInfos",
"upgrader.setUrl",
"upgrader.setFile",
"upgrader.getUpdateSerial",
"upgrader.attachState",
"upgrader.detachState",
"upgrader.listMethod"
]
}
}
userAuth
{
"params": {
"method": [
"userAuth.getClassify",
"userAuth.listMethod"
]
}
}
userManager
{
"params": {
"method": [
"userManager.factory.instance",
"userManager.destroy",
"userManager.getAuthorityList",
"userManager.getErrorNo",
"userManager.addGroup",
"userManager.deleteGroup",
"userManager.modifyGroup",
"userManager.getGroupInfo",
"userManager.getGroupInfoAll",
"userManager.addUser",
"userManager.deleteUser",
"userManager.modifyUser",
"userManager.getUserInfo",
"userManager.getUserInfoAll",
"userManager.modifyPassword",
"userManager.saveFile",
"userManager.getActiveUserInfoAll",
"userManager.kickOut",
"userManager.blockPeer",
"userManager.getCaps",
"userManager.modifyPasswordByType",
"userManager.getBlockUserInfoList",
"userManager.attachActiveUserState",
"userManager.detachActiveUserState",
"userManager.listMethod"
]
}
}
webFunCollect
{
"params": {
"method": [
"webFunCollect.findItems",
"webFunCollect.listMethod"
]
}
}
[*] Disconnecting...
[*] Closed connection
 
Last edited:

riogrande75

Pulling my weight
Joined
Oct 19, 2017
Messages
390
Reaction score
140
Location
AUSTRIA
Try ConfigManager.attach or SmartHomeManager.attach instead and play with alarmsettings on VTH. Do you get anything delivered on the console?

Gesendet von meinem SM-G973F mit Tapatalk
 

Antori91

n3wb
Joined
Jan 29, 2020
Messages
28
Reaction score
3
Location
France
Try ConfigManager.attach or SmartHomeManager.attach instead and play with alarmsettings on VTH. Do you get anything delivered on the console?

Gesendet von meinem SM-G973F mit Tapatalk
Thanks Riogrande75 for your input. I'm quite busy this week-end, I will do the test next week-end and will let you know.
 

riogrande75

Pulling my weight
Joined
Oct 19, 2017
Messages
390
Reaction score
140
Location
AUSTRIA
Just played arround with my VTH1660CH's alarm inputs while running our script with it.
I got this output when a alarm got triggered:
Code:
2020-02-10 08:25:55.000000: Unknown event received
array(4) {
  ["id"]=>
  int(2)
  ["method"]=>
  string(24) "client.notifyEventStream"
  ["params"]=>
  array(2) {
    ["SID"]=>
    int(513)
    ["eventList"]=>
    array(1) {
      [0]=>
      array(4) {
        ["Action"]=>
        string(4) "Stop"
        ["Code"]=>
        string(10) "AlarmLocal"
        ["Data"]=>
        array(2) {
          ["LocaleTime"]=>
          string(19) "2020-02-10 08:25:54"
          ["UTC"]=>
          float(1581319554)
        }
        ["Index"]=>
        int(4)
      }
    }
  }
  ["session"]=>
  int(2147483647)
}
The index points at the alarm input (in my case ALARM 5, counted [0-7]).
 

Antori91

n3wb
Joined
Jan 29, 2020
Messages
28
Reaction score
3
Location
France
Hello,
I've played with my VTH with the following Python snippet (logging, listen the events during 2 minutes and logout).
I capture events (mainly a SIPRegisterResult event every minute but also ScreenSaver events, see screenshot below) but no event is triggered when I arm or disarm the VTH alarm. I assume eventManager is not the right service to use, maybe I have to try ConfigManager.attach or SmartHomeManager.attach as you suggested.


def DahuaVTHSecPanel(self):

try:
self.remote = remote(self.rhost, int(self.rport),ssl=self.DHIP_SSL)
except Exception as e:
return False

if not self.Dahua_DHIP_Login():
return False

log.success("Connected to the VTH")

for ev in range(1):
#Listen to all events
query_args = {
#"magic":"0x1234",
"method":"eventManager.attach",
"params":{
"codes": ["All"],
},
"session":self.SessionID,
"id":self.ID
}
result, LEN = self.P2P(json.dumps(query_args))
if not LEN:
log.failure("Failure to attach the event manager")
return
else:
print json.dumps(result,indent=4)
time.sleep(120)

log.info("Disconnecting...")
return self.logout()

Capture2.GIF
 
Last edited:

riogrande75

Pulling my weight
Joined
Oct 19, 2017
Messages
390
Reaction score
140
Location
AUSTRIA
Just played arround with VDPconfig from DahuaToolbox. There you can easily set, enable and disable the alarm(s).
All you have to do is sniff what windows PC "speaks" with VTH and implement this functions in the script.
This is e.g. what I got when setting alarm profile "AtHome" active:
Code:
{"id" : 71188, "method" : "configManager.setConfig", "params" : { "name" : "CommGlobal", "table" : { "AlarmEnable" : true, "CurrentProfile" : "AtHome", "ProfileEnable" : true, "Profiles" : [ { "AlarmInChannels" : null, "Name" : "Outdoor" }, { "AlarmInChannels" : [ 0, 2, 4, 0 ], "Name" : "AtHome" }, { "AlarmInChannels" : null, "Name" : "Sleeping" }, { "AlarmInChannels" : [ 0, 1, 2, 3, 4, 5, 6, 7 ], "Name" : "Custom" } ] } }, "session" : 2147483637 }
{"id":71188,"params":{"options":null},"result":true,"session":2147483637}
 

Antori91

n3wb
Joined
Jan 29, 2020
Messages
28
Reaction score
3
Location
France
Just played arround with VDPconfig from DahuaToolbox. There you can easily set, enable and disable the alarm(s).
All you have to do is sniff what windows PC "speaks" with VTH and implement this functions in the script.
This is e.g. what I got when setting alarm profile "AtHome" active:
Code:
{"id" : 71188, "method" : "configManager.setConfig", "params" : { "name" : "CommGlobal", "table" : { "AlarmEnable" : true, "CurrentProfile" : "AtHome", "ProfileEnable" : true, "Profiles" : [ { "AlarmInChannels" : null, "Name" : "Outdoor" }, { "AlarmInChannels" : [ 0, 2, 4, 0 ], "Name" : "AtHome" }, { "AlarmInChannels" : null, "Name" : "Sleeping" }, { "AlarmInChannels" : [ 0, 1, 2, 3, 4, 5, 6, 7 ], "Name" : "Custom" } ] } }, "session" : 2147483637 }
{"id":71188,"params":{"options":null},"result":true,"session":2147483637}
Hello RioGrande75,
Yes ! I'm able in my environment to get/set remotely the VTH alarm. See below a screenshot example. With Python, the query args to get the status are
query_args = {
"method":"configManager.getConfig",
"params":{
"name": "CommGlobal",
},
"session":self.SessionID,
"id":self.ID
}
By the way, it seems there is no callback for this configManager service, ie you have to query in a loop the VTH.
Thank you again for your support.Capture.GIF
 

Antori91

n3wb
Joined
Jan 29, 2020
Messages
28
Reaction score
3
Location
France
By the way, it seems there is no callback for this configManager service, ie you have to query in a loop the VTH.
I was wrong! There is an attach method for this configManager service. I've modified my python args to use configManager.attach. A screenshot below where my program logins and then just "sleeps" during 2 minutes. During these 2 minutes, I armed and disarmed the VTH alarm using its screen. And...my program has received messages (callback messages) from the VTH.
It 's just now perfect !
Capture.GIF
 
Last edited:

Antori91

n3wb
Joined
Jan 29, 2020
Messages
28
Reaction score
3
Location
France
Hello RioGrande75,

Here is the code I've just finished to write: Antori91/Home_Automation

The core Dahua routines are Bashis code (mcw0/Tools).

To Bashis code, I've added an MQTT interface to send requests to arm/disarm my alarm Appliance and synchronize the VTH with all other Alarm clients (mainly Domoticz SecPanel).

This code seems OK. BUT so far, I didn't try my VTH_SetSecPanel(...) method which requests the VTH box to modify its own internal configuration. I'm afraid to brick the VTH.

When I request the VTH to get its Alarm configuration with my VTH_GetSecPanel( ) method, I get from the VTH something like: {"id":2,"params":{"table":{"AlarmEnable":false,"CurrentProfile":"AtHome","ProfileEnable":true,"Profiles":[{"AlarmInChannels":[0,1,2,3,5,null],"Name":"Outdoor"},{"AlarmInChannels":[0,3,4,null],"Name":"AtHome"},{"AlarmInChannels":[0,2,3,4,null],"Name":"Sleeping"},{"AlarmInChannels":[5],"Name":"Custom"}]}},"result":true,"session":2147483616}

With my VTH_SetSecPanel() method, I will send to the VTH as args something like: {'method': 'configManager.setConfig', 'params': {'table': {'AlarmEnable': 'True', 'CurrentProfile': 'AtHome'}, 'name': 'CommGlobal'}, 'session': 2147483616, 'id': 5}

What do you think? Do you share my own worries?


Code extract about my VTH_SetSecPanel method >>>

def VTH_SetSecPanel(self, CVQ6081_Alarm):


query_args = {
"method":"configManager.setConfig",
"params":{
"table":{
"AlarmEnable": self.AlarmEnable,
"CurrentProfile": self.AlarmProfile,
},
"name":"CommGlobal",
},
"session":self.SessionID,
"id":self.ID
}

..............

log.info("[" + str(datetime.datetime.now()) + " VTH_BOX_Alarm] Synchronizing with SecPanel to: {}".format(query_args))

data = self.P2P(json.dumps(query_args))

..............
 
Last edited:

riogrande75

Pulling my weight
Joined
Oct 19, 2017
Messages
390
Reaction score
140
Location
AUSTRIA
I'm quite convinced that you cannot brick your dahua device with a wrong config.
In rare cases it might be that it act's kinda crazy", but that can be fixed with a factory reset.
I played a lot, a powercycle fixed all my troubles so far.

Your code looks good at first sight, just give it a shot.
 
Top