Dahua VTO to MQTT Broker

A year ago someone suggested to have a list of known working devices, anyone that is using that docker can add his/her unit,
I’m not controling it so that’s the main reason why the list doesn’t contain all supported devices (given by the fact there were 6k downloads without the addons I guess there are much more models supported),
Anyway, it should work with any vto unit

Docker contains a logic of restore connection, the addon should support it as well with latest version 1.0.13, but i cannot fix any issue with system i don’t own

To sum it up, better to use the docker version

1 Like

Thanks @bar for the support! We understand that’s not easy to keep all things working for everyone.

1 Like

You are using a x86 image in arm

I’m using VTO2202FP to control the gate status by a reed contact connected to gnd and door_feedback ports. Everything seems to work fine if I check the door status by calling API exposed by vto.

http://192.168.xxx.yyy/cgi-bin/accessControl.cgi?action=getDoorStatus&channel=1

Info.status=Close

By API, I always get the expected gate status.
On the contrary, on dahuavto2mqtt add-on log very often the Close DoorStatus event is missing and accordingly also the related mqtt binary sensor I defined in HA, doesn’t reflect the real state of the gate.
The below log show the expected sequence of event when I open and close the gate. As I said very often the Close event is missing.

2021-02-24 23:29:16,120 INFO __main__ Publishing MQTT message DahuaVTO/DoorStatus/Event: {'Action': 'Pulse', 'Code': 'DoorStatus', 'Data': {'LocaleTime': '2021-02-24 23:29:15', 'Status': 'Open', 'UTC': 1614205755.0}, 'Index': 0}
2021-02-24 23:30:23,547 INFO __main__ Publishing MQTT message DahuaVTO/DoorStatus/Event: {'Action': 'Pulse', 'Code': 'DoorStatus', 'Data': {'LocaleTime': '2021-02-24 23:30:22', 'Status': 'Close', 'UTC': 1614205822.0}, 'Index': 0}

Any idea on what is causing this behaviour?
Thanks.

if someone is interested, or if @bar is interested, here is my stalled PR where by adding a single line of code, it would make it possible to have the events of cameras and doorbells (dahua and amcrest) directly on the bus of HA (thus having the possibility to use them directly in automations).

The PR is stalled because the HA developers require that the amcrest component be updated first by entering the config_flow (and therefore without going through the configurator.yaml).
Unfortunately, for personal reasons I don’t have so much time to dedicate to it, but the PR already contains the code necessary to have the events of the dahua devices directly on the HA event bus.

2 Likes

Hi. I just started using Dahua VTO and this docker. It works great.

May I know is it possible to use MQTT to change the Villa Call No.?

The reason is, I want the VTO to call different number when I am not at home.

Hi
I want to buy this model:

Is it Ok to integrate it with home assistant?. Just want to be sure that it’s totally functional to this system.

Thanks in advance.

I add some more details on my issue hoping that @bar or someone else can help. I noticed that sometimes is the “Open” DoorStatus event that is missing,
Here is the last log.
Where I should see Open “DoorStatus/Event”, I see instead “DahuaVTO/ProfileAlarmTransmit/Event” with ‘AlarmType’=‘DoorMagnetism’ and "DahuaVTO/DoorControl/Event:

2021-03-01 14:33:01,302 INFO __main__ Publishing MQTT message DahuaVTO/ProfileAlarmTransmit/Event: {'Action': 'Start', 'Code': 'ProfileAlarmTransmit', 'Data': {'AlarmType': 'DoorMagnetism', 'DevSrcType': 'Digit', 'LocaleTime': '2021-03-01 14:33:01', 'SenseMethod': 'DoorMagnetism', 'UTC': 1614609181, 'UserID': 'Door'}, 'Index': 5, 'deviceType': 'VTO2202F', 'serialNumber': '*****'}
2021-03-01 14:33:01,304 INFO __main__ Publishing MQTT message DahuaVTO/DoorControl/Event: {'Action': 'Pulse', 'Code': 'DoorControl', 'Data': {'LocaleTime': '2021-03-01 14:33:01', 'UTC': 1614605581.0}, 'Index': 0, 'deviceType': 'VTO2202F', 'serialNumber': '*****'}

The Close “DoorStatus/Event” in this case is present:

2021-03-01 14:34:13,510 INFO __main__ Publishing MQTT message DahuaVTO/DoorStatus/Event: {'Action': 'Pulse', 'Code': 'DoorStatus', 'Data': {'LocaleTime': '2021-03-01 14:34:12', 'Status': 'Close', 'UTC': 1614605652.0}, 'Index': 0, 'deviceType': 'VTO2202F', 'serialNumber': '*****'}

I can confirm that when I check the door status by calling API exposed by VTO, the state I get is always consistent with the real situation of the gate:

http://192.168.xxx.yyy/cgi-bin/accessControl.cgi?action=getDoorStatus&channel=1

Info.status=Close

Any idea on why sometimes MQTT messages are missing?

