Dahua VTO custom integration

Hi, i think i can help you.
I worked a bit on my setup to obtain:

  • Notification for call or unlock
  • When someone call, save a snapshot from VTO camera, save it and send it as notification
  • The notification for call events contains a button to a custom dashboard which has buttons for locks and live feed with 2 way audio.
  • Activate outdoor lights when a call or unlock event happens
  • Ring Amazon Echo Dots with a soft ring when someone is calling

I started with this basic setup https://github.com/myhomeiot/DahuaVTO?tab=readme-ov-file#lock-example-with-call-to-open-door-service

Some advice:

  • Create 2 Timers and 2 Locks ( second lock has “channel: 2” )
  • Set "duration: “XX:YY:ZZ” ( hh mm ss ) on those timers. This can prevent multiple activation of same lock, especially for a big gate which takes > 1 minute to fully cycle.

Now create 2 buttons and you have full control of locks.

Now let’s talk about notifications.
Dahua_VTO listen events from VTO. You can find some useful data here

I use Node RED to handle events i need, but you can do this on automations to ( i had those in the past ).
For example when i receive an event with this data, it means someone is calling my unit 7700:

{"Action":"Pulse","Code":"Invite","Data":{"UserID":"7000"}}

This data appears when an NFC tag is scanned. After this i filter for “CardNo” so i know who exactly has used its NFC tag.

{"Action":"Pulse","Code":"AccessControl","Data":{"Status":1,"Name":"OpenDoor","Method":1}}

Since you have now entities for 2 locks you already know when those locks are triggered, so you can notify yourself based on homeassistant entities status.

Now a quick and very easy solution for Two Way Audio from/to VTO in HomeAssistant.
Luckily Dahua implemented correctly everything to get two way audio via ONVIF.

  • Make sure you reach your HomeAssistant via HTTPS.
  • Install go2rtc
  • Install WebRTC Camera
  • Add your VTO in go2rtc with this config (Cancellino is a name you can replace as your prefeer. Cancellino in italian means pedestrian gate ).
streams:
  Cancellino:
    - rtsp://admin:YOUR_PASWORD_HERE@YOUR_VTO_IP_HERE:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif

webrtc:
  candidates:
    - stun:8555
  • Create a dashboard with a WebRTC Camera widget with this code:
type: custom:webrtc-camera
streams:
  - url: Cancellino
    name: ❌ Mic OFF
  - url: Cancellino
    mode: webrtc
    media: video,audio,microphone
    name: 🎙️Mic ON
mode: webrtc
muted: false
background: false
ui: true
style: >-
  video {object-fit: fill;}  .stream { font-size: 15px; width: 150px; 
  font-weight: bold; padding-left: 2px;}  .controls {
  background-color:#dddddddd; padding:5px 10px; border-radius: 10px;}

This creates a stream with Microphone disabled. If you press “Mic OFF” it switches to the other configuration which has Microphone enabled.
You can talk to people outside and they’ll hear clearly.

This is totally configurable and i’m sure it can be customized even better.

This is a very easy and reliable (as for now) way to get a fully functional intercom inside HomeAssistant.
I’m using this setup since some months and never had an issue.

@myhomeiot maybe you can add this as suggestion to your repository ?

2 Likes

@L4ky Thanks for great examples!

The integration is very flexible so I don’t know how to add your and other good examples into README :frowning:
Maybe it’s should have examples section with links to messages from this forum?
If you see how make this nice, please make PR to the repo.

1 Like

Hello,
What are your Camera configuration in Frigate? For the 2 way? Nice work

I do not use frigate at all.
Just go2rtc and webrtc card.

1 Like

Ok thx have an good day!

1 Like

hello.
do you configure it with frigate?
i have the dauha vto configured in frigate and use frigate card. but cant use the 2way audio :frowning:

Hello I don’t have the 2 way audio.

:frowning:
thanks for reply

Try the fix_vto_codecs.sh script described here

thanks, i will try!

Hello, thx for you response but where muss I run this script? Muss I change anything in the file? Sorry for the questions.
Thx in advance.

Hey guys! Thanks @myhomeiot for this wonderful project. Did any of you ever manage to get the buttons on the VTO4202 read out? I have this unit with 2 buttons and a press on both returns

{
  "Action": "Pulse",
  "Code": "BackKeyLight",
  "Data": {
    "LocaleTime": "2025-08-14 15:36:05",
    "State": 1,
    "UTC": 1755182165
  },
  "Index": -1,
  "deviceType": "DHI-VTO4202FB-P-S2",
  "serialNumber": "XXXSNXXX"
}

This message comes from listening to the events on pressing any of the buttons.

Much appretiated!

For anybody with this unit who also has this issue, this is my solution after messing around for a little bit. Just for the sake of steps reproduction:

  • I added logging to sensor.py under custom_components/dahua_vto
        elif message.get("method") == "client.notifyEventStream":
            for event in params.get("eventList"):
                #_LOGGER.debug("RAW Dahua Event: %s", json.dumps(event, indent=2)) <- add this line here.

to output all messages at the event handler, turns out the integration does not know anything about which button is pressed IF the button module configured on the dahua web page is set to 2 buttons. So this line is actually unnecessary because the VTO is just not sending the “correct” data.

If you set it to the 5x button module on the dahua webpage (and just configure 2 buttons to specific rooms under Household Setting → VTH management) you get this output:

{
  "Action": "Pulse",
  "Code": "Invite",
  "Data": {
    "CallID": "1",
    "IsEncryptedStream": false,
    "LocaleTime": "2025-08-14 17:14:03",
    "LocaleTime": "2025-08-14 17:14:17",
    "LockNum": 2,
    "SupportPaas": false,
    "TCPPort": 37777,
    "UTC": 1755188043,
    "UTC": 1755188057,
    "UserID": "101"
  },
  "Index": 0,
  "deviceType": "DHI-VTO4202FB-P-S2",
  "serialNumber": "XXXSNXXX"
}

Which is obviously exactly what you are looking for. Mind you I configured my rooms to be “101” and “201” for “UserID”. Hope that helps you guys out. Thanks.

1 Like

It was already listed here

Thank you for this information. It seems the firmware was the problem. I had V2017-04-14 V1.000.00.0 (it was the first firmware released, ugly interface/etc). I updated to your version V4.300.0000000.7.R.20200311 and now when I unlock from the integration it also plays the sound The door is unlocked! Finally. (P.S. I also have the new UI interface, the one from your screenshot, looks much better)

1 Like

Thanks for the update.

Instead this you can use debugging option, it’s dumps all packets from/to VTO/VTH.

If you asks about fix_vto_codecs.sh script and frigate you can find more info here.

hello, i have read this but i don’t know what i muss do. i don’t know howi muss execute. the chmod?

Yes, to make this script “executable” you should run:

chmod +x fix_vto_codecs.sh

Then you can execute it and check if you have 2-way audio (change IP and user and pass to your data):

./fix_vto_codecs.sh rtsp://user:[email protected]/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif

In order to preserve this codec changes after VTO restarts you should add this script into go2rtc config as described in documentation.

Hello, thx with your help and Chatgptp I have done it. Many thx a lot