Dahua VTO custom integration

Post the part of configuration where you define and set timer.door_lock, should be something like:

timer:
  door_lock:
    name: Door Lock
    icon: mdi:timer

automation:
  - alias: Dahua VTO
    mode: queued
    trigger:
      - platform: event
        event_type: dahua_vto
        event_data:
          Code: BackKeyLight
    action:
      - choose:
...
          - conditions: >
              {{ trigger.event.data.Data.State | int == 8 }}
            sequence:
              - service: timer.start
                data:
                  entity_id: timer.door_lock
                  duration: 00:00:02 # VTO Unlock Period
...

Hello, could someone give me code to get entity door sensor? I’m new with HA, I have door sensor in my dahua 3211D, actually configured to HA unlock but have problems with door sensor. Would be great if someone could help me and show the code. Thanks

Hello, some examples you can find in readme, look into lock:

lock:
  - platform: template
    name: Door Lock
    ...

Still can’t find it, could someone give me excatly code which should I paste in configuration to get entity door sensor? Thanks

Hello,
I don’t have door sensor connected to VTO so I can only assumes that you should receive event when door is open and when door is close.

If you have this automation you should see all events coming from VTO, try to clear all persistent notification, open then close door and write down all events which you get. Try this test few times if you get events looks like open/close door when I can help you with door sensor, basically it’s will look same as Door Lock sensor but will use different events to change state. You can try do do it by your self use HA input_boolean as storage for the state when turn it on when you get open door event and turn it off then you get door close event.

I’ve connected simple magnetic sensor to my Dahua VTO 2211G-P (door1_fb and GND wires).

here is door status binary sensor config:

template:
  - trigger:
      - platform: event
        event_type: dahua_vto
        event_data:
          Code: DoorStatus
    binary_sensor:
      - name: VTO Door Status
        state: "{{ trigger.event.data.Data.Status | string == 'Open' }}"
        device_class: door

image

Works perfectly


Events sent from VTO:

{'Action': 'Pulse', 'Code': 'DoorStatus', 'Data': {'LocaleTime': '2021-11-29 23:31:23', 'Status': 'Close', 'UTC': 1638225083.0}, 'Index': 0, 'entity_id': 'sensor.dahua_vto'}
{'Action': 'Pulse', 'Code': 'DoorStatus', 'Data': {'LocaleTime': '2021-11-29 23:32:52', 'Status': 'Open', 'UTC': 1638225172.0}, 'Index': 0, 'entity_id': 'sensor.dahua_vto'

Thanks @mate!
I add this example to readme

@jkon probably will be glad to see it.

I’m glad I was able to help a little and I really appreciate your work on integration.
Thanks!

Wow You are my hero! Thanks very much I really appreciate your work, works fantastic!

Hi
Thank you for your decision.
If VTH is connected to VTO, then a melody plays when the call is made and when the door is opened, it says - the door is open.
If VTH is not connected, then it does not do this.
What command can be used to simulate that VTH is connected?

I don’t think VTH can be emulated using single command, you can try to configure DSS express as we discussed in this issue.

Thanks, but DSS Express is not suitable. Since when using it, the application stops working
on the gMDSS Plus phone.
The ds mobile 2 application is very inconvenient for VTO management, and there is no notification of an incoming call in it

maybe there is a command for the VTO to say that the door is open?

You can ask VTO to unlock the lock and physically connect the door sensor to VTO
Maybe you find some useful commands for your case with this tool

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