Dahua VTO to MQTT Broker

PoE, 1080P, HD, VTO2201F-P

@mglc28 which image are you using?

thanks

what do you mean by ā€œimageā€?
Thanks

are you using:
registry.gitlab.com/elad.bar/dahuavto2mqtt:latest

Yes I am

version: '3'
services:
  dahuavto2mqtt:
    image: "registry.gitlab.com/elad.bar/dahuavto2mqtt:latest"
    container_name: "dahuavto2mqtt"
    hostname: "dahuavto2mqtt"
    restart: "unless-stopped"
    environment:
      - DAHUA_VTO_HOST=192.168.1.30
      - DAHUA_VTO_USERNAME=myuser
      - DAHUA_VTO_PASSWORD=MyPassword
      - MQTT_BROKER_HOST=192.168.1.53
      - MQTT_BROKER_PORT=1883
      - MQTT_BROKER_USERNAME=myusername
      - MQTT_BROKER_PASSWORD=MyPasswd
      - MQTT_BROKER_TOPIC_PREFIX=DahuaVTO
      - MQTT_BROKER_CLIENT_ID=DahuaVTO2MQTT
      - DEBUG=True

when was the last time you have tried to update it?

seems that it is not the latest based on the logs

pls ignore, i do see the same log and same error in my log as well, will work on it

1 Like

just to make sure we or on the same version, if you restart the docker container, can you see the following log message:

__main__ Starting DahuaVTO2MQTT, Version: 2023.12.26.30509

yes!

2024-03-04 23:22:05,872 INFO __main__ Starting DahuaVTO2MQTT, Version: 2023.12.26.30509

Could you take a look at my error too please?

sure, hope to get to it during the weekend

1 Like

DahuaVTO2MQTT v2024.03.08.60699

Whatā€™s New:

  • Fix message parsing issues - Dahua RPC protocol deliver chunked messages, it depends on OS and other variables.
  • Query the device with bulk messages (up to 20 in a call) to optimize proces
  • Added much more configurations being extracted from device and being published over MQTT

User with non-Dahua-branded devices:
Please try this version, hope it will solve it for you as well and fully support all devices using the same API.

Plans for additional features:

  • Multiple Dahua devices using configuration file (rather environment variables for one device)
  • Auto-discovery of additional devices
  • Set configuration in devices (instead of Web UI of Dahua devices)
  • Supporting all features available in UI over MQTT and/or HA.

Willing to test it! Thanks!

Trying the latest version (2024.03.08.60699) on a Lorex 2K Doorbell (B451AJ) and it doesnā€™t seem to be publishing any ā€œeventsā€ to MQTT, just configuration info.

I enabled debug and I can see it publishing to Dahua/Device/magicBox.* (I have customized my broker prefix to be just Dahua), but I get nothing else. I believe your docs state that events such as motion should be <broker_prefix>/VideoMotion/Event, but I see no such events ever getting fired at all.

Let me know if you want me to send you any of the debug logs. Iā€™m assuming this did work at some point in time as I have found past posts about people getting these doorbells working, but Iā€™ve also found info about firmware updates changing things on these (and the Dahua/Amcrest) doorbells.

I can also see back in Oct '23 you mentioned you werenā€™t officially supporting non Dahua VTO devices, but the latest post you mentioned about non Dahua branded devices seems like youā€™re now asking people to try it out - so I did.

1 Like

I cannot test device that I donā€™t own, some people found out it can work for non Dahua branded devices and thatā€™s greatā€¦
I will enable devug mode at my place and check if such events are getting and will update,
But just to be sure, you donā€™t get any warning or error messages, ā€œjustā€ not receiving set og events related to magicBox, is that correct?

Thanks

