Dahua VTO custom integration

It’s shouldn’t be a problem if you use example from readme which use timer, just make sure that your event handler set it to duration which configured at VTO web interface (in example duration: 00:00:02 # VTO Unlock Period)

And make sure that lock connected to HomeKit in accessory mode, example:

  - name: HA Door Lock
    port: 55888 # Change it acording your system
    mode: accessory
    filter:
      include_entities:
        - lock.door_lock
    entity_config:
      lock.door_lock:
        name: Door Lock

Yes it’s is in accessory mode and I am fine with the duration and it’s working like charm in HA. My problem is with HomeKit. If I gave it a command to unlock the door, it stuck in unlocking state and waiting for a response that tell HomeKit the door is actually unlocked.

I think I know the problem, you should add optimistic: false to the lock:

lock:
  - platform: template
    name: Door Lock
    value_template: "{{ not is_state('timer.door_lock', 'active') }}"
    optimistic: false
    lock:
    unlock:
      - service: dahua_vto.open_door
        data_template:
          entity_id: sensor.dahua_vto
          channel: 1
          short_number: HA

I have added optimistic: false but I still have the same issue.

Should work, double check that your lock has value_template and optimistic: false and try to remove and add lock again to HomeKit.

May I ask why when logging into this plugin, it gave me only one entity? I have 8 cameras, how do I add the rest?

Thank you

This integration allow to control devices using DHIP protocol and receive events. Cameras you can connect to HA using generic RTSP integration or other like ONVIF.

Take a look into this integration it’s also creates entity for cameras.

If you need to add few VTO, here the example:

sensor:
  - platform: dahua_vto
    name: VTO1
    host: 192.168.1.11
  - platform: dahua_vto
    name: VTO2
    host: 192.168.1.12

This is the screenshot from my configuration.

Screen Shot 2021-11-03 at 6.50.22 PM

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