Add-on version: 1.0.13
Operating System: Home Assistant OS 5.11
Home Assistant Core: core-2021.2.3
Home Assistant Supervisor: supervisor-2021.02.11

Thanks

I’ve got one question. Is this docker compatible with Home Assistant Supervised running on Raspberry PI4? The container doesn’t start and I get message in the log:

standard_init_linux.go:219: exec user process caused: exec format error,

Hi,

I tested again and I the problerm was that the admin dahua password was wrong. Blame me, but the issue is that there was a loop to the mqtt connection.
Perhap’s it would be good to exit the mqtt connection code if the dahua connection fails.

Hi bar,
I have a Mul-T-Lock ENTR too. Curious in how you connected and what functionality you integrated into HA. Can you elaborate a bit more?

I ordered with the mul-t-lock additional remote, removed its cover and connected it to a relay (will add screenshot later)

Ah. And then you are able to open the door via HA…?
I would be interested in status of the door (open/closed), and logs (who opened the door and when).

@bar there is error with ssl when you use https for communication. Fix is easy - I pushed patch to your repository. Tested and works when there is redirect from http to https … but not tested without ssl (http)

2021-03-17 20:38:53,958 DEBUG main MQTT Message DahuaVTO/Command/Open: b’0’,
2021-03-17 20:38:53,959 DEBUG main Access Control - Open door,
2021-03-17 20:38:53,967 DEBUG urllib3.connectionpool Starting new HTTP connection (1): 192.168.1.201:80,
2021-03-17 20:38:53,978 DEBUG urllib3.connectionpool http://192.168.1.201:80 “GET /cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote HTTP/1.1” 302 114,
2021-03-17 20:38:53,987 DEBUG urllib3.connectionpool Starting new HTTPS connection (1): 192.168.1.201:443,
/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host ‘192.168.1.201’. Adding certificate verification is strongly advised. See: Advanced Usage - urllib3 2.2.1 documentation,
warnings.warn(,
2021-03-17 20:38:54,126 DEBUG urllib3.connectionpool https://192.168.1.201:443 “GET /cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote HTTP/1.1” 401 0,
2021-03-17 20:38:54,132 DEBUG urllib3.connectionpool Resetting dropped connection: 192.168.1.201,
/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host ‘192.168.1.201’. Adding certificate verification is strongly advised. See: Advanced Usage - urllib3 2.2.1 documentation,
warnings.warn(,
2021-03-17 20:38:54,257 DEBUG main Data received: {‘id’: 3, ‘method’: ‘client.notifyEventStream’, ‘params’: {‘SID’: 513, ‘eventList’: [{‘Action’: ‘Pulse’, ‘Code’: ‘BackKeyLight’, ‘Data’: {‘LocaleTime’: ‘2021-03-17 21:38:54’, ‘State’: 8, ‘UTC’: 1616013534.0}, ‘Index’: -1}]}, ‘session’: 694695060},
2021-03-17 20:38:54,258 INFO main Publishing MQTT message DahuaVTO/BackKeyLight/Event: {‘Action’: ‘Pulse’, ‘Code’: ‘BackKeyLight’, ‘Data’: {‘LocaleTime’: ‘2021-03-17 21:38:54’, ‘State’: 8, ‘UTC’: 1616013534.0}, ‘Index’: -1, ‘deviceType’: ‘DHI-VTO2211G-WP’, ‘serialNumber’: ‘6K09E31PAJ2A38A’},
2021-03-17 20:38:54,260 DEBUG urllib3.connectionpool https://192.168.1.201:443 “GET /cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote HTTP/1.1” 200 4,
2021-03-17 20:38:54,269 INFO main Access Control - Door was opened,

Can anyone tell me if this version works well with HA, please?

I’m waiting a response to order it. Thanks!

Hi,

Yes I’m using the addon with this DAHUA VTO2202F P.

Thanks joffrey. And is it giving you problems or is it working fine?

I had some problems at the beginning but now it’s working fine (thanks to the last updates).
I’m only using call button event.

I forked @bar repo and added/fixed 2 functions:

  • HTTPs enabled VTO device should work now (anyway it was used only to “Open” doors)
  • Added support for 2nd door lock - not tested

TOPIC: [MQTT_BROKER_TOPIC_PREFIX]/Command/Open
Payload:
- “1” - 1st Door
- “2” - 2nd Door

https://github.com/NimlothPL/DahuaVTO2MQTT

HA entity - Door 1:

type: 'custom:button-card'
icon: 'mdi:gate'
name: Door 1
tap_action:
  action: call-service
  service: mqtt.publish
  service_data:
    payload: 1
    topic: DahuaVTO/Command/Open

HA entity - Door 2:

type: 'custom:button-card'
icon: 'mdi:gate'
name: Door 2
tap_action:
  action: call-service
  service: mqtt.publish
  service_data:
    payload: 2
    topic: DahuaVTO/Command/Open

If someone confirms that works, then maybe @bar will update his repo so I can remove mine :slight_smile: