VTO2000A Rest API

Discussion in 'Dahua' started by blademckain, May 18, 2019.

Share This Page

  1. blademckain

    blademckain n3wb

    Joined:
    May 18, 2019
    Messages:
    4
    Likes Received:
    0
    Location:
    Italy
    Hello,
    I have this device:

    deviceinfo [1] = 8 .AlarmInputChannels
    deviceinfo [1] = 0 .AlarmOutputChannels
    deviceinfo [1] = VTO .DeviceClass
    deviceinfo [1] = .DeviceType VTO2000A
    deviceinfo [1] = 80 .HttpPort
    deviceinfo [1] = .protocol Dahua
    deviceinfo [1] = 0 .RemoteVideoInputChannels
    deviceinfo [1] = .Vendor General_Multi3
    deviceinfo [1] = .version 3.200.0000.0.R

    I would like to integrate it with my home automation system (OpenHab)
    I realized that to open the door I have to use:
    ../cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote

    But if I want to understand if someone has pressed the VTO button (someone ring at the door)
    how can I do?
     
  2. catcamstar

    catcamstar Getting comfortable

    Joined:
    Jan 28, 2018
    Messages:
    970
    Likes Received:
    589
    I looked for this couple of years ago when I bought my VTO2000A's, however I never integrated it as I do want to verify first (by hand) on iDMSS/gDMSS app before I open the doors (with that app).

    For visitors, I do have a VTH touchscreen installed, which also has the ability to open the door on screen.

    Looking back at my notes from back then, I had noted section 12.6.1 from https://s3.amazonaws.com/amcrest-files/Amcrest+HTTP+API+3.2017.pdf which has some kind of "sensemethod" to query the logs on "if" a button has been pressed "the last 10 seconds". For sure it will generate millions of polling requests.

    On the other hand, once I had that VTH installed, there are ways to use the included alarm-out (cfr https://shopdelta.eu/obrazki1/dhi-vth1550ch_img4_d.jpg) to hook up additional (external) bells, but you could eventually slip that alarm-out to your HAB server and go from there.

    So if you have a VTH, you might look into that direction too?

    Good luck!
    CC
     
  3. blademckain

    blademckain n3wb

    Joined:
    May 18, 2019
    Messages:
    4
    Likes Received:
    0
    Location:
    Italy
    Thx u
    But i have only the VTO
    i want use the DMSS app from the tablet insteat of the VTH

    i will try with the Query Alarm record but I'm not sure that pressing a button will generate alarm-type events
     
  4. catcamstar

    catcamstar Getting comfortable

    Joined:
    Jan 28, 2018
    Messages:
    970
    Likes Received:
    589
    Hi,

    I cross-checked with my VTO, you still have something like "Call History":
    [​IMG]

    Each "begin time" is at a button-press. So that API query should access these details.

    Take note: pressing the button will just "log an entry". Your HAB system needs to query the VTO to check if the button has been pressed. So the delay between each query is "time lost".

    Hope this helps!
    CC
     
  5. blademckain

    blademckain n3wb

    Joined:
    May 18, 2019
    Messages:
    4
    Likes Received:
    0
    Location:
    Italy
    Hello,

    thanks for the help but I can't find the right call to get that log


    I tried to search the event log with some commands but without success

    /cgi-bin/log.cgi?action=doFind&token=1&count=100

    always return
    found = 0


    /cgi-bin/recordFinder.cgi?action=find&name=AlarmRecord&StartTime=2014-8-25%2000:02:32&EndTime=2014-8-25%2001:02:32&count=500

    always return

    error
    ErrorID = 5, Detail = Server internal error!
     
  6. catcamstar

    catcamstar Getting comfortable

    Joined:
    Jan 28, 2018
    Messages:
    970
    Likes Received:
    589
    So I took some time to analyse this myself as I may need it later on in my home automation project too. The recordFinder script is good, but the AlarmRecord type is wrong.

    I tried this:

    http://<IP here>/cgi-bin/recordFinder.cgi?action=find&name=VideoTalkLog

    And voilà!

    You only need to parse that output and off you go!

    Good luck!
    CC
     
  7. blademckain

    blademckain n3wb

    Joined:
    May 18, 2019
    Messages:
    4
    Likes Received:
    0
    Location:
    Italy
    Thx U!!!
    unfortunately the VideoTalkLog is updated only after answering!


    I have also tried this project
    johnnyletrois/dahua-watch

    works also with VTO2000

    unfortunately pressing the VTO button does not generate any type of event :(((((

    I tried to readjust it using this URL
    URL_TEMPLATE = "http://{host}:{port}/cgi-bin/VideoTalkPeer.cgi?action=attachState"

    instead of
    URL_TEMPLATE = "http://{host}:{port}/cgi-bin/eventManager.cgi?action=attach&codes=%5B{events}%5D"

    but the API
    /cgi-bin/VideoTalkPeer.cgi?action=attachState
    return me

    [
    {
    "id" : 10001,
    "result" : 26536776,
    "session" : "f7cee2f3c3ea02a8976c08c9b6a40baa"
    },
    {
    "id" : 10002,
    "params" : {
    "CallID" : "123456"
    },
    "result" : true,
    "session" : "f7cee2f3c3ea02a8976c08c9b6a40baa"
    }
    ]

    and not update their status

    But from the API documentatios say
    12.1.1 Subscribe video talk status

    Params in Response: State: in range of {“Ringing”, “Inviting”, “Answer”, “Refuse”, “Cancel”, “Hangup”, “Busying” }
     
    Last edited: May 20, 2019
  8. mifrey

    mifrey n3wb

    Joined:
    Dec 20, 2018
    Messages:
    14
    Likes Received:
    5
    Location:
    Belgium
    Have you found a way?

    The only solution I have found with my VTO2111D-WP is described here Dahua VTO2111 notification to home automation system

    Well, the other solution I found is to install the SIP firmware and the PBX Asterisk on one of my Raspberry Pi. This is a bit more complex and it has other issues. You need to use a SIP client such as Linphone on Android to receive the calls but I have not found a way to see the video before answering the call in Linphone. However I found a way with Tasker: When I receive a call Tasker splits the screen then opens the HTTP url of the video stream in Chrome. Well, but that is another story... ;-)
     
    Last edited: Aug 10, 2019
  9. Gleneroo

    Gleneroo n3wb

    Joined:
    Jul 22, 2019
    Messages:
    22
    Likes Received:
    2
    Location:
    France
    Hello

    Relating to APIs, this is not for browsing the call history, but simply for unlocking the door:

    http://192.168.1.110/cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote

    For me, this works.

    I want to use it also in my own home automation system (e.g. when turning on the alarm, it is because we are going out, so open the door for x seconds).

    The problem left I have is, when running this URL in a browser, I am requested credentials. Is there a way to remove it (VTO doesn't seem to allow a blank account at user creation) or give them in the URL ? Everything I tried didn't work.

    Thank you
     
  10. catcamstar

    catcamstar Getting comfortable

    Joined:
    Jan 28, 2018
    Messages:
    970
    Likes Received:
    589
  11. Gleneroo

    Gleneroo n3wb

    Joined:
    Jul 22, 2019
    Messages:
    22
    Likes Received:
    2
    Location:
    France
  12. catcamstar

    catcamstar Getting comfortable

    Joined:
    Jan 28, 2018
    Messages:
    970
    Likes Received:
    589
  13. Gleneroo

    Gleneroo n3wb

    Joined:
    Jul 22, 2019
    Messages:
    22
    Likes Received:
    2
    Location:
    France
    It works perfectly!

    Thanks!

    Edit: Very nice, it is now integrated into my home automation system: whenever I turn on the alarm system (means we are leaving), it waits 20 seconds=time to go down the stairs, then unlocks the door for 20 seconds.
     
    Last edited: Aug 16, 2019
  14. Gleneroo

    Gleneroo n3wb

    Joined:
    Jul 22, 2019
    Messages:
    22
    Likes Received:
    2
    Location:
    France
    SIP s/w with Asterisk seems a great solution but as you said, quite more complex.
    I don't really like the other solution to continuously monitor traffic. It is also not simple.

    In VTO webservice, and also in VTH settings, I see it is possible to configure an additional VTH. It would get a signal in case of button press. I wonder if it could be possible to configure an extra fake VTH, which would be the home automation system. What do you think ?