elad-bar / DahuaVTO2MQTT

Listens to events from Dahua VTO unit and publishes them via MQTT Message
103 stars 39 forks source link

Replace HTTP(S) open door call with call over TCP socket. #47

Open rbrouwer opened 3 years ago

rbrouwer commented 3 years ago

It is possible to send the door open command using the TCP socket as well.

This can be done by first issueing a "accessControl.factory.instance" command with params:

request_data = {
    "Channel": 0
}

In the response there will be a "result"-field, which contains the accessControl-object (in my testing an integer). This result object should be saved, so it can be used when issuing a open/close lock command.

The open/close door/lock command is "accessControl.openDoor"/"accessControl.closeDoor" with params:

request_data = {
    "DoorIndex": door_index,
    "Type": "",
    "UserID": "",
}

When issuing such a command, your message_data should also include the accessControl-instance in the "object" field.

Working sample code can be found in my Domoticz plug-in.