Announcement

Collapse
No announcement yet.

Dahua doorbell api post to HS when someone rings doorbell.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Dahua doorbell api post to HS when someone rings doorbell.

    Hey guys.

    Just got me a Dahua DHI-VTO2202F-P kit.

    I find the gDMSS app is crap and having all sorts of issues view saved video messages.

    I would like to VTO to send a command to HS when someone rings the doorbell. That way I can trigger Blueiris and other events/notifications.

    Has anyone done any work around this? The only thing I find was from https://community.home-assistant.io/...-broker/169781

    I've found the Dahua API documentation but unsure if its possible.

    Cheers





    #2
    I am not familiar with this doorbell but is it using a traditional gong? If so, there are some people that use a door switch build into the gong to detect when the doorbell was pressed. I made the mistake of not installing a traditional gong because I thought the SkyBell is integrating with Alexa. It does not!!! So I ended up having to add an Arduino to check the voltage. Together with the Arduino plugin I now have it all integrated in HS but it was a pain and earned me a lot of mockery for not having a working doorbell for quite some time. Anyways, the trick with the door sensor seems most reasonable.

    Comment


      #3
      Its got the following ports. I don't think the chime option is available.

      This guy was able to get it done with Home assistant. I'm not a programmer but wondering how hard it would be to port over to HS.
      https://youtu.be/GbkCuT4qHbA?t=682

      https://www.dahuasecurity.com/asset/...t_20191228.pdf

      ALARM_NO: Switch quantity output.
      ALARM_COM: Switch quantity output.
      DOOR_BUTTON: Unlock button.
      DOOR_FEEDBACK: Door contact feedback.
      DOOR_NC: Connected to access controller to control door locks.
      DOOR_COM: Connected to access controller to control door locks.
      DOOR_NO: Connected to access controller to control door locks.

      Comment


        #4
        It looks to me like the guy in the video is using additional hardware linked to HomeAssistant to recognize the Alarm output of the VTO. Do you have any input/output type devices already attached to Homeseer? Such as Levition Omni or Elk MK1

        Comment


          #5
          I've got Elk M1, He's using a ESP32 development board to a relay running ESPHome. That's what he's using for traditional gong/chime.

          Comment


            #6
            So cant you use the ALARM outputs on the VTO to connect to a contact closure on your ELK and then the Homeseer plug-in for the ELK panel will change its device value allowing you to trigger what you wish?

            Comment


              #7
              I think the ALARM output is for when someone triggers the VTO tamper switch. If you take the VTO out of the surface mount it makes an alarm sound. I "think" that will trigger the alarm output which will trigger your home security alarm if wired up.

              I want the Dahua doorbell to trigger when someone presses the button to HS3

              It's hard trying to find detailed documentation on this doorbell. I think its quite new.

              Comment


                #8
                I did some research into this, since triggering events/ringing a door chime is on my wishlist for a POE video doorbell
                Dahua has a published API. Someone has converted that to MQTT.

                Docker which runs PHP code that listens to events from Dahua VTO unit and publishes them via MQTT Message,
                In order to make it work with HA you will need to to listen to the specific topic and handle with one of the approaches below:
                • HA automation
                • NodeRED

                https://community.home-assistant.io/...-broker/169781

                seems like a lot of moving parts... In a cursory search I was unable to locate the API, but I wonder if it might simplify setup to use it directly.

                HS4 Pro on Shuttle NC10U, Win10; Z-NET
                Number of Devices: 449
                Number of Events: 210

                Plug-Ins: Arduino, BLLock, DirecTv, EasyTrigger, Honeywell WiFi Thermostat, MeiHarmonyHub, PHLocation2, Pushover 3P, UltraM1G3, WeatherXML, Worx Landroid, Z-Wave

                External applications: Homebridge-homeseer, Geofency, EgiGeoZone.

                Comment


                  #9
                  I've got the api doc if you need it.

                  Could you run the docker with https://github.com/elad-bar/DahuaVTO2MQTT and use Homeseer mcsMQTT to trigger an event/virtual device?

                  Comment


                    #10
                    Originally posted by Duc998 View Post
                    I've got the api doc if you need it.

                    Could you run the docker with https://github.com/elad-bar/DahuaVTO2MQTT and use Homeseer mcsMQTT to trigger an event/virtual device?
                    I don't see why not. Node Red also now works with HS4 so you have all the necessary components.
                    HS4 Pro on Shuttle NC10U, Win10; Z-NET
                    Number of Devices: 449
                    Number of Events: 210

                    Plug-Ins: Arduino, BLLock, DirecTv, EasyTrigger, Honeywell WiFi Thermostat, MeiHarmonyHub, PHLocation2, Pushover 3P, UltraM1G3, WeatherXML, Worx Landroid, Z-Wave

                    External applications: Homebridge-homeseer, Geofency, EgiGeoZone.

                    Comment


                      #11
                      I'll give it a go, Not really good at this side of things so bear with me.

                      I've got a Pi2 running as a Z-Net. I've installed Docker, mosquitto mqtt, PHP, and git cloned https://github.com/elad-bar/DahuaVTO2MQTT.

                      I'd like to get my Pi2 to monitor the Dahua eventlog via MQTT and send to mcsMQTT on HS

                      Have to work out how to setup the mosquito with the following. I pulled it from this link but its all for Hass.io
                      https://blog.quindorian.org/2020/08/...tant-nvr.html/

                      I'm sure I'll get the MQTT config and Dahua VTO2MQTT config done by editing the required file. The part I wont be sure about
                      is how to mcsMQTT addon to pick it up and add it as a device.

                      MQTT Configuration

                      logins:
                      - username: '!secret mqtt_user'
                      password: '!secret mqtt_pass'
                      anonymous: false
                      customize:
                      active: false
                      folder: mosquitto
                      certfile: fullchain.pem
                      keyfile: privkey.pem
                      require_certificate: false

                      Dahua VTO2MQTT Add-on

                      Repository: https://github.com/elad-bar/DahuaVTO2MQTT

                      intercom:
                      host: '!secret dahuavto_ip'
                      username: '!secret dahuavto_user'
                      password: '!secret dahuavto_pass'
                      mqtt:
                      host: '!secret ha_ip'
                      port: '1883'
                      username: '!secret mqtt_user'
                      password: '!secret mqtt_pass'
                      topic_prefix: DahuaVTO

                      Home Assistant Configuration.yaml file

                      binary_sensor:
                      - platform: mqtt
                      name: "Doorbell Button State"
                      state_topic: 'DahuaVTO/BackKeyLight/Event'
                      value_template: '{{ value_json.Data.State }}'
                      payload_on: "1"
                      payload_off: "0"

                      Comment


                        #12
                        Originally posted by Duc998 View Post
                        I've got the api doc if you need it.
                        Yes. Show it please. Maybe there is even more elegant way to do it.

                        Comment


                          #13
                          Got it all working now.

                          In a nutshell I ran the following, Cannot remember every step in detail but if you struggle let me know. As mentioned this was all new to me
                          and took me a while to figure out and I still don't 100% understand everything that I've done 😁

                          For anyone experienced in docker please correct me if I'm run on some of my steps below.

                          Originally I tried to get this all running from my ZNet Raspberry Pi2 but in the end, I found it may be only compiled for AMD64 systems?
                          • Install Docker for Windows ( Installed on same windows PC running HS3)
                          • Install HS mcsMQTT plugin
                          • Run powershell cli admin to run the commands below.
                          • Install PHP for docker. Cant remember if this was already installed.
                          • git clone https://github.com/elad-bar/Dahua.git ~/Dahua
                            • This will place the dahuavto2mqtt in Dahua directory "c:\users\username\Dahua" directory if c:\users\username is your current dir.
                          • create yaml file which I called vtorun.yaml

                            DAHUA_VTO_HOST = IP Address of VTO
                            DAHUA_VTO_USERNAME = VTO web username
                            DAHUA_VTO_PASSWORD = VTO web password

                            For mcsMQTT broker I'm not using a username and password so I removed these lines.
                          Code:
                          version: '2'
                          services:
                          dahuavto2mqtt:
                          image: "eladbar/dahuavto2mqtt:latest"
                          container_name: "dahuavto2mqtt"
                          hostname: "dahuavto2mqtt"
                          restart: always
                          environment:
                          - DAHUA_VTO_HOST=vto-host
                          - DAHUA_VTO_USERNAME=Username
                          - DAHUA_VTO_PASSWORD=Password
                          - MQTT_BROKER_HOST=mqtt-host
                          - MQTT_BROKER_PORT=1883
                          - MQTT_BROKER_USERNAME=Username
                          - MQTT_BROKER_PASSWORD=Password
                          - MQTT_BROKER_TOPIC_PREFIX=DahuaVTO
                          • Run the yaml file which I believe creates a docker container
                            • docker-compose -f vtorun.yaml up
                          • I believe once the container is created it will always autostart with Windows startup. This bit took me a while to figure out as I was always starting power cli and running the docker-compose -f vtorun.yaml up command after windows boot.
                          • Go to mcsMQTT plugin statistics page. You should start seeing DahuaVTO/* in the Last received topic field. This confirms everything is setup correctly and its now time to associate the DahuaVTO/BackKeyLight/Event
                          • In mcsMQTT Associations tab follow the screenshot below to Associate the DahuaVTO|BackKeyLight|Event topic with a HS device ID
                            Click image for larger version  Name:	2020-09-18_14-14-22.jpg Views:	0 Size:	119.3 KB ID:	1420004
                          • Edit the HS device ID and in Status Graphics I put
                            • 0 = Off
                            • 1 - 100 = On.

                          When the doorbell is pressed seem to see different payload states of anywhere between 1-9. From a snippet of the dahuavto2mqtt log I can see the following. From what I know a State of 0 = off and a State of 1 - 9 is On? Still need to work it out but at least I get a instant response when the doorbell is pressed.

                          Now I can trigger events when the Doorbell is rung. Doorbell will change to ON status when rung. Then changes to Off status if the call is not answered.

                          Click image for larger version

Name:	image_93646.jpg
Views:	450
Size:	24.0 KB
ID:	1420007

                          Snippet of the dahuavto2mqtt when the doorbell is rung.

                          18/09/2020 8:57:07 AM 235952 | ManageNewMessage DahuaVTO/BackKeyLight/Event
                          18/09/2020 8:57:07 AM 235952 | ActoOnMessageForTrigger Topic DahuaVTO/BackKeyLight/Event,Payload={"Action":"Pulse","Data":{"LocaleTime":"2020-09-18 08:57:08","State":1,"UTC":1600383428}}, Triggers=6
                          18/09/2020 8:57:07 AM 235952 | Triggered1=True
                          18/09/2020 8:57:07 AM 235952 | HSEvent VALUE_CHANGE| 1024| DahuaVTO/BackKeyLight/Event| 1| 0| 2886
                          18/09/2020 8:57:07 AM 235952 | TriggerFire DahuaVTO/BackKeyLight/Event={"Action":"Pulse","Data":{"LocaleTime":"2020-09-18 08:57:08","State":1,"UTC":1600383428}}, EventID=57
                          18/09/2020 8:57:07 AM 235952 | Triggered1=True
                          18/09/2020 8:57:07 AM 235953 | TriggerFire DahuaVTO/BackKeyLight/Event={"Action":"Pulse","Data":{"LocaleTime":"2020-09-18 08:57:08","State":1,"UTC":1600383428}}, EventID=65
                          18/09/2020 8:57:07 AM 235957 | ProcessMessage New DahuaVTO/BackKeyLight/Event
                          18/09/2020 8:57:07 AM 235957 | Update Accepted 2886 to 2 StatusType=2 Payload= 2 RegExValue=2
                          18/09/2020 8:57:07 AM 235958 | Updating Device from 1 PayloadNumeric=True nValue=2
                          18/09/2020 8:57:07 AM 235959 | HSEvent VALUE_CHANGE| 1024| DahuaVTO/BackKeyLight/Event| 2| 1| 2886
                          18/09/2020 8:57:07 AM 235959 | ManageNewMessage DahuaVTO/BackKeyLight/Event
                          18/09/2020 8:57:07 AM 235959 | ActoOnMessageForTrigger Topic DahuaVTO/BackKeyLight/Event,Payload={"Action":"Pulse","Data":{"LocaleTime":"2020-09-18 08:57:08","State":2,"UTC":1600383428}}, Triggers=6
                          18/09/2020 8:57:07 AM 235959 | Triggered1=True
                          18/09/2020 8:57:07 AM 235959 | TriggerFire DahuaVTO/BackKeyLight/Event={"Action":"Pulse","Data":{"LocaleTime":"2020-09-18 08:57:08","State":2,"UTC":1600383428}}, EventID=57
                          18/09/2020 8:57:07 AM 235959 | Triggered1=True
                          18/09/2020 8:57:07 AM 235960 | TriggerFire DahuaVTO/BackKeyLight/Event={"Action":"Pulse","Data":{"LocaleTime":"2020-09-18 08:57:08","State":2,"UTC":1600383428}}, EventID=65
                          18/09/2020 8:57:07 AM 236119 | ProcessMessage New DahuaVTO/NewFile/Event
                          18/09/2020 8:57:07 AM 236119 | ManageNewMessage DahuaVTO/NewFile/Event
                          18/09/2020 8:57:07 AM 236119 | ActoOnMessageForTrigger Topic DahuaVTO/NewFile/Event,Payload={"Action":"Pulse","Data":{"File":"\/mnt\/sd\/SnapShot\/Call\/9901\/2020-09-18\/08\/57\/08[SVTO8001][0@0][0].jpg","Filter":"\/mnt\/sd\/SnapShot\/Call\/9901\/","LocaleTime":"2020-09-18 08:57:08","Size":52798,"UTC":1600383428}}, Triggers=6
                          18/09/2020 8:57:07 AM 236164 | ProcessMessage New DahuaVTO/UpdateFile/Event
                          18/09/2020 8:57:07 AM 236164 | ManageNewMessage DahuaVTO/UpdateFile/Event
                          18/09/2020 8:57:07 AM 236164 | ActoOnMessageForTrigger Topic DahuaVTO/UpdateFile/Event,Payload={"Action":"Pulse","Data":{"LocaleTime":"2020-09-18 08:57:08","UTC":1600383428}}, Triggers=6
                          18/09/2020 8:57:08 AM 237020 | ProcessMessage New DahuaVTO/SIPRegisterResult/Event
                          18/09/2020 8:57:08 AM 237020 | Update Accepted 2880 to true StatusType=2 Payload= true RegExValue=true
                          18/09/2020 8:57:08 AM 237022 | Updating Device from 0 PayloadNumeric=False nValue=0
                          18/09/2020 8:57:39 AM 268087 | ProcessMessage New DahuaVTO/BackKeyLight/Event
                          18/09/2020 8:57:39 AM 268087 | Update Accepted 2886 to 6 StatusType=2 Payload= 6 RegExValue=6
                          18/09/2020 8:57:39 AM 268088 | Updating Device from 2 PayloadNumeric=True nValue=6
                          18/09/2020 8:57:39 AM 268090 | HSEvent VALUE_CHANGE| 1024| DahuaVTO/BackKeyLight/Event| 6| 2| 2886
                          18/09/2020 8:57:39 AM 268090 | ManageNewMessage DahuaVTO/BackKeyLight/Event
                          18/09/2020 8:57:39 AM 268090 | ActoOnMessageForTrigger Topic DahuaVTO/BackKeyLight/Event,Payload={"Action":"Pulse","Data":{"LocaleTime":"2020-09-18 08:57:40","State":6,"UTC":1600383460}}, Triggers=6
                          18/09/2020 8:57:39 AM 268090 | Triggered1=True
                          18/09/2020 8:57:39 AM 268090 | TriggerFire DahuaVTO/BackKeyLight/Event={"Action":"Pulse","Data":{"LocaleTime":"2020-09-18 08:57:40","State":6,"UTC":1600383460}}, EventID=57
                          18/09/2020 8:57:39 AM 268090 | Triggered1=True
                          18/09/2020 8:57:39 AM 268091 | TriggerFire DahuaVTO/BackKeyLight/Event={"Action":"Pulse","Data":{"LocaleTime":"2020-09-18 08:57:40","State":6,"UTC":1600383460}}, EventID=65
                          18/09/2020 8:57:47 AM 276090 | ProcessMessage New DahuaVTO/BackKeyLight/Event
                          18/09/2020 8:57:47 AM 276090 | Update Accepted 2886 to 0 StatusType=2 Payload= 0 RegExValue=0
                          18/09/2020 8:57:47 AM 276092 | Updating Device from 6 PayloadNumeric=True nValue=0
                          18/09/2020 8:57:47 AM 276096 | ManageNewMessage DahuaVTO/BackKeyLight/Event
                          18/09/2020 8:57:47 AM 276096 | ActoOnMessageForTrigger Topic DahuaVTO/BackKeyLight/Event,Payload={"Action":"Pulse","Data":{"LocaleTime":"2020-09-18 08:57:48","State":0,"UTC":1600383468}}, Triggers=6
                          18/09/2020 8:57:47 AM 276096 | Triggered1=True
                          18/09/2020 8:57:47 AM 276096 | HSEvent VALUE_CHANGE| 1024| DahuaVTO/BackKeyLight/Event| 0| 6| 2886
                          18/09/2020 8:57:47 AM 276096 | TriggerFire DahuaVTO/BackKeyLight/Event={"Action":"Pulse","Data":{"LocaleTime":"2020-09-18 08:57:48","State":0,"UTC":1600383468}}, EventID=57
                          18/09/2020 8:57:47 AM 276096 | Triggered1=True
                          18/09/2020 8:57:47 AM 276097 | TriggerFire DahuaVTO/BackKeyLight/Event={"Action":"Pulse","Data":{"LocaleTime":"2020-09-18 08:57:48","State":0,"UTC":1600383468}}, EventID=65

                          Comment

                          Working...
                          X