Yet another VTO, Home Assistant, Kwikset, DahuaVTO2MQTT discussion

Jul 8, 2021
189
456
Oregon, USA
Apologies if this has been covered before - I did scan other DahuaVTO2MQTT posts...

We have Kwikset 916 Z-wave deadbolt locks that are managed by Home Assistant. We also have a Dahua VTO2311R-WP doorbell and three VTH2621GW-WP monitors.
There are numerous times when a friend rings the front doorbell (VTO) and we chat through the VTH and we want to unlock the front door deadbolt so they may enter
without us having to walk to the door. On the VTH touchscreen interface there is a small padlock icon for "unlocking" the door with the hardware interface available on
the VTO. Being unrelated, non-hardwired Z-wave devices, the Kwikset Z-wave deadbolts are not directly compatible with this system.

As is forum best practice, my IP cameras, VTO, and VTH's are all on an Internet isolated, separate subnet from the rest of the computers and devices in the house,
especially the Unraid server that hosts my Home Assistant instances. The only computer that can see both networks is the dual NIC Blue Iris machine. Therefore, the Blue Iris
machine is the only potential bridge between VTH events and the MQTT broker. Basically, I wanted to press the padlock icon on the VTH touchscreen and generate an event that
could be captured and converted to an MQTT topic by the DahuaVTO2MQTT app, and then sent to the MQTT broker so that a Home Assistant automation could listen for the
MQTT topic and unlock the Kwikset Z-wave deadbolt.

You are probably are thinking, "We know all this. Does this guy have a point????":rolleyes:

I am not sure why I made it so complicated in my mind, but in looking at the DahuaVTO2MQTT project, I realized that it is simply a Python application with only two dependencies and can be run
in Powershell with a trivial impact on the Blue Iris machine. After this realization, I had it running in 5 minutes and after checking the MQTT topics and payloads with MQTT Explorer, I had the
Home Assistant automation mostly working in a few more minutes.

If anyone is interested (and has not expired from boredom reading this), please let me know and I can follow-up with the steps for getting DahuaVTO2MQTT running under Powershell.
 
In case anyone is interested I finally got the Home Assistant Automation working for DahuaVTO2MQTT, my VTO and VTH's and
Kwikset 916 Z-Wave deadbolt locks.
  1. Press the "unlock" padlock icon on the VTH
  2. DahuaVT02MQTT detects the press and formats an MQTT topic: DahuaVTO/AccessControl/Event
    and payload:

    1677562334385.png
    (note that "Data.UserID" indicates the VTH used)

  3. Home Assistant Automation:

    Trigger:

    1677562455413.png

    Condition: (Use a Template Condition):

    1677562513139.png

    Action:

    1677562573128.png


 
  • Like
Reactions: Mike A.
I don't use Home Assistant, but looking at your screenshots, it seems like if you add the payload "OpenDoor" to the optional payload section of the trigger, you could drop the Template Condition completely. It least that is how I would expect it to work.....
 
Gotta say, HomeSeer is not so much in the script weeds as Home Assistant is, but both solutions are far superior to base offerings such as Vera or Smartthings.

Having to dip into scripts, due to how Home Assistant works, is a turn off for me. But I know that a lot of people like HA. If ever you get an itch to rework you install to a possibly more straightforward approach, check out HomeSeer. It is built around a very impressive event driven engine. It allows you to drop into script writing mode on a whim, and I have, but that is rarely necessary. Being a developer I wrote some scripts just to see how well it works..

I wrote rather simple scripts that allow BI and HomeSeer to communicate their state to each other dynamically. But that was just for fun, there are easy ways to accomplish that without scripts in HomeSeer.

I have numerous events that kick off when the Quikest lock is unlocked, opened, closed, keypad used, etc. Such a useful addition to home automation and security.
For example, when my back gate is opened or closed, I have two different PTZ’s that immediately swivel and zoom onto the gate.

Either way, I love home automation and think that the solution you have above seems like fun.
 