I did notice some errors, and it might be in the parsing of the event but I wasnā€™t certain if they were related or not when I was looking at all the output. They only show on debug.
Thereā€™s a lot that happens, and Portainer was only showing me 100 lines so Iā€™ll have to get it to log everything as an event should trigger. Since thereā€™s a lot of info, Itā€™ll take me a bit to get you a sanitized copy to look at. Iā€™ll see if I can get you something in the next day or two. Thx!

As an FYI, I donā€™t mind helping you testā€¦ but just know Iā€™m not a python programmer so my help might be a bit limited. Iā€™d love to get this device working though - even just for doorbell button presses.

logs should do the work if there are error / warning messages

I have finally been able to check mine also, it seems mine is the same, I canā€™t see anything in MQTT and logs seem to suggest itā€™s not working at all. As for logs from portainer I see this:

2024-03-23 03:50:11,533 ERROR clients.DahuaAPI Failed to handle message, Data: b' \x00\x00\x00DHIP\xa8\x0c\xbf7\\\n\x00\x00F\x00\x00\x00\x00\x00\x00\x00F\x00\x00\x00\x00\x00\x00\x00{"id":2652,"params":{"timeout":55},"result":true,"session":935267496}\n', Error: Failed to read data: id":2652,"params":{"timeout":55},"result":true,"session":935267496}, Error: Extra data: line 1 column 15 (char 14), Line: 123
2024-03-23 03:52:06,348 INFO clients.DahuaAPI Server sent EOF message
2024-03-23 03:52:06,348 INFO clients.DahuaClient Disconnected, will try to connect in 5 seconds

Got around to getting the debug output. Sanitized private info; if any of it is necessary for your debugging, let me know what you need.

DahuaVTO2MQTT debug output (github.com)

[edit] I forgot to mention - in the debug output there should be a motion event (nothing else) recorded, but as youā€™ll see nothing was fired.

Dear @bar just tested your latest release (Version: 2024.03.26.31526).
With the older version ( 2023.12.26.30509) I always got a call notification after rebooting the Docker container. Which was the main issue.

Now I get no notifications at all, even when someone rings the bell.

Hereby the log:

