Dahua VTO custom integration

Hi there. Does this integration work with Dahua 2 wire ip solution? I leave in an appartment and i have access only to the station unit (that has Wi-Fi)

As you use DNS name (pool.ntp.org), check if your VTO has DNS configured. Try to set specific NTP server IP (not DNS name) and check that this server works using any NTP Online tester like this.

When it revert to wrong time, it’s a completely wrong time? How it’s different from right time, wrong only hours or minutes also wrong?

It reverts to the +1 hour time.
I checked and my vto is using 8.8.8.8 and 8.8.4.4
About the NTP server method, do you mean I have to use my own hosted server? That might be tricky, I have one, but it needs to use specific port to access them.
Its weird that also have this behavior across my dahua cams, my hikvision cams dont have this issue btw.

Google DNS is ok, exactly +x hour looks like NTP sync working but problem with DST/Timezone.
Try to configure DST properly for your region (Begin/End time, see picture), try to turn off DST, try to change timezone to +6/+8, I think after experiments you will found right settings and understand what going on. Dahua cams/NVR/XVR has same settings like Dahua VTO you will fix it after you found the problem in VTO.

image

I tested using GMT+6 which is not actually my timezone so it’s a dirty workaround, it’s been stable for a day. Will monitor it…Really strange, the VTO was showing the correct time for almost 2 years then suddenly it’s out of sync.

I think I accidentally found the solution, in order to update the screen you can try to use commands o pageMain, o or rh, using service:

service: dahua_vto.send_command
data:
  entity_id: sensor.dahua_vth
  method: console.runCmd
  params: {'command': 'o pageMain'}
  event: false

Much easy to experiment with commands using DahuaConsole, full list of commands for my VTH5221D I put here. For my VTH it’s updates screen only when I send command o pageMain and in few seconds the command o. It’s updates alarm state but after this screen never goes to sleep :frowning: but I think different VTH firmware’s can have different behavior.

PS: Command example for connect to VTH using DahuaConsole:

./Console.py --rhost 192.168.1.x --rport 5000 --proto dhip --auth admin:password

As a password you should use pin code which you use for VTH settings.

Let’s us know if you find something interesting. :slight_smile:

Update: rh command reported as working for VTH1550CH link

I think I accidentally found the solution, you can try command ps <number>, for my VTH5221D ps 0 plays alarm sound, ps 1 doorbell sound and ps 2 phone ring sound. For stop playing issue command ps without parameters. More info about issuing command and list of commands you can find in post above.

Example:

service: dahua_vto.send_command
data:
  entity_id: sensor.dahua_vth
  method: console.runCmd
  params: {'command': 'ps 0'}
  event: false

I think I may have solved the time issue,
The web config is broken I think, I had to use Dahua config tool to set the DST and timezone to correct one, and so far it seems to be correct, its been an hour, with web config it would’ve changed already now.

I need an help, there is somethings wrong with my installation.
I set up the integration and apparently it works fine: i made the automation to read the event and i can see all ther events. But i have not the sensor.dahua_vto so i can do nothing via HA. I have not renamed the integration.
Some one can help me?
Tanks

In sensor.dahua_vto the dahua_vto it’s not from name of integration it’s from name of the sensor, if you name your sensor as Groud Floor you should look for sensor.groud_floor instead sensor.dahua_vto, etc

  - platform: dahua_vto
    name: Groud Floor
    ...
1 Like

I don’t know how i could be so stupid yesterday … :flushed:
Thank you

Hi @myhomeiot, i am not sure whats the cause, but over time the automation for ringing doorbell would stop working by itself. I cant get any more detailed than these… I think the fix would be restarting home assistant and the doorbell, though I’m not sure, since usually after outage it would be working again.
dahua firmware is the latest, just updated like 2-3 weeks ago.

Speaker is working , the other automation with speaker is still working, the speaker part for the automation is also working when tested.

alias: Dahua-VTO
description: ""
trigger:
  - platform: event
    event_type: dahua_vto
    event_data:
      Code: BackKeyLight
condition:
  - condition: template
    value_template: "{{ trigger.event.data.Data.State | int in [1, 2] }}"
action:
  - service: media_player.play_media
    target:
      entity_id: media_player.vlc_telnet
    data:
      media_content_id: media-source://media_source/media/Doorbell.mp3
      media_content_type: audio/mpeg
    metadata:
      title: Doorbell.mp3
      thumbnail: null
      media_class: music
      children_media_class: null
      navigateIds:
        - {}
        - media_content_type: app
          media_content_id: media-source://media_source
        - media_content_type: ""
          media_content_id: media-source://media_source/media/.
mode: restart


Everything look good, to be sure what happening you need to check which value has trigger.event.data.Data.State when automation is triggered, maybe something goes wrong with this.

Easy way to check, when this start happening go to Developer Tools → Events and start listen for dahua_vto events, press door bell and check which events you receives.

PS: In Dahua VTO web interface check what you have in System → Auto maintenance settings, if you have Never, set some day and time when it’s restarts for maintenance, maybe this helps.

Sorry for the super late reply, problem is sometimes its working sometimes its not,
just this morning it stops working again. but strangely after pressing twice it works again, it fires alot of events, so i’m trying to narrow down the events

Is this enough log to trace the cause?

Yes, VTO produce lot of events it’s normal. You should look only for BackKeyLight events and it’s State field. List of states with descriptions you can find here.

event_type: dahua_vto
data:
  Action: Pulse
  Code: BackKeyLight
  Data:
    LocaleTime: "2023-07-17 09:24:00"
    State: 0
    UTC: 1689560640

Hi
Is it possible to see which user opened the door in the unlock event so I can be notified of a specific user?
Sorry if this has been covered but I couldn’t find it.
Thanks

At least with mine, I can use the AccessControl events and if event.data.Data.Method == 1 then a card/nfc tag was used and event.data.Data.CardNo gives the ID of the card which can be matched with the IDs from the intercom’s web interface and then used to identify a person. There’s an example of how I use it in my (rather long) config here, around the middle of the first code block:

Hi
Thanks for your info. Yes I saw your post but I only use password to access. I have a rental property and basically would like to know when the cleaner is there. She has a code to enter so just want a notification on the event of her code… Would AccessControl events show a password ID? I have automations to listen to the dahua events but I haven’t seen AccessControl appearing in the logs…

This is what i see when a passcode is used to open the gate. Is there a way I can identify which passcode is used?

{'Action': 'Pulse', 'Code': 'AccessControl', 'Data': {'CardNo': '', 'CardType': None, 
'LocaleTime': '2023-08-05 18:55:37', 'Method': 0, 'Name': 'OpenDoor', 'Password': '', 
'ReaderID': '1', 'RecNo': 183, 'SnapURL': '', 'Status': 1, 'Type': 'Entry', 'UTC': 1691254537.0, 
'UserID': '8001'}, 'Index': 0, 'entity_id': 'sensor.front_gate'}

You have 'UserID': '8001' is it possible to have few passcode for one user? Or you can match passcode with this UserID?