Announcement

Collapse
No announcement yet.

noob alert. dahuavto2mqtt to mcsMQTT. How to get Dahua doorbell as a HS device.

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

    noob alert. dahuavto2mqtt to mcsMQTT. How to get Dahua doorbell as a HS device.

    Hey guys,

    I'm just not sure how to get this done. I'm trying with no success.

    In short, I'm running docker for windows and using the dahuavto2mqtt app to post to HS mcsMQTT
    https://community.home-assistant.io/...-broker/169781
    https://github.com/elad-bar/DahuaVTO2MQTT
    Using the guide info from here https://blog.quindorian.org/2020/08/...tant-nvr.html/

    I'm seeing the topic appear in the mcsMQTT association's table just not sure how to turn it into an HS device and have this device change its status when the doorbell is rung.

    For Hass.io according to this blog, it should report off the following values.

    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"


    from the windows docker powershell cli I can see below when the doorbell is rung.

    dahuavto2mqtt | Event Call from VTO
    Code:
    dahuavto2mqtt | Event Call from VTO
    dahuavto2mqtt | MQTT message published, Topic: DahuaVTO/CallNoAnswered/Event, Payload: {"Action":"Start","Data":{"CallID":"1","IsEncryptedStream":f alse,"LocaleTime":"2020-09-14 16:32:51","LockNum":2,"SupportPaas":false,"TCPPort":37777,"U TC":1600065171,"UserID":"9901"}}
    dahuavto2mqtt | Event: Invite, Action , CallID 1 Lock Number 2
    dahuavto2mqtt | MQTT message published, Topic: DahuaVTO/Invite/Event, Payload: {"Action":"Pulse","Data":{"CallID":"1","IsEncryptedStream":f alse,"LocaleTime":"2020-09-14 16:32:51","LockNum":2,"SupportPaas":false,"TCPPort":37777,"U TC":1600065171,"UserID":"9901"}}
    dahuavto2mqtt | Event BackKeyLight with State 1
    dahuavto2mqtt | MQTT message published, Topic: DahuaVTO/BackKeyLight/Event, Payload: {"Action":"Pulse","Data":{"LocaleTime":"2020-09-14 16:32:51","State":1,"UTC":1600065171}}
    dahuavto2mqtt | Event BackKeyLight with State 2
    dahuavto2mqtt | MQTT message published, Topic: DahuaVTO/BackKeyLight/Event, Payload: {"Action":"Pulse","Data":{"LocaleTime":"2020-09-14 16:32:51","State":2,"UTC":1600065171}}
    Any guidance, please? Took me a few days to get the docker working. I'm new to all this
    Attached Files

    #2
    It looks to me as if you have four HS child devices (2842 to 2845) and their parent 2841 that are located at Floor DahuaVTo and Room BackKeyLight. The messages from dahuavto2mqtt are event oriented rather than value oriented. It may be that Device 2842 (State) have values that correlate to something about the doorbell, but I did not see definitions.

    I assume the reason you want a HS device to reflect a doorbell is so you can trigger and event when the doorbell is rung. If this is the case then you will likely be better off using MQTT Receive Event Triggers as described in Section 6.7 of the mcsMQTT manual. These are used as the trigger part of a HS event and will be MQTT Receive with Topic DahuaVTO/BackKeyLight/Event with a Payload of Pulse

    If you want to use the device as a trigger then assure that Device 2844 has a Control/Status UI of Button. You do this be clicking on the 2844 button to bring up the Edit tab. Select the Button radio on the Control/Status UI. This should show a VSP row value that includes Pulse with a likely value of 0. mcsMQTT will store this value in Device 2844 each time the Pulse Action message is received.

    If you want Device 2844 to show a Pulse for only a specific duration such as 10 seconds then use a HS Event triggered on either the MQTT Receive or Device 2844 going to Pulse (0). The event action is to wait 10 seconds and set Device 2844 to 1. To set this up in mcsMQTT click on the 2844 button on Associate tab. On the Control/Status UI select Button if it has not already been selected. On the VSP row see it it has one or two entries to represent each of the two states. If it only has one then add a second such as Quiet=1. This assumes that Pulse=0 already exists. Sections 6.1 and 14.3.3 are references for this process.

    Yet another approach is to use Device 2843. Confirm on the Edit tab that it's Control/Status UI is Number or NumberChange. Each time a new doorbell event message is received it will update the time of the event in Device 2843. You would use a change in value of Device 2843 as your event trigger to know then the doorbell button was pressed.

    Comment


      #3
      many thanks Michael it's taking me a while to work out I'm nearly at the home stretch.

      I set the following event for topic DahuaVTO/# wildcard to turn on my Doorbell virtual button as a test.

      If I restart the plugin I can see the event will trigger, I then turn off the virtual doorbell button and wait 1 minute for the next mqtt log but the event will not run again? I expect from the log below where the SipRegisterResult runs every minute I expect that event to run every minute as well? I've also changed the event to send me a pushover message for testing.

      Not sure what I'm missing?

      Thanks Michael.


      Click image for larger version

