Dahua VTO custom integration

Excellent! I will fix keep alive for firmware 1.0 in the next version, so you can make regular update when it’s will be available.

2 Likes

I’m planning to buy a VTO and great to see this custom integration.
As I understand, this integration may help to detect when the doorbell is pushed or ring then it is the good trigger for the automation in Home Assistant.

By the way, is able to stream the video from VTO to HA?

I’m thinking about the automation that when someone push the button on the doorbell, the video from doorbell will be streamed to a cast device such as smart TV automatically.

Thank you.

Yes, it’s will allow you to receive events from VTO/VTH (some Dahua Cameras and NVR’s will also works) and allow to send any commands like open the lock, etc (some useful links with commands you can found at the end of README).

You can integrate video from VTO using Home Assistant generic camera, example:

    name: Doorbell
    still_image_url: https://192.168.1.110/cgi-bin/snapshot.cgi?channel=1
    stream_source: rtsp:/192.168.1.110:554/cam/realmonitor?channel=1&subtype=0
    username: !secret vto_username
    password: !secret vto_password
    authentication: digest
    verify_ssl: false

If you use Apple Homekit you can specify for this camera the doorbeel and video will automatically popup with a message:

  - name: HA Camera Doorbell
    port: 55771
    mode: accessory
    filter:
      include_entities:
        - camera.doorbell
    entity_config:
      camera.doorbell:
        name: Doorbell
        linked_doorbell_sensor: binary_sensor.doorbell

How to integrate bi-directional audio I doesn’t know yet.

2 Likes

Thank you for your quick response. I’m very appreciated on sharing the great integration.

Approved! :slight_smile:

1 Like

what i have to do to have a vto and a nvr both dahua ?
i need to install the Integration again with Dahua NVR name insted of Dahua VTO name folder ?

Hello,

I’ve tried to add the VTO to HA via Onvif and the video streams well.

By the way, I still don’t know how to get the status of of the camera button when it is pushed by someone else?

Could you help me the guide to do?

Thank you.

No, just add second integration to your configuration for example (sure your Dahua NVR should support this protocol, not all Dahua NVRs support it, in this case you will see errors in the log):

  - platform: dahua_vto
    name: Dahua VTO
    host: 192.168.1.2
    username: admin
    password: password
    scan_interval: 5

  - platform: dahua_vto
    name: Dahua NVR
    host: 192.168.1.40
    username: admin
    password: password
    scan_interval: 5

Install integration, configure it and add “Dahua VTO All Events” automation which notify you about every event using HA persistent notification. Play with button and see which events you will get. Create automation for specific event like it’s done for BackKeyLight event in Dahua VTO automation example.

Dahua NVR: [Errno 111] Connect call failed (‘192.168.0.10’, 5000), retry in 10 seconds
2:25:56 AM – (ERROR) Dahua VTO (custom integration) - message first occurred at 2:24:46 AM and shows up 8 times

no luck connecting to the the NVR , model DH-XVR5104HS-I2 :frowning: , my VTO2111D is working beautifully

Maybe some one ,some day can make something to get the movement detection out of the XVR to import it in HA

Thanks to all supporters! Now Dahua VTO integration in default HACS repository!

1 Like

Please delete existing integration, update to 1.0.4 using HACS default repository and check if everything working as expected. Thanks in advance.

Nice, was waiting for it :stuck_out_tongue:
Let’s see how this goes, was using Dahua2MQTT but hope this is better :slight_smile:

edit: ok, so far so good :smiley: and easy to replace it in node-red too (messages are compatible)

Great!
If you think your node-red automation will be useful for other users, please share it here.

Ok it might so here goes, this is the flow I used while exploring the messages coming from Dahua2MQTT, with the drop-in replacement for the HA events from the Dahua VTO integration.
Includes a little flow for the doorbell press (CallNoAnswered)