2024-03-27 12:29:11,633 INFO __main__ Loading DahuaVTO2MQTT configuration, Version: 2024.03.26.31526
2024-03-27 12:29:11,634 INFO clients.BaseClient Initialize MQTTClient
2024-03-27 12:29:11,634 INFO clients.BaseClient Starting to connect MQTTClient, Should connect: True
2024-03-27 12:29:11,634 INFO clients.BaseClient Initialize DahuaClient
2024-03-27 12:29:11,634 INFO clients.BaseClient Starting to connect DahuaClient, Should connect: True
2024-03-27 12:29:12,634 INFO clients.MQTTClient MQTT Broker is trying to connect...
2024-03-27 12:29:12,635 INFO clients.DahuaClient Connecting
2024-03-27 12:29:12,638 INFO clients.MQTTClient MQTT Broker connected with result code 0
2024-03-27 12:29:12,729 INFO models.DahuaDevice Type: DHI-VTO2201F-P
2024-03-27 12:29:12,730 INFO models.DahuaDevice Version: 4.600.0000000.0.R
2024-03-27 12:29:12,730 INFO models.DahuaDevice Build Date: 2022-08-13
2024-03-27 12:29:12,781 INFO models.DahuaDevice Access Control Instance ID: 70082336
2024-03-27 12:29:12,781 INFO models.DahuaDevice Serial Number: 9C072E4PAJDCDBA
2024-03-27 12:29:12,844 INFO models.DahuaDevice Hold time: 15
2024-03-27 12:53:02,909 INFO __main__ Loading DahuaVTO2MQTT configuration, Version: 2024.03.26.31526
2024-03-27 12:53:02,910 INFO clients.BaseClient Initialize MQTTClient
2024-03-27 12:53:02,910 INFO clients.BaseClient Starting to connect MQTTClient, Should connect: True
2024-03-27 12:53:02,910 INFO clients.BaseClient Initialize DahuaClient
2024-03-27 12:53:02,911 INFO clients.BaseClient Starting to connect DahuaClient, Should connect: True
2024-03-27 12:53:03,911 INFO clients.MQTTClient MQTT Broker is trying to connect...
2024-03-27 12:53:03,911 INFO clients.DahuaClient Connecting
2024-03-27 12:53:03,913 INFO clients.MQTTClient MQTT Broker connected with result code 0
2024-03-27 12:53:04,019 ERROR clients.DahuaAPI Failed to handle message, Data: b':"dhdtb.bin.img"}},"ProductInfo":null,"ProductName":"DH_VTOXXXXD-G-S2_MultiLang_PN_PAAS_SIP_EMEA_V4.600.0000000.0.R.220813","PushMobileManager":{"PushMobileMaxRoomNum":500,"PushMobileMaxUserEachRoom":10,"PushMustVTHOnline":true,"SupportPushBindingSN":false,"SupportPushMobile":false},"PwdSpeci":{"CharList":"~!@#$%^","Combine":2,"Limit":[8,32],"Type":["Number","Lower","Upper"]},"PwdUpdatePeriod":{"CustomRange":[1,180],"PeriodList":[0,30,60,90,180],"SupportPwdUpdatePeriod":false},"RemoveAnonymous":true,"ReservedConfigs":["Network","IPv6","WLan"],"ResetPwd":{"PubVer":"17101800","Support":true},"RestoreExceptConfigList":{"RestoreExceptConfig":["Network"]},"Revision":0,"SSHD":{"Support":true},"SecretQuestionPath":"\\/mnt\\/data\\/question.txt","SecurityBaselineVersion":"V2.2","ShowLogo":false,"SmartType":"None","SpecVer":"PAAS","SupportCheckAdminGroup":true,"SupportCloudUpgrade":true,"SupportDebugInfoRedir":true,"SupportDevInit":true,"SupportExportEncrypedLog":true,"SupportLoginAuthCtrl":true,"SupportMaskSensitiveInfo":{"CurrentConfig":true,"DefaultConfig":true},"SupportMediaEncrypt":true,"SupportPwdRandSalt":true,"SupportSafetyAbnormalAlarm":true,"SupportSetLockAuthority":true,"SupportSetUnLockLocation":true,"SupportSubMCUUpgrade":true,"SupportVideo":true,"SystemService":{"Support":true},"TypeVersion":"R","UPnP":true,"UPnPSupport":{"PortReuse":true},"UpdateCheckLanguage":false,"VSP":"SIP","VSP_CGI":{"Support":true},"VTOPath":"\\/mnt\\', Error: 'unicodeescape' codec can't decode byte 0x5c in position 1447: \ at end of string, Line: 108
2024-03-27 12:53:04,020 ERROR clients.DahuaAPI Failed to handle message, Data: b'/mtd\\/Config\\/","Vendor":"Dahua","VendorAbbr":"","VideoInCrop":{"Support":true},"VideoInputChannels":1,"VideoOutputChannels":0,"VideoStandards":["PAL","NTSC"],"VideoTalkCaps":{"Protocol":["SIP"],"SIP":{"Class":"VTO","SupportSIPRoute":false},"Support":true,"SupportVTHPaaS":true,"maxOuterNetClientCount":5000},"Web":{"FTP":false,"QRcodeInNetwork":true,"SDEvents":true,"SafetyAbnormalAlarm":false,"SupportVTODBSyncButton":true},"WebStringFiles":["webEN.lang","webEN.lang","webDU.lang","webFR.lang","webDe.lang","webIT.lang","webPT.lang","webRU.lang","webSpl.lang","webTR.lang","webUK.lang","webArb.lang","webES.lang","webPbr.lang"],"WebVersion":"2.4","XSSBlockList":["VideoAnalyseRule"],"setVideoStandardNeedReboot":false}},"result":true,"session":1981763296}\n', Error: Failed to read data: {"id":7,"params":{"definition":{"3G":false,"ACSCaps":{"DBMainPath":"\/var\/tmp\/Database\/","GeneralPsdLenLimit":[6,6],"UserMaxFingerprintCount":3},"AOLCaps":{"Caps":{"SupportDeviceID":true,"SupportDeviceType":true,"SupportDiagnosis":true,"SupportDownLoadLog":true,"SupportModifyIP":true,"SupportReboot":true,"SupportSoftRest":true,"SupportUpgrade":true,"SupportVersion":true},"DGS":{"SupportDelAllInfo":true,"SupportDelInfo":true,"SupportReport":true},"Support":true},"AllDevicesName":"VTOXXXXD-G-S2","AllLanguages":["English","BritishEnglish","SimpChinese","TradChinese","TradChinese2","Dutch","French","German","Italian","Polish","Portuguese","Russian","Spanish","Turkey","Ukrainian","Arabic","Vietnamese","SpanishEU","PortugalBR","Japanese","Romanian","Hungarian","Finnish","Estonian","Korean","Farsi","Dansk","Czechish","Bulgaria","Slovakian","Slovenia","Croatian","Greek","Swedish","Serbian","Lithuanian","Filipino","Catalan","Latvian","Hebrew","Thai"],"Area":"Xiou","AudioInputChannels":1,"AudioOutputChannels":1,"BuildDate":"2022-08-13","BuildDateTime":"2022-08-13 11:09:10","ContainAllAuthority":true,"CustomDemand":"Dahua","CustomLanguages":null,"DB":"DB2","DEBUG":"NONE","DGS":{"SupportDelAllInfo":true,"SupportDelInfo":true,"SupportReport":true},"DH2EventFilter":{"FilterAll":false,"FilterTable":[29]},"DVRIP_TLS":{"DVRIP_TLS":true},"DataBaseZip":{"BackZip":true,"MainZip":false,"TempZipEnable":1},"DefaultLanguage":"English","DefaultVideoStandard":"PAL","DevStringFiles":["StringsEn.txt","StringsEn.txt","StringsDu.txt","StringsFr.txt","StringsDe.txt","StringsIt.txt","StringsPt.txt","StringsRu.txt","StringsSpl.txt","StringsTr.txt","StringsUk.txt","StringsArb.txt","StringsSp.txt","StringsPbr.txt"],"Device":"VTO2201F-P","EnableExtLockByConfig":true,"EncodingResolutionLimit":[["720P","WVGA","D1","CIF"],["1080P","WVGA","D1","QVGA","CIF"],["720P","WVGA","D1","CIF"]],"FLASH":"128M","Faceboard":{"NumericKey":false,"ShiftKey":false},"FileMapRules":[{"FileType":"openSourceNoticeFile","RealPath":"\/mnt\/data\/Strings\/StringsOpenSourceNotice\/openSource.txt","VirtualPath":"\/openSource.txt"},{"FileType":"privacyPolicyFile","RealPath":"\/mnt\/data\/Strings\/StringsPrivacyPolicy\/","VirtualPath":"\/privacyPolicy\/"},{"FileType":"softwareLicenseFile","RealPath":"\/mnt\/data\/Strings\/StringsSoftwareLicense\/","VirtualPath":"\/softwareLicense\/"}],"FilePathManager":{"BuiltInPath":[{"Path":"\/mnt\/sd"}],"Enable":true,"UploadFilePath":[{"Path":"\/mnt\/mtd\/CustomSound\/"},{"Path":"\/mnt\/data\/Strings\/StringsOpenSourceNotice\/"},{"Path":"\/mnt\/data\/Strings\/StringsPrivacyPolicy\/"},{"Path":"\/mnt\/data\/Strings\/StringsSoftwareLicense\/"}]},"Gamma":true,"HTMLStringFiles":["webEN.json","webEN.json","webDU.json","webFR.json","webDe.json","webIT.json","webPT.json","webRU.json","webSpl.json","webTR.json","webUK.json","webArb.json","webES.json","webPbr.json"],"HasPtz":false,"IPTableFilter":{"RulesNum":64,"SemiConnectAttack":true,"Support":true},"Inell":"None","IsGeneralRecord":false,"IsLocalStore":false,"IsLocalurgentStore":false,"IsPtzAlarm":false,"Languages":["English","BritishEnglish","Dutch","French","German","Italian","Portuguese","Russian","Spanish","Turkey","Ukrainian","Arabic","SpanishEU","PortugalBR"],"LegalinfoCaps":{"openSourceNotice":true,"privacyPolicy":true,"softwareLicense":true},"Login":"2","MajorVersion":4,"MaskConfigWhiteLists":["SIP","NAS","VTHRemoteIPCInfo","VTOCallLiftInfo","AccessControlGeneral"],"MaxExtraStream":1,"MaxGroup":8,"MaxRemoteInputChannels":0,"MaxStreamSendBitrate":32768,"MaxUsers":5000,"MediaCallBackCaps":{"AudioEnable":true,"VideoEnable":true},"MinorVersion":600,"MixLightSolution":{"LightingScheme":["InfraredMode"],"Support":true},"ModelDiff":[{"CustomValue":{"UpdateCheckLanguage":false},"DevName":"VTO4202F-P-S2"},{"CustomValue":{"UpdateCheckLanguage":false},"DevName":"VTO2202F-P-S2"},{"CustomValue":{"UpdateCheckLanguage":false},"DevName":"VTO2201F-P"}],"NeedCreateExtra3VideoEncoder":false,"NolockLocalUser":true,"OEMVersion":"0000000","OSDAllStreamDisplay":true,"OnlySupportSingleAuthority":true,"OnvifAuthorityCheck":false,"OnvifForceSync":true,"OuterNetRegistrationPeriod":{"AfterRegistered":60},"PackName":"DH","PassWordLimit":[8,32],"PasswdFindWay":"BC","PresetPwd":true,"Private":{"PatitionSwitchUpgrading":{"PartitionImageName"/mtd\/Config\/","Vendor":"Dahua","VendorAbbr":"","VideoInCrop":{"Support":true},"VideoInputChannels":1,"VideoOutputChannels":0,"VideoStandards":["PAL","NTSC"],"VideoTalkCaps":{"Protocol":["SIP"],"SIP":{"Class":"VTO","SupportSIPRoute":false},"Support":true,"SupportVTHPaaS":true,"maxOuterNetClientCount":5000},"Web":{"FTP":false,"QRcodeInNetwork":true,"SDEvents":true,"SafetyAbnormalAlarm":false,"SupportVTODBSyncButton":true},"WebStringFiles":["webEN.lang","webEN.lang","webDU.lang","webFR.lang","webDe.lang","webIT.lang","webPT.lang","webRU.lang","webSpl.lang","webTR.lang","webUK.lang","webArb.lang","webES.lang","webPbr.lang"],"WebVersion":"2.4","XSSBlockList":["VideoAnalyseRule"],"setVideoStandardNeedReboot":false}},"result":true,"session":1981763296}, Error: Expecting ':' delimiter: line 1 column 4313 (char 4312), Line: 123
2024-03-27 12:53:04,024 INFO models.DahuaDevice Type: DHI-VTO2201F-P
2024-03-27 12:53:04,025 INFO models.DahuaDevice Version: 4.600.0000000.0.R
2024-03-27 12:53:04,025 INFO models.DahuaDevice Build Date: 2022-08-13
2024-03-27 12:53:04,068 INFO models.DahuaDevice Serial Number: 9C072E4PAJDCDBA
2024-03-27 12:53:04,068 INFO models.DahuaDevice Access Control Instance ID: 70082336
2024-03-27 12:53:04,170 INFO models.DahuaDevice Hold time: 15

I think youā€™re closer! Thanks again!