HA is a lot better as far as that goes in more recent versions. Much easier to do automations, et. al. from the interface now (as shown) vs having to drop down and write YAML (which I've always hated lol). I don't have the VTO, but the challenge here seems to be to get the MQTT message out of it. From there the rest can all be done in HA without any scripting. I can, for example, have a motion sensor trigger a cam or cam motion trigger a light and send a message to my phone or do whatever else pretty easily without any scripting required.
 
I don't use Home Assistant, but looking at your screenshots, it seems like if you add the payload "OpenDoor" to the optional payload section of the trigger, you could drop the Template Condition completely. It least that is how I would expect it to work.....
I'm simplifying here, but In Home Assistant, if the MQTT payload value is a "state", meaning a single value of some kind like "ON" or "OFF" that you can know,
then you can include that in the Trigger section of the interface as you suggest. However MQTT triggers with payloads that are JSON objects are
treated differently - you basically have to parse the JSON object with a template. My template is a trivial one that simply matches two attribute values, but
I've seen other examples that are lengthy, complicated scripts with variables and calculations.
 
Gotta say, HomeSeer is not so much in the script weeds as Home Assistant is, but both solutions are far superior to base offerings such as Vera or Smartthings.
...
I completely agree. I started out with a Wink controller and some Zigbee LED's! from a Lowe's clearance.
Oh boy.... :lol:

I don't remember exactly how or why I started using Home Assistant, but at times it has been no bed of roses.
As #Mike A. points out, in the early days of HA you had to muck with YAML and that could be as frustrating as
typing with a pencil in your mouth. My Home Assistant instances are hosted on Unraid VM's using the Home
Assistant OS and it has been orders of magnitude easier to manage in that configuration.
I will say that I had a friend say that using HomeSeer for home automation was analogous to using Blue Iris as
a NVR. You have to pay for it; it's powerful and takes an investment in learning; but it "just works", and there is
a lot to be said for that. :thumb:

Now that I think about, the learning curve has been pretty steep for both home automation and IP cameras! :wtf:
 
HA is a lot better as far as that goes in more recent versions. Much easier to do automations, et. al. from the interface now (as shown) vs having to drop down and write YAML (which I've always hated lol). I don't have the VTO, but the challenge here seems to be to get the MQTT message out of it. From there the rest can all be done in HA without any scripting. I can, for example, have a motion sensor trigger a cam or cam motion trigger a light and send a message to my phone or do whatever else pretty easily without any scripting required.
Good point. The Home Assistant interface has radically improved over the last few years. To me, the most frustrating/infuriating part of Home
Assistant was Z-wave support. It has improved by leaps and bounds with the new Z-Wave integration. There is nothing that will make you blow
a gasket faster than making some change and losing all your Z-wave devices! :angry:

As I noted in my original post, I'm not sure why I over complicated the installation of DahuaVTO2MQTT. Somehow in my mind I was convinced
that it could only be run in a Docker - not sure why I thought that? Being both dumb and not reading carefully is as good an explanation as any.
Here it is running with almost no impact on the Blue Iris machine in a Powershell:

1677614858733.png
 
Now that I think about, the learning curve has been pretty steep for both home automation and IP cameras! :wtf:

Very similar in that way. I saw someone who runs HA post looking for somebody to do a turn-key install of BI for them. My response was doesn't really work like that. Really need to go into it expecting to put much time in learning it yourself for either if you're going to be running it. You can get a basic initial setup running fairly quickly but that's just the very beginning.

Yeah, I still wince a little every time I go to hit the button to update the Z-Wave and Zigbee integrations. ; )
 
  • Haha
Reactions: dmcIPCAM
I'm simplifying here, but In Home Assistant, if the MQTT payload value is a "state", meaning a single value of some kind like "ON" or "OFF" that you can know,
then you can include that in the Trigger section of the interface as you suggest. However MQTT triggers with payloads that are JSON objects are
treated differently - you basically have to parse the JSON object with a template. My template is a trivial one that simply matches two attribute values, but
I've seen other examples that are lengthy, complicated scripts with variables and calculations.

That makes sense. Thanks for clarifying..... :thumb:
 
  • Like
Reactions: looney2ns
Hi dmc,
Hey do you think something similar could be done to have HA know when the VTO button is pressed? Then I could have HA ring the doorbell. I don't have a VTH.
Thanks!


Apologies if this has been covered before - I did scan other DahuaVTO2MQTT posts...

We have Kwikset 916 Z-wave deadbolt locks that are managed by Home Assistant. We also have a Dahua VTO2311R-WP doorbell and three VTH2621GW-WP monitors.
There are numerous times when a friend rings the front doorbell (VTO) and we chat through the VTH and we want to unlock the front door deadbolt so they may enter
without us having to walk to the door. On the VTH touchscreen interface there is a small padlock icon for "unlocking" the door with the hardware interface available on
the VTO. Being unrelated, non-hardwired Z-wave devices, the Kwikset Z-wave deadbolts are not directly compatible with this system.

As is forum best practice, my IP cameras, VTO, and VTH's are all on an Internet isolated, separate subnet from the rest of the computers and devices in the house,
especially the Unraid server that hosts my Home Assistant instances. The only computer that can see both networks is the dual NIC Blue Iris machine. Therefore, the Blue Iris
machine is the only potential bridge between VTH events and the MQTT broker. Basically, I wanted to press the padlock icon on the VTH touchscreen and generate an event that
could be captured and converted to an MQTT topic by the DahuaVTO2MQTT app, and then sent to the MQTT broker so that a Home Assistant automation could listen for the
MQTT topic and unlock the Kwikset Z-wave deadbolt.

You are probably are thinking, "We know all this. Does this guy have a point????":rolleyes:

I am not sure why I made it so complicated in my mind, but in looking at the DahuaVTO2MQTT project, I realized that it is simply a Python application with only two dependencies and can be run
in Powershell with a trivial impact on the Blue Iris machine. After this realization, I had it running in 5 minutes and after checking the MQTT topics and payloads with MQTT Explorer, I had the
Home Assistant automation mostly working in a few more minutes.

If anyone is interested (and has not expired from boredom reading this), please let me know and I can follow-up with the steps for getting DahuaVTO2MQTT running under Powershell.
 
Hi dmc,
Hey do you think something similar could be done to have HA know when the VTO button is pressed? Then I could have HA ring the doorbell. I don't have a VTH.
Thanks!
This is a quick and dirty answer but, yes, it appears that the VTO provides an MQTT topic and payload when the doorbell's button is pressed:

Topic: DahuaVTO/Invite/Event
Payload:

1681146215127.png

so the "Value template" in Home Assistant would be something like:

{{ trigger.payload_json.Code == 'Invite' and trigger.payload_json.Data.UserID == '9901' }}

Depending on what you would like the automation to do, the trigger.payload_json.Data.UserID == '9901'
part might not be necessary, but it would ensure that the "invite" came from a particular VTO (I have two, for example 9901 is
the front doorbell and 9902 is the garage side door doorbell.)
 
Hi, does this VTO-2311 thing detect you pressing the bell button on the mqtt? HOW? It doesn't work for me at all.
I agree that it can be quite confusing. Please see in post #8 of this thread the discussion of the utility called DahuaVTO2MQTT which
"listens" for ONVIF events sent by the VTO (the video doorbell). One of the type of events it detects is when someone presses a button
on the doorbell itself or one of the connected VTH's (wall mounted video touchscreens). When a button is pressed, DahuaVTO2MQTT
sends an MQTT topic and payload, and the payload has information about which button was pressed, for example.
Home Assistant is subscribed ("listening") to that MQTT topic (DahuaVTO/Invite/Event) and parses the payload which
is a JSON object. If a particular JSON object value matches some value that the automation is checking for then the automation
opens the deadbolt using a Z-wave request.

Please see Elad Bar / DahuaVTO2MQTT · GitLab

Easy, huh? :rofl:
 
Here's a diagram - might help:

1703992845849.png
 
  • Like
Reactions: rolly
Personally, I installed this add-on through HACS (I'm running HA Container with Docker on a Raspberry pi 4B), it doesn't need MQTT and directly creates sensors and controls in HA.

1000004878.png

My VTH2621GW-WP is set to do not disturb from 8:30pm to 6:00am. So I'm using an automation to detect button press on my VTO2311R-WP, and this enables an alert on our phones only during the night.
And thanks to Tasker and Auto notification apps, I can also control the DMSS app to only receive the calls on my phone when nobody's home.
 
  • Like
Reactions: dmcIPCAM