[{"id":"a8db9862.88342","type":"debug","z":"4ea0d8aa.429628","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1430,"y":240,"wires":[]},{"id":"8892ca69.d44df8","type":"debug","z":"4ea0d8aa.429628","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1450,"y":300,"wires":[]},{"id":"49eb0005.62f","type":"switch","z":"4ea0d8aa.429628","name":"CallNoAnswered (Start)","property":"payload.Action","propertyType":"msg","rules":[{"t":"eq","v":"Start","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1210,"y":200,"wires":[["ae5f3c67.a3fc28"],["a8db9862.88342"]]},{"id":"3d85acba.658cf4","type":"inject","z":"4ea0d8aa.429628","name":"","props":[{"p":"payload.event","v":"{\"Action\":\"Start\"}","vt":"json"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":1170,"y":140,"wires":[["49eb0005.62f"]]},{"id":"f90b5e76.8f686","type":"ha-entity","z":"4ea0d8aa.429628","name":"doorbell","server":"1c3dc1f6.321306","version":1,"debugenabled":false,"outputs":1,"entityType":"binary_sensor","config":[{"property":"name","value":"doorbell"},{"property":"device_class","value":""},{"property":"icon","value":"mdi:doorbell-video"},{"property":"unit_of_measurement","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":1920,"y":160,"wires":[["621bcb5b.f9dde4"]]},{"id":"e3de494d.b22948","type":"change","z":"4ea0d8aa.429628","name":"on","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1750,"y":160,"wires":[["f90b5e76.8f686","d84f02e0.caff78"]]},{"id":"d1b5476f.a318d","type":"change","z":"4ea0d8aa.429628","name":"off","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1750,"y":200,"wires":[["f90b5e76.8f686","dcffadf1.18deb"]]},{"id":"2cfd34ed.9bd5e4","type":"delay","z":"4ea0d8aa.429628","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1600,"y":200,"wires":[["d1b5476f.a318d"]]},{"id":"95488a9.9e4c1f8","type":"link out","z":"4ea0d8aa.429628","name":"doorbell pressed","links":["9282fff4.861b18","3127b856.08241"],"x":1555,"y":120,"wires":[]},{"id":"4cb04120.064f18","type":"switch","z":"4ea0d8aa.429628","name":"BackKeyLight","property":"payload.Data.State","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"},{"t":"else"}],"checkall":"false","repair":false,"outputs":3,"x":1260,"y":300,"wires":[[],[],["8892ca69.d44df8"]]},{"id":"621bcb5b.f9dde4","type":"debug","z":"4ea0d8aa.429628","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":2110,"y":160,"wires":[]},{"id":"ae5f3c67.a3fc28","type":"delay","z":"4ea0d8aa.429628","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"30","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":1440,"y":160,"wires":[["95488a9.9e4c1f8","e3de494d.b22948","2cfd34ed.9bd5e4"]]},{"id":"d84f02e0.caff78","type":"api-call-service","z":"4ea0d8aa.429628","name":"","server":"1c3dc1f6.321306","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.doorbell_chime","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1950,"y":100,"wires":[[]]},{"id":"dcffadf1.18deb","type":"api-call-service","z":"4ea0d8aa.429628","name":"","server":"1c3dc1f6.321306","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.doorbell_chime","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1950,"y":240,"wires":[[]]},{"id":"a5e5b00b.616ea8","type":"switch","z":"4ea0d8aa.429628","name":"","property":"payload.Code","propertyType":"msg","rules":[{"t":"eq","v":"CallNoAnswered","vt":"str"},{"t":"eq","v":"IgnoreInvite","vt":"str"},{"t":"eq","v":"VideoMotion","vt":"str"},{"t":"eq","v":"RtspSessionDisconnect","vt":"str"},{"t":"eq","v":"BackKeyLight","vt":"str"},{"t":"eq","v":"TimeChange","vt":"str"},{"t":"eq","v":"NTPAdjustTime","vt":"str"},{"t":"eq","v":"KeepLightOn","vt":"str"},{"t":"eq","v":"VideoBlind","vt":"str"},{"t":"eq","v":"FingerPrintCheck","vt":"str"},{"t":"eq","v":"SIPRegisterResult","vt":"str"},{"t":"eq","v":"AccessControl","vt":"str"},{"t":"eq","v":"CallSnap","vt":"str"},{"t":"eq","v":"Invite","vt":"str"},{"t":"eq","v":"AccessSnap","vt":"str"},{"t":"eq","v":"RequestCallState","vt":"str"},{"t":"eq","v":"PassiveHungup","vt":"str"},{"t":"eq","v":"ProfileAlarmTransmit","vt":"str"},{"t":"eq","v":"BackLightOn","vt":"str"},{"t":"eq","v":"BackLightOff","vt":"str"},{"t":"eq","v":"AlarmLocal","vt":"str"},{"t":"eq","v":"APConnect","vt":"str"},{"t":"eq","v":"Reboot","vt":"str"},{"t":"eq","v":"SystemState","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":25,"x":530,"y":380,"wires":[["49eb0005.62f"],["8def8001.cab3d"],["1ad9eebb.269f01"],["fdeeb7b5.f4304"],["4cb04120.064f18"],["6fe8d53e.040f3c"],["d3f07f.158b978"],["b4c56d4c.f1d3c"],["457cec8f.b4083c"],["a30b709a.d89e5"],["4bcbc7b.3fc00b8"],["57fbe09e.aaccc8"],["8ae14d7.34dc4b"],["a3982afe.ea7868"],["3987c449.4a7ffc"],["85369a7b.d635"],["577dd75d.f12ac"],["61472ff1.aad738"],["3a46427e.81f62e"],["df9078c9.6a21e"],["34298ea5.f510ca"],["28d21b34.4ce9ec"],["4b5b4d69.98d64c"],[],["371b4c30.cfdb94"]],"info":"\n\nmqtt : msg.payload.Code\nha: payload.event.Code"},{"id":"1ad9eebb.269f01","type":"debug","z":"4ea0d8aa.429628","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":260,"wires":[]},{"id":"d3f07f.158b978","type":"debug","z":"4ea0d8aa.429628","name":"NTPAdjustTime","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":760,"y":340,"wires":[]},{"id":"457cec8f.b4083c","type":"debug","z":"4ea0d8aa.429628","name":"VideoBlind","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":380,"wires":[]},{"id":"4bcbc7b.3fc00b8","type":"debug","z":"4ea0d8aa.429628","name":"SIPRegisterResult","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":770,"y":420,"wires":[]},{"id":"8ae14d7.34dc4b","type":"debug","z":"4ea0d8aa.429628","name":"CallSnap","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":740,"y":460,"wires":[]},{"id":"3987c449.4a7ffc","type":"debug","z":"4ea0d8aa.429628","name":"AccessSnap","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":500,"wires":[]},{"id":"577dd75d.f12ac","type":"debug","z":"4ea0d8aa.429628","name":"PassiveHungup","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":760,"y":540,"wires":[]},{"id":"3a46427e.81f62e","type":"debug","z":"4ea0d8aa.429628","name":"BackLightOn","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":580,"wires":[]},{"id":"34298ea5.f510ca","type":"debug","z":"4ea0d8aa.429628","name":"AlarmLocal","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":620,"wires":[]},{"id":"371b4c30.cfdb94","type":"debug","z":"4ea0d8aa.429628","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":730,"y":720,"wires":[]},{"id":"8def8001.cab3d","type":"debug","z":"4ea0d8aa.429628","name":"IgnoreInvite","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":970,"y":240,"wires":[]},{"id":"fdeeb7b5.f4304","type":"debug","z":"4ea0d8aa.429628","name":"RtspSessionDisconnect","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1010,"y":280,"wires":[]},{"id":"6fe8d53e.040f3c","type":"debug","z":"4ea0d8aa.429628","name":"TimeChange","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":970,"y":320,"wires":[]},{"id":"b4c56d4c.f1d3c","type":"debug","z":"4ea0d8aa.429628","name":"KeepLightOn","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":970,"y":360,"wires":[]},{"id":"a30b709a.d89e5","type":"debug","z":"4ea0d8aa.429628","name":"FingerPrintCheck","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":990,"y":400,"wires":[]},{"id":"57fbe09e.aaccc8","type":"debug","z":"4ea0d8aa.429628","name":"AccessControl","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":980,"y":440,"wires":[]},{"id":"a3982afe.ea7868","type":"debug","z":"4ea0d8aa.429628","name":"Invite","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":950,"y":480,"wires":[]},{"id":"85369a7b.d635","type":"debug","z":"4ea0d8aa.429628","name":"RequestCallState","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":990,"y":520,"wires":[]},{"id":"61472ff1.aad738","type":"debug","z":"4ea0d8aa.429628","name":"ProfileAlarmTransmit","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1000,"y":560,"wires":[]},{"id":"df9078c9.6a21e","type":"debug","z":"4ea0d8aa.429628","name":"BackLightOff","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":970,"y":600,"wires":[]},{"id":"28d21b34.4ce9ec","type":"debug","z":"4ea0d8aa.429628","name":"APConnect","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":970,"y":640,"wires":[]},{"id":"4b5b4d69.98d64c","type":"debug","z":"4ea0d8aa.429628","name":"Reboot","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":740,"y":660,"wires":[]},{"id":"c2bbe9a3.2804c","type":"mqtt in","z":"4ea0d8aa.429628","name":"","topic":"DahuaVTO/#","qos":"2","datatype":"json","broker":"8876f602.fd305","x":90,"y":280,"wires":[["e693f59b.dd3338","a5e5b00b.616ea8"]]},{"id":"e693f59b.dd3338","type":"debug","z":"4ea0d8aa.429628","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":310,"y":280,"wires":[]},{"id":"2ccdbca.822af44","type":"server-events","z":"4ea0d8aa.429628","name":"","server":"1c3dc1f6.321306","event_type":"dahua_vto","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"x":110,"y":480,"wires":[["4b3091e7.1fdcb8","c08d8e41.636f78"]]},{"id":"4b3091e7.1fdcb8","type":"debug","z":"4ea0d8aa.429628","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":310,"y":480,"wires":[]},{"id":"c08d8e41.636f78","type":"change","z":"4ea0d8aa.429628","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.event","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":420,"wires":[["a5e5b00b.616ea8"]]},{"id":"a562ca4e.be2f88","type":"comment","z":"4ea0d8aa.429628","name":"Dahua2MQTT","info":"","x":90,"y":220,"wires":[]},{"id":"4b630603.11e45","type":"comment","z":"4ea0d8aa.429628","name":"Dahua VTO (HA)","info":"","x":100,"y":420,"wires":[]},{"id":"1c3dc1f6.321306","type":"server","name":"Home Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"8876f602.fd305","type":"mqtt-broker","name":"local","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

Hello,

i tried with VTO2111D and it’s working perfectly.

I have ASI12021E and BSC1221A that i tried but no luck…

Hello!
Seems automation “All Events” spamming the “SIPRegisterResult” event.
Is it normal?

ps. I have Dahua VTO 2202F-P and no VTH.

Yes, if you see SIPRegisterResult event every minute it’s normal.

Use “Dahua VTO All Events” automation only for debug purpose, when you will see all events which you needed, make automation which is process only specific event(s), for example look to “Dahua VTO” automation which process only events with code “BackKeyLight”.

Excelent!
Can you post here the links to ASI12021E and BSC1221A models. It’s a Dahua devices?

Sure, here are the links:

https://www.dahuasecurity.com/products/All-Products/Access-ControlTime-Attendance/Access-Control/Standalone/ASI1201E/ASI1201E-D

https://www.dahuasecurity.com/products/All-Products/Access-ControlTime-Attendance/Access-Control/Standalone/ASI1201A/ASI1201A-D