Name:	image_93576.jpg
Views:	103
Size:	44.6 KB
ID:	1419354

      a partial paste of the log. While the doorbell is idle I can see these MQTT msgs every minute.

      Code:
      Date":"15-09-2020 20:21:09","LocaleTime":"2020-09-15 20:21:09","Success":true,"UTC":1600165269}}
      dahuavto2mqtt | keepAlive back
      dahuavto2mqtt | Event SIPRegisterResult, Success
      dahuavto2mqtt | MQTT message published, Topic: DahuaVTO/SIPRegisterResult/Event, Payload: {"Action":"Pulse","Data":{"Date":"15-09-2020 20:22:09","LocaleTime":"2020-09-15 20:22:09","Success":true,"UTC":1600165329}}
      dahuavto2mqtt | keepAlive back
      dahuavto2mqtt | Event SIPRegisterResult, Success
      dahuavto2mqtt | MQTT message published, Topic: DahuaVTO/SIPRegisterResult/Event, Payload: {"Action":"Pulse","Data":{"Date":"15-09-2020 20:23:09","LocaleTime":"2020-09-15 20:23:09","Success":true,"UTC":1600165389}}
      dahuavto2mqtt | keepAlive back
      dahuavto2mqtt | Event SIPRegisterResult, Success
      dahuavto2mqtt | MQTT message published, Topic: DahuaVTO/SIPRegisterResult/Event, Payload: {"Action":"Pulse","Data":{"Date":"15-09-2020 20:24:09","LocaleTime":"2020-09-15 20:24:09","Success":true,"UTC":1600165449}}

      Comment


        #4
        Your setup looks like it should work.
        Look at the HS Log. Event triggers are normally recorded in that log.
        mcsMQTT has a log, enabled from the General tab near the top. The data goes into \Data\mcsMQTT\mcsMQTT Debug.txt. The contents following each "AcoOnMessageForTrigger" are the trigger results.

        Comment


          #5
          Hey Michael,

          Got it working thank you!

          As I'm new to all this including Docker I did not realise I was running a few docker mosquitto containers in the background. I thought docker containers I had to start on every reboot. Even the dahuavto2mqtt container was up and running in the background and I was opening cli and running the docker compose command after reboot.

          I removed all the misquitto containers and mcsMQTT started receiving the Dahua MQTT msgs like clock work.

          Its updating the following device ID as well. I can see payload state of 0 equals = off but I can see from the logs while the Doorbell is ringing the state can be anywhere from 1-9.

          I'm guessing the way I have the device configured below is close to right?

          Thank you for your help!

          Click image for larger version  Name:	2020-09-18_9-22-57.jpg Views:	0 Size:	316.8 KB ID:	1419958

          Click image for larger version  Name:	2020-09-18_9-25-46.jpg Views:	0 Size:	160.4 KB ID:	1419959



          Code:
          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


            #6
            This looks fine. You man want a more friendly name on the Edit tab for your HS device name. You also have the option to use List rather than Number for Control/Status UI if you know what the non-zero values all mean. You would need to setup on the Edit tab the VSP lines for each of the values. I suspect what you have is what you need, however. You can also edit the graphic form HS Devices/DeviceUtility from a light bulb to a door open (open.png) or door closed (zonerestored.png) graphic.

            Comment

            Working...
            X