Dahua VTO custom integration

May be interesting for other users, how to get audio sound working through MPD plugin and MPD server.

Hey did you ever manage to find a way to enable 2-way audio and Video on Home Assistant?

I’m running FreePBX on a Raspberry Pi 3b, Home Assistant on a Raspberry Pi 4 (Supervised) and have the Dahua VTO2211. I would like to check if it’s possible to have a custom card on the Dashboard that can receive calls through the SIP Extension on FreePBX. I’m also on a monitor, the Dahua VTH5321.

you can follow this project:

it is still WIP but will be a perfect solution for SIP doorbells

Thanks for the quick reply. Will look it up and see what I can do.

@DannyFreedhorn I’d really appreciate to hear from you and how your project is going. I’m having the same idea: 2 way audio between a RPi (either this RPi also runs HA or HA is on another one) and a VTO, in my case VTO2202F.

Thanks for making this integration!

This took me a while to find out so I thought I share it.
To read or set the alarm status of a Dahua VTH from Home Assistant:

Arming the alarm
You can remotely arm or disarm the alarm on the VTH. Beware that it can take a few second before it is updated on the VTH.

service: dahua_vto.send_command
data:
  entity_id: sensor.dahua_vth
  method: configManager.setConfig
  params: {'table': {'AlarmEnable': 'True', 'CurrentProfile': 'AtHome'}, 'name': 'CommGlobal'}

Getting the alarm status

service: dahua_vto.send_command
data:
  entity_id: sensor.dahua_vth
  method: configManager.getConfig
  params: {'name': 'CommGlobal'}

This will return something like this:

 {"id":35,"params":{"table":{"AlarmEnable":"False","CurrentProfile":"AtHome"}}
,"result":true,"session":755097029}

Make arming or disarming actions to show up as an event
By default if you arm or disarm the alarm on the VTH it will not show up as event. Use this to change that

data:
  entity_id: sensor.dahua_vth
  method: configManager.attach
  params: {'name': 'CommGlobal'}

Tested with a VTH5321GW

1 Like

@p2baron Great works! Thanks for sharing!

Turns out this part is not working…

Arming/Disarming shows up in the debug logs but not as an event…

2022-01-11 19:25:01 DEBUG (MainThread) [custom_components.dahua_vto.sensor] <<< {"id":5,"method":"client.notifyConfigChange","params":{"SID":514,"n
ame":"CommGlobal","table":{"AlarmEnable":false,"CurrentProfile":"Outdoor","ProfileEnable":true}},"session":90978612}

Not sure how to fix this…
@myhomeiot Do you know how I can capture this? They do not appear in the client.notifyEventStream but do show up in debug.

@p2baron yes, currently integration waits only client.notifyEventStream messages, I will add client.notifyConfigChange and let’s you know.

1 Like

Awesome, thanks!
Don’t forget to attach it on startup:

Method: configManager.attach
Param: {'name': 'CommGlobal'}

@p2baron In version 1.0.7 I added the client.notifyConfigChange message handler and configManager.attach call after connection. You can use Code field in automation to distinguish between regular client.notifyEventStream and new client.notifyConfigChange messages, for notifyConfigChange messages Code field will be equal to client.notifyConfigChange for regular notifyEventStream messages the Code field will have values from event so existing integration users doesn’t need to make any changes.

1 Like

Works like a charm!
thank you so much!!

1 Like

Sorry for the late reply.

I’m honestly having zero luck at the moment. I finally started understanding how the FreePBX and SIP servers work in general but whichever direction I take, I seem to face a roadblock.

Direction #1:
Setup FreePBX to connect my VTO2211, VTH5321 and PortSIP UC (running on a tablet). I’m able to successfully receive the call when the VTO Ring button has been pressed and calls to the Tablet work flawlessly.

Roadblock #1:
When the VTO Ring button is pressed, the VTH is able to receive the call however when the call is answered, despite the video parsing through, audio is completely broken and there’s a noise emanating from the VTH, rendering it unusable.

Direction #2:
Setup the SIP server through the VTO and connect the Tablet as an additional VTH, e.g. 9901#1, with the main VTH as 9901#0.

Roadblock:
Tablet is able to receive call and audio works perfectly when the call is answered, video is however non-existent. The video is available when calling from Tablet to VTO though. So, once again, I have no idea what’s the issue.

Might just end up running the SIP server through the VTO for now as it enables the most devices to be usable at this stage. If anyone has any suggestions, please do not hesitate to recommend some my way.

Thanks

1 Like

I wonder if there’s a way to grab a snapshot or video file that is saved in the sdcard of the camera, using the VTO integration (5000 or 35000/37777 ports instead of HTTP 80 port)

I can see that the camera stores snapshots and video files when it detects movement, and i get messages like this:

{
    "Action": "Pulse",
    "Code": "NewFile",
    "Data": {
        "File": "\\/mnt\\/sd\\/2022-01-15\\/001\\/dav\\/11\\/11.57.08-11.58.06[M][0@0][0].dav",
        "LocaleTime": "2022-01-15 11:58:06",
        "Size": 15427026,
        "StoragePoint": "NULL",
        "UTC": 1642247886.0
    },
    "Index": 0
}

However, I am not sure how to get access to those files in the /mnt directory of the camera.

@georgek You can get these files using FTP, check FTP configuration on your VTO. Not sure if it’s possible to access these files directly using DHIP (5000 or 35000/37777 ports) protocol or subscribe for it.

Hallo, can You send to me yours configuration? I can’t configure it :frowning:

Hi @DannyFreedhorn did you make any progress with your Dahua doorbell and the two way audio integration?

Thanks

FYI

So basically, I’m just ditching the VTH entirely (that’s about SG$150 down the drain), the VTO is still good.

I’ve decided to setup the SIP Server on Freepbx on Rpi3 and I’m connecting the VTO and 2 Android Tablets as receivers instead. I’m using PortSIP UC as SIP Clients on the tablet to receive and make calls to the VTO.

I’ve designed and 3D printed Tablet mounts with integrated Qi Wireless Charger. The tablet will be mounted on the mount using magnets and Iron Plates (stuck onto the Tablet).

Will be making a dedicated post to the tablet mount (with STL/Photos) when the project is complete.

1 Like

Please do share how to have audio withing HA for the intercom. If you are successful, please do share details on how to configure SIP integration for HA.