GithubHelp home page GithubHelp logo

dahuavto2mqtt's Introduction

DahuaVTO2MQTT

Listens to events from Dahua VTO, Camera, NVR unit and publishes them via MQTT Message

Repository moved to GitLab

Latest code and docker image available under the GitLab repo:

https://gitlab.com/elad.bar/DahuaVTO2MQTT

dahuavto2mqtt's People

Contributors

arcidodo avatar dudu631 avatar elad-bar avatar phil-nelson avatar rroller avatar spartan-ii-117 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dahuavto2mqtt's Issues

I can't add the repository

20-10-29 18:27:11 INFO (MainThread) [supervisor.store.git] Cloning add-on https://github.com/elad-bar/DahuaVTO2MQTT repository
20-10-29 18:27:13 ERROR (MainThread) [supervisor.utils.json] Can't read json from /data/addons/git/71317b4c/repository.json: [Errno 2] No such file or directory: '/data/addons/git/71317b4c/repository.json'
20-10-29 18:27:13 ERROR (MainThread) [supervisor.store] https://github.com/elad-bar/DahuaVTO2MQTT is not a valid add-on repository.
20-10-29 18:27:13 INFO (MainThread) [supervisor.store.git] Removing custom add-on repository https://github.com/elad-bar/DahuaVTO2MQTT

error: substring not found, Line: 400

Hi
I am getting an error, when I use my fingerprint reader on my VTO4202F. Can you help me figer out what the problem is?

2022-05-31 21:13:57,663 ERROR clients.DahuaClient Failed to read data: b' \x00\x00\x00DHIP\x8b \x9a/\x08\x00\x00\x00\xeb\x00\x00\x00\x00\x00\x00\x00\xeb\x00\x00\x00\x00\x00\x00\x00{"id":8,"method":"client.notifyEventStream","params":{"SID":513,"eventList":[{"Action":"Pulse","Code":"SIPRegisterResult","Data":{"LocaleTime":"2022-05-31 21:11:51","Success":false,"UTC":1654027911.0},"Index":0}]},"session":798630027}\n \x00\x00\x00DHIP\x8b \x9a/\x08\x00\x00\x00\xd5\x00\x00\x00\x00\x00\x00\x00\xd5\x00\x00\x00\x00\x00\x00\x00{"id":8,"method":"client.notifyEventStream","params":{"SID":513,"eventList":[{"Action":"Start","Code":"VideoMotion","Data":{"LocaleTime":"2022-05-31 21:12:26","UTC":1654027946.0},"Index":0}]},"session":798630027}\n \x00\x00\x00DHIP\x8b \x9a/\x08\x00\x00\x00\xe1\x00\x00\x00\x00\x00\x00\x00\xe1\x00\x00\x00\x00\x00\x00\x00{"id":8,"method":"client.notifyEventStream","params":{"SID":513,"eventList":[{"Action":"Pulse","Code":"BackKeyLight","Data":{"LocaleTime":"2022-05-31 21:12:26","State":9,"UTC":1654027946.0},"Index":-1}]},"session":798630027}\n \x00\x00\x00DHIP\x8b \x9a/\x08\x00\x00\x00\xed\x00\x00\x00\x00\x00\x00\x00\xed\x00\x00\x00\x00\x00\x00\x00{"id":8,"method":"client.notifyEventStream","params":{"SID":513,"eventList":[{"Action":"Pulse","Code":"FingerPrintCheck","Data":{"FingerPrintID":-1,"LocaleTime":"2022-05-31 21:12:26","UTC":1654027946.0},"Index":0}]},"session":798630027}\n \x00\x00\x00DHIP\x8b \x9a/\x08\x00\x00\x00{\x01\x00\x00\x00\x00\x00\x00{\x01\x00\x00\x00\x00\x00\x00{"id":8,"method":"client.notifyEventStream","params":{"SID":513,"eventList":[{"Action":"Pulse","Code":"AccessControl","Data":{"CardNo":"","CardType":null,"ErrorCode":16,"LocaleTime":"2022-05-31 21:12:26","Method":6,"Name":"OpenDoor","Password":"","ReaderID":"1","RecNo":116,"SnapURL":"","Status":0,"Type":"Entry","UTC":1654027946.0,"UserID":""},"Index":0}]},"session":798630027}\n \x00\x00\x00DHIP\x8b \x9a/\x08\x00\x00\x00\xd4\x00\x00\x00\x00\x00\x00\x00\xd4\x00\x00\x00\x00\x00\x00\x00{"id":8,"method":"client.notifyEventStream","params":{"SID":513,"eventList":[{"Action":"Stop","Code":"VideoMotion","Data":{"LocaleTime":"2022-05-31 21:12:32","UTC":1654027952.0},"Index":0}]},"session":798630027}\n \x00\x00\x00DHIP\x8b \x9a/\x08\x00\x00\x00\xeb\x00\x00\x00\x00\x00\x00\x00\xeb\x00\x00\x00\x00\x00\x00\x00{"id":8,"method":"client.notifyEventStream","params":{"SID":513,"eventList":[{"Action":"Pulse","Code":"SIPRegisterResult","Data":{"LocaleTime":"2022-05-31 21:12:49","Success":false,"UTC":1654027969.0},"Index":0}]},"session":798630027}\n \x00\x00\x00DHIP\x8b \x9a/\x08\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00{"id":8,"method":"client.notifyEventStream","params":{"SID":513,"eventList":[{"Action":"Pulse","Code":"NTPAdjustTime","Data":{"Address":"185.122.238.196","Before":"31-05-2022 21:13:22","LocaleTime":"2022-05-31 21:13:22","UTC":1654028002.0,"result":true},"Index":0}]},"session":798630027}\n \x00\x00\x00DHIP\x8b \x9a/\x08\x00\x00\x00\xeb\x00\x00\x00\x00\x00\x00\x00\xeb\x00\x00\x00\x00\x00\x00\x00{"id":8,"method":"client.notifyEventStream","params":{"SID":513,"eventList":[{"Action":"Pulse","Code":"SIPRegisterResult","Data":{"LocaleTime":"2022-05-31 21:13:47","Success":false,"UTC":1654028027.0},"Index":0}]},"session":798630027}\n', error: substring not found, Line: 400

Doesn't recover after doorbell loses power/reboots

I'm not sure if this can be fixed, but currently when power is cut to the doorbell or it reboots, the script will read "ERROR main server closed the connection" and "WARNING asyncio socket.send() raised exception." It will keep repeating the second warning until the docker container is reset, even if the doorbell comes back online. This causes the code to fail weekly when the doorbell does its reboot. Is there a way to have this fail gracefully, and re-attempt the connection? Otherwise everything works perfectly, great job with this!

Home Assistant integration plugin

Since you already ported your gateway to Python is it will be a great idea to have regular Home Assistant integration?
Sure MQTT gateway can be used by different home automation systems, but specially for Home Assistant the integration plugin will be much easy to use.

One more question: I have Dahua VTO and as I can see from documentation I can have doorbell sensor, the question is, using this gateway I can only receive events from VTO or can send commands as well? I'm interesting to send command to open the lock.
Thanks in advance!

Cannot get Docker version working

Hi,
I was having issues installing the add-on so I have had a go at installing the docker version using Portainer but I cannot get it to work. Clearly I’ve done something wrong but I cannot figure out what. The mqtt broker seems to report that the connection keeps timing out and no messages are actually published. Can you tell me what I’ve done wrong?

This is what the container log says:

2020-10-31 04:09:22 <*** Dahua VTO Event Listener START ***>,
2020-10-31 04:09:22 DahuaVTOAPI::SetDeviceDetails Device Type: VTO2000A,
2020-10-31 04:09:22 DahuaVTOAPI::SetDeviceDetails Serial Number: 5D049E4PAZ36C28,
2020-10-31 04:09:22 DahuaVTOEventListener::Login Started,
2020-10-31 04:09:22 DahuaVTOEventListener::Login Completed successfully,
2020-10-31 04:09:22 DahuaVTOEventListener::KeepAlive Started keepAlive thread,
2020-10-31 04:09:22 DahuaVTOEventListener::KeepAlive keepAlive back,
2020-10-31 04:09:23 MQTTManager::connect Connecting,
2020-10-31 04:09:23 MQTTManager::publish Published topic 'DahuaVTO/RtspSessionDisconnect/Event', message: {"Action":"Start","Data":{"Device":"::ffff:192.168.86.254","LocaleTime":"2020-10-31 14:09:22","StreamType":"Main","UTC":1604117362,"UserAgent":" Rtsp Client/3.0"},"deviceType":"VTO2000A","serialNumber":"5D049E4PAZ36C28"},
2020-10-31 04:10:23 DahuaVTOEventListener::KeepAlive keepAlive back,
2020-10-31 04:11:04 MQTTManager::connect Connecting,
2020-10-31 04:11:04 MQTTManager::publish Published topic 'DahuaVTO/TimeChange/Event', message: {"Action":"Pulse","Data":{"BeforeModifyTime":"31-10-2020 14:11:04","LocaleTime":"2020-10-31 14:11:04","ModifiedTime":"31-10-2020 14:11:04","UTC":1604117464},"deviceType":"VTO2000A","serialNumber":"5D049E4PAZ36C28"},
2020-10-31 04:11:04 MQTTManager::connect Connecting,
2020-10-31 04:11:04 MQTTManager::publish Published topic 'DahuaVTO/NTPAdjustTime/Event', message: {"Action":"Pulse","Data":{"Address":"time.google.com","Before":"31-10-2020 14:11:02","LocaleTime":"2020-10-31 14:11:04","UTC":1604117464,"result":true},"deviceType":"VTO2000A","serialNumber":"5D049E4PAZ36C28"},
2020-10-31 04:11:25 DahuaVTOEventListener::KeepAlive keepAlive back,
2020-10-31 04:12:25 DahuaVTOEventListener::KeepAlive keepAlive back,
2020-10-31 04:13:25 DahuaVTOEventListener::KeepAlive keepAlive back,
2020-10-31 04:14:25 DahuaVTOEventListener::KeepAlive keepAlive back,
2020-10-31 04:15:25 DahuaVTOEventListener::KeepAlive keepAlive back,

And the log from the mqtt broker says:

1604117363: New connection from 172.30.33.10 on port 1883.
[INFO] found mqtt_user on Home Assistant
1604117363: New client connected from 172.30.33.10 as dahua-vto-dahuavto (p1, c1, k10, u'mqtt_user').
1604117379: Client dahua-vto-dahuavto has exceeded timeout, disconnecting.
1604117435: Saving in-memory database to /data/mosquitto.db.
1604117464: New connection from 172.30.33.10 on port 1883.
1604117464: New client connected from 172.30.33.10 as dahua-vto-dahuavto (p1, c1, k10, u'mqtt_user').
1604117464: Client dahua-vto-dahuavto disconnected.
1604117464: New connection from 172.30.33.10 on port 1883.
1604117464: New client connected from 172.30.33.10 as dahua-vto-dahuavto (p1, c1, k10, u'mqtt_user').
1604117480: Client dahua-vto-dahuavto has exceeded timeout, disconnecting.
1604117764: New connection from 172.30.33.10 on port 1883.
[INFO] found mqtt_user on Home Assistant
1604117765: New client connected from 172.30.33.10 as dahua-vto-dahuavto (p1, c1, k10, u'mqtt_user').
1604117765: Client dahua-vto-dahuavto disconnected.
1604117765: New connection from 172.30.33.10 on port 1883.
1604117765: New client connected from 172.30.33.10 as dahua-vto-dahuavto (p1, c1, k10, u'mqtt_user').
1604117781: Client dahua-vto-dahuavto has exceeded timeout, disconnecting.

Unlocking magnetic lock #1 at every container start and MQTT reconnect

Hi,

I am using your great project in an docker container on a Synology NAS. I have a Dahua VTO4202 with two Lockes, second lock connected to the DEE1010B.

When starting the container lock #1 is always automatically unlocked, didn´t know why and how to prevent:
Fortunately there is nothing connected to lock#1, just to lock#2. But I have a voice announcement that the door gets open.

Log at startup:
2021-08-24 13:20:27,856 INFO main Connecting
2021-08-24 13:20:27,867 INFO main Initializing MQTT Broker
2021-08-24 13:20:27,868 INFO main MQTT Broker is trying to connect...
2021-08-24 13:20:27,873 INFO main MQTT Broker connected with result code 0
2021-08-24 13:20:27,922 INFO main Get access control configuration
2021-08-24 13:20:27,923 INFO main Get version
2021-08-24 13:20:27,924 INFO main Get serial number
2021-08-24 13:20:27,924 INFO main Get device type
2021-08-24 13:20:27,925 INFO main Attach event manager
2021-08-24 13:20:27,944 INFO main Version: 4.500.0000001.0.R, Build Date: 2021-07-13
2021-08-24 13:20:27,996 INFO main Hold time: 3
2021-08-24 13:20:28,076 INFO main Access Control - Unlocked magnetic lock #1
2021-08-24 13:20:29,883 INFO main Access Control - Door #1 is already unlocked, ignoring request
2021-08-24 13:20:31,158 INFO main Access Control - Locked magnetic lock #1

After some time, often at night I seems to have disconnects to my MQTT Broker, at every disconnect its starting again unlocking Lock#1:

2021-08-24 04:25:55,357 INFO main MQTT Broker got disconnected, trying to reconnect...
2021-08-24 04:25:55,361 INFO main MQTT Broker connected with result code 0
2021-08-24 04:25:55,564 INFO main Access Control - Unlocked magnetic lock #1
2021-08-24 04:25:57,371 INFO main Access Control - Door #1 is already unlocked, ignoring request
2021-08-24 04:25:58,654 INFO main Access Control - Locked magnetic lock #1
2021-08-24 04:27:41,242 INFO main MQTT Broker got disconnected, trying to reconnect...
2021-08-24 04:27:41,247 INFO main MQTT Broker connected with result code 0
2021-08-24 04:27:41,452 INFO main Access Control - Unlocked magnetic lock #1
2021-08-24 04:27:43,256 INFO main Access Control - Door #1 is already unlocked, ignoring request
2021-08-24 04:27:44,580 INFO main Access Control - Locked magnetic lock #1
2021-08-24 04:28:57,822 INFO main MQTT Broker got disconnected, trying to reconnect...
2021-08-24 04:28:57,826 INFO main MQTT Broker connected with result code 0
2021-08-24 04:28:58,030 INFO main Access Control - Unlocked magnetic lock #1
2021-08-24 04:28:59,837 INFO main Access Control - Door #1 is already unlocked, ignoring request
2021-08-24 04:29:01,128 INFO main Access Control - Locked magnetic lock #1
[...]

On Debug mode I can see MQTT Message DahuaVTO/Command/Open, but its not getting from my Broker (tried with fresh installed mosquitto with any publishing)

2021-08-24 13:28:34,334 DEBUG main MQTT Message DahuaVTO/Command/Open:
2021-08-24 13:28:34,335 INFO main Access Control - Unlocked magnetic lock #1

Any Idea whats wrong? Before I had used your Scripts as Addons inside HomeAssistant VM, there wasn´t any output about unlocking lock#1.

Thanks in advanced!

PHP Notice: fwrite(): send of X bytes failed with errno=32 Broken pipe in

After few messages arriving MQTT broker communication stops and "PHP Notice: fwrite(): send of X bytes failed with errno=32 Broken pipe in" appears in the log. App started manualy: "php -f DahuaEventHandler.php", environment set as required, system: ubuntu, Home Assistant runs in docker.

<*** Dahua VTO Event Listener START ***>
Device Type: VTO2000A-2
Serial Number: xxxxxxxxxxxxxxxx
PHP Notice: Undefined offset: 1 in /home/krzysiek/Dahua/DahuaEventHandler.php on line 509
Start login
Login success
Started keepAlive thread
keepAlive back
Event Manager subscription reply
Event SIPRegisterResult, Success
MQTT message published, Topic: DahuaVTO/SIPRegisterResult/Event, Payload: {"Action":"Pulse","Data":{"Date":"18-10-2020 17:26:19","LocaleTime":"2020-10-18 17:26:19","Success":true,"UTC":1603038379},"deviceType":"VTO2000A-2","serialNumber":"xxxxxxxxxxxxxxxx"}
Event TimeChange, BeforeModifyTime: 18-10-2020 17:26:49, ModifiedTime: 18-10-2020 17:26:48
MQTT message published, Topic: DahuaVTO/TimeChange/Event, Payload: {"Action":"Pulse","Data":{"BeforeModifyTime":"18-10-2020 17:26:49","LocaleTime":"2020-10-18 17:26:49","ModifiedTime":"18-10-2020 17:26:48","UTC":1603038409},"deviceType":"VTO2000A-2","serialNumber":"xxxxxxxxxxxxxxxx"}
Event NTPAdjustTime with 200.160.0.8 success
MQTT message published, Topic: DahuaVTO/NTPAdjustTime/Event, Payload: {"Action":"Pulse","Data":{"Address":"200.160.0.8","Before":"18-10-2020 17:26:48","LocaleTime":"2020-10-18 17:26:49","UTC":1603038409,"result":true},"deviceType":"VTO2000A-2","serialNumber":"xxxxxxxxxxxxxxxx"}
keepAlive back
Event SIPRegisterResult, Success
PHP Notice: fwrite(): send of 3 bytes failed with errno=32 Broken pipe in /home/krzysiek/Dahua/phpMQTT.php on line 270
PHP Notice: fwrite(): send of 216 bytes failed with errno=32 Broken pipe in /home/krzysiek/Dahua/phpMQTT.php on line 271

Installed version 1.0.8 - We are so sorry, but something went terribly wrong when starting or running this add-on.

Now installed 1.0.8. so now a thing for this repo? Still errors :-(

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing...
Add-on: DahuaVTO2MQTT
Listens to events from Dahua VTO unit and publishes them via MQTT Message
Add-on version: 1.0.8
There is an update available for this add-on!
Latest add-on version: null
Please consider upgrading as soon as possible.
parse error: Expected string key before ':' at line 1, column 4
[17:51:29] ERROR: Unknown HTTP error occured
System: (armv7 / raspberrypi4)
Home Assistant Core: 0.116.4
Home Assistant Supervisor: 2020.10.0
Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing...
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[17:51:31] INFO: Staring Dahua to MQTT
2020-10-31 16:51:31 <*** Dahua VTO Event Listener START ***>
PHP Fatal error: Uncaught Error: Call to undefined function curl_init() in /app/DahuaVTO.php:106
Stack trace:
#0 /app/DahuaVTO.php(91): DahuaVTOAPI->SetDeviceDetails()
#1 /app/DahuaVTO.php(179): DahuaVTOAPI->DahuaVTOAPI()
#2 /app/DahuaVTO.php(9): DahuaVTOEventListener->DahuaVTOEventListener()
#3 {main}
thrown in /app/DahuaVTO.php on line 106
[cmd] /bin/ash exited 255
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 99-message.sh: executing...
Oops! Something went wrong.
We are so sorry, but something went terribly wrong when
starting or running this add-on.

Be sure to check the log above, line by line, for hints.
[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

Need some help in order to use this over the portainer

Hello To all

I'm trying to use this in the portainer over the integration in to Home Assistant, but I'm a new user and I nedd some help or a little tutorial to install and use this.

Can anyone please help me in order to put this to work ?

Thank you in advance for your help I appreciate

Door sensor for sliding gate, alarm if door is opened more than x minutes.

Hi, sometimes people in my house forget to close the sliding gate,
and i'd like to sound alarm whenever gate is open more than x minutes.
Is this possible? I've tested with my dahua VTO2202F-P-S2, paired with door sensor (NC)
while it does send warning to my phone through dmss app, ("door contact" warning).
It doesn't sound any alarm to my phone (only notification sound) and it's not looping
Also i didn't buy their VTH, cause the thing is, i'm using my own windows based viewing station,
and i hope i could also sound alarm from there so that people in my house could be warned if the gate is not closed..

Event to open 2nd door ?

With VTO2202F I can open 2 doors. The event Command/Open works for the 1st door, but what is the event to trigger the 2nd door opening ?

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

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.

Error when disconnected from MQTT

Version used: Docker Image (latest)

When it disconnects from the MQTT Broker, it fails to reconnect until I restart the container.

Usually when I restart home assistant server.

2021-04-27 13:48:28,073 INFO __main__ MQTT Broker got disconnected trying to reconnect


2021-04-27 13:48:28,074 INFO __main__ MQTT Broker got disconnected trying to reconnect


2021-04-27 13:48:28,074 INFO __main__ MQTT Broker got disconnected trying to reconnect


2021-04-27 13:48:29,214 INFO __main__ MQTT Broker got disconnected trying to reconnect


2021-04-27 13:48:29,214 INFO __main__ MQTT Broker got disconnected trying to reconnect


2021-04-27 13:48:29,214 INFO __main__ MQTT Broker got disconnected trying to reconnect


2021-04-27 13:48:29,214 INFO __main__ MQTT Broker got disconnected trying to reconnect


2021-04-27 13:50:56,646 INFO __main__ Connecting


2021-04-27 13:50:56,680 INFO __main__ Connecting MQTT Broker


2021-04-27 13:50:56,680 ERROR __main__ Failed to handle message, error: [Errno 111] Connection refused, Line: 177


2021-04-27 15:10:31,152 INFO __main__ Connecting


2021-04-27 15:10:31,226 INFO __main__ Connecting MQTT Broker


2021-04-27 15:10:31,227 ERROR __main__ Failed to handle message, error: [Errno 111] Connection refused, Line: 177


2021-04-27 17:05:50,197 INFO __main__ Connecting


2021-04-27 17:05:50,274 INFO __main__ Connecting MQTT Broker


2021-04-27 17:05:50,275 ERROR __main__ Failed to handle message, error: [Errno 111] Connection refused, Line: 177


2021-04-28 17:50:36,197 INFO __main__ Connecting


2021-04-28 17:50:36,264 INFO __main__ Connecting MQTT Broker


2021-04-28 17:50:36,459 INFO __main__ MQTT Broker connected with result code 0

How to add multiple intercoms

I Have a VTO doorbell and face recognition access control. I want to configure both of these devices together. I tried configuring one device at a time; both devices are supported. So I tried to configure both devices to run together but it didn't work. These are the two configurations I tried:

configuration 1.

intercom:

  • host: 192.168.1.184
    username:
    password:
  • host: 192.168.1.183
    username:
    password:
    mqtt:
    host: core-mosquitto
    port: '1883'
    username:
    password: ''
    topic_prefix: DahuaVTO

configuration 2.

intercom:

  • host: 192.168.1.184
    username:
    password:
  • host: 192.168.1.183
    username:
    password:
    mqtt:
  • host: core-mosquitto
    port: '1883'
    username:
    password: ''
    topic_prefix: DahuaVTO
  • host: core-mosquitto
    port: '1883'
    username:
    password: ''
    topic_prefix: DahuaASI

I get this error:
Failed to save add-on configuration, Invalid dict for option 'intercom' in DahuaVTO2MQTT (26703e67_dahuavto2mqtt).

Fatal Error on Start up (raspberrypi4-64)

Hi,

The addon works fine on my tinker board. However on my new Raspberry 4 I get the following log:
(The mqtt server is up and running in the rasp 4)

Any ideas ?

"

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing...

Add-on: DahuaVTO2MQTT
Listens to events from Dahua VTO unit and publishes them via MQTT Message

Add-on version: 1.0.5
There is an update available for this add-on!
Latest add-on version: null
Please consider upgrading as soon as possible.
parse error: Expected string key before ':' at line 1, column 4
[23:18:15] ERROR: Unknown HTTP error occured
System: (aarch64 / raspberrypi4-64)
Home Assistant Core: 0.116.2
Home Assistant Supervisor: 247

Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.

[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing...
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[23:18:17] INFO: Staring Dahua to MQTT
<*** Dahua VTO Event Listener START ***>
PHP Fatal error: Uncaught Error: Call to undefined function curl_init() in /app/DahuaVTO.php:492
Stack trace:
#0 /app/DahuaVTO.php(46): DahuaVTOEventListener->SetDeviceDetails()
#1 /app/DahuaVTO.php(42): DahuaVTOEventListener->init_mqtt()
#2 /app/DahuaVTO.php(8): DahuaVTOEventListener->DahuaVTOEventListener()
#3 {main}
thrown in /app/DahuaVTO.php on line 492
[cmd] /bin/ash exited 255
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 99-message.sh: executing...

            Oops! Something went wrong.

We are so sorry, but something went terribly wrong when
starting or running this add-on.

Be sure to check the log above, line by line, for hints.

[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

"

Error after instalation

I installed the repository and the addon and i get the following erros on load.

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: DahuaVTO2MQTT
 Listens to events from Dahua VTO unit and publishes them via MQTT Message
-----------------------------------------------------------
 **Add-on version: 1.0.5
 There is an update available for this add-on!
 Latest add-on version: null
 Please consider upgrading as soon as possible.
parse error: Expected string key before ':' at line 1, column 4
[15:51:14] ERROR: Unknown HTTP error occured**
 System:   (amd64 / qemux86-64)
 Home Assistant Core: 0.112.4
 Home Assistant Supervisor: 228
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------

After the log shows that the addon connected to the device and i have MQTT messages on the MQTT broker.
I dont have any binary_sensors nor services to open doors and to get incoming calls from the VTO.

Add compatibility with VTO2202F-P

Hello. Thank you for yout add-on. Can you add compatibility with VTO2202F-P? I think VTO2202F-P is very similar to VTO2000A.
Regards.

Button (Entity) to open the door

Hello all

I just need some help in order to get a button (Entity) to open the door over the home assistant I Try to use this information

TOPIC: [MQTT_BROKER_TOPIC_PREFIX]/Command/Open

But I cant understand how to use ...

Can anyone please help me in order to create this ??

Thank you for your support/help in advance

Cancel Call - MQTT-Command

Hi,

to stop a call, a new function can be integrated

DAHUA_CONSOLE_RUN_CMD = "console.runCmd"

def console_run_cmd_cancel_call(self):
    _LOGGER.debug("Cancel call")

    def handle_console_run_cmd_cancel_call(message):
        _LOGGER.info(f"Cancel call msg: {message}")

    request_data = {
        "command": "hc"
    }

    self.send(DAHUA_CONSOLE_RUN_CMD, handle_console_run_cmd_cancel_call, request_data)

Additionally a mqtt subscription to an command event should be integrated.

VTO3221D -ERROR __main__ Failed to handle message, error: 'NoneType' object has no attribute 'get',

Using latest MQTT/DahuaVTO2MQTT image
Intercom:VTO3221D

Problem:
triggering events -> nothing in mqttt

Test:

 curl -s --globoff --digest --user admin:xxxx 'http://192.168.1.110/cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=1&Type=Remote'
OK

Subscribring to mqttt
DahuaVTO/Command/Open
Nothing published

While publish messages manually to DahuaVTO/Command/Open
Vto2Mqtr capturing it in logs:

2022-09-24 09:42:41,048 INFO clients.DahuaAPI Access Control - Unlocked magnetic lock #1
2022-09-24 09:42:43,252 INFO clients.DahuaAPI Access Control - Locked magnetic lock #1

Compose file:

  dahuavto2mqtt:
    image: "registry.gitlab.com/elad.bar/dahuavto2mqtt:latest"
    container_name: "dahuavto2mqtt"
    hostname: "dahuavto2mqtt"
    restart: always
    environment:
      - DAHUA_VTO_HOST=${DAHUA_VTO_HOST}
      - DAHUA_VTO_USERNAME=${DAHUA_VTO_USERNAME}
      - DAHUA_VTO_PASSWORD=${DAHUA_VTO_PASSWORD}
      - MQTT_BROKER_HOST=${MQTT_BROKER_HOST}
      - MQTT_BROKER_PORT=${MQTT_BROKER_PORT}
      - MQTT_BROKER_TOPIC_PREFIX=${MQTT_BROKER_TOPIC_PREFIX}

Starting up - all loogs good


2022-09-24 09:36:25,686 INFO clients.BaseClient Initialize MQTTClient
2022-09-24 09:36:25,691 INFO clients.BaseClient Starting to connect MQTTClient, Should connect: True
2022-09-24 09:36:25,730 INFO clients.BaseClient Initialize DahuaClient
2022-09-24 09:36:25,738 INFO clients.BaseClient Starting to connect DahuaClient, Should connect: True
2022-09-24 09:36:26,692 INFO clients.MQTTClient MQTT Broker is trying to connect...
2022-09-24 09:36:26,697 INFO clients.MQTTClient MQTT Broker connected with result code 0
2022-09-24 09:36:26,792 INFO clients.DahuaClient Connecting
2022-09-24 09:36:26,854 INFO clients.DahuaAPI Get access control configuration
2022-09-24 09:36:26,855 INFO clients.DahuaAPI Get version
2022-09-24 09:36:26,855 INFO clients.DahuaAPI Get serial number
2022-09-24 09:36:26,857 INFO clients.DahuaAPI Get device type
2022-09-24 09:36:26,858 INFO clients.DahuaAPI Attach event manager
2022-09-24 09:36:26,895 INFO clients.DahuaAPI Version: 1.000.0012000.0.R, Build Date: 2018-05-09
2022-09-24 09:36:26,900 INFO clients.DahuaAPI Device Type: VTO3221D
2022-09-24 09:36:26,902 INFO clients.DahuaAPI Serial Number: XXXXXXXXXXXX
2022-09-24 09:36:26,904 INFO clients.DahuaAPI Hold time: 2

Hikvision integration

Hi. I see that you write good integration for Dauhua, Is any chance to also write this integration for Video Intecom Hikvision geneartion 1 model: DS-KV8102-IM with LCD touch panel DS-KH8301-WT ? Please maybe anybody help users Hikvision....

Cannot update to 1.0.7

Update to 1.0.7 (from 1.0.6, which won’t start) fails:

20-10-25 00:26:56 INFO (SyncWorker_1) [supervisor.docker.interface] Updateing image 26703e67/amd64-addon-dahuavto2mqtt:1.0.6 to 26703e67/amd64-addon-dahuavto2mqtt:1.0.7 20-10-25 00:26:56 INFO (SyncWorker_1) [supervisor.docker.addon] Starting build for 26703e67/amd64-addon-dahuavto2mqtt:1.0.7 20-10-25 00:27:23 ERROR (SyncWorker_1) [supervisor.docker.addon] Can't build 26703e67/amd64-addon-dahuavto2mqtt:1.0.7: The command '/bin/ash -o pipefail -c apk add --no-cache --update argon2-libs php php-json && apk add --no-cache --virtual .build-dependencies git && apk add --update libzip-dev curl-dev && docker-php-ext-install curl && apk del gcc g++ && rm -rf /var/cache/apk/* && git clone https://github.com/elad-bar/DahuaVTO2MQTT.git --branch ${DAHUA_BRANCH} --depth 1 /app && chmod +x /app/DahuaVTO.php && apk del .build-dependencies' returned a non-zero code: 14

use on rpi3

Can I use on rpi3 without Hassio?
When I install on docker I see error standard_init_linux.go:211: exec user process caused "exec format error"

Does mqtt send message for lock status?

Hello,

I am only planning to get a Dahua doorbell, so I cannot test plugin physically now, and there is something I need to figure out before buying it.

Thing is, I have a very specific lock control, where my current doorbell actually “unlocks” a dry contact sensor, which is intercepted by another system that opens the lock on its own. So the question is simple, but I just can’t check it now: does this plugin actually have a specific MQTT message where the doorbell reports that the lock has been opened on its side (like when somebody inserted a card), so that I can subscribe my lock management system to this message?

Thank you in advance!

Unable to update to version 1.0.7

I'm unable to update from 1.0.5 to version 1.0.7.

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing...

Add-on: DahuaVTO2MQTT
Listens to events from Dahua VTO unit and publishes them via MQTT Message

Add-on version: 1.0.5
There is an update available for this add-on!
Latest add-on version: null
Please consider upgrading as soon as possible.
parse error: Expected string key before ':' at line 1, column 4
[21:32:15] ERROR: Unknown HTTP error occured
System: (armv7 / raspberrypi4)
Home Assistant Core: 0.116.4
Home Assistant Supervisor: 2020.10.0

Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.

[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing...
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[21:32:17] INFO: Staring Dahua to MQTT**

Ssidnotvalid eror

MQTT message published, Topic: domofon/APConnect/Event, Payload: {"Action":"Stop","Data":{"Error":"SSIDNotValid","LocaleTime":"2020-09-11 18:19:55","Result":false,"UTC":1599837595}}

I get this when I start dahuatomqtt
It start and then stops right away and gives this

Thanks for help

sporadically ringing events

Hi i recently updated from php to python version of this project
this is my sensor in homeassistant

- platform: mqtt
  name: Doorbell ringing
  state_topic: "DahuaVTO/CallNoAnswered/Event"
  payload_on: "Start"
  off_delay: 30
  device_class: vibration
  value_template: "{{ value_json.Action }}"

last night i got multiple(5-6) ringing events triggered by itself, i have cameras all over there to make sure no ones actually hits the ring button. i currently have no idea where to look for useful logfiles or anything else.
With the old version, i never had this problem and it was working over half a year.

What files / logs would help to debug this?

BR

Help porting this to node

Hi,

I'm trying to port the php logic into Node.js for easier integration with node-red. My php-fu is rather week so I'm having some problems understanding the logic on the Send method.

Can you add some comments or explain the kind of messages/headers we should be sending to the doorbell? Is that documented somewhere or did you just reverse-enginnered this by inspecting traffic on the network?

Thanks

MQTT connection 'Data received: None'

Hi I'm having problems connecting to mqtt-eclipse (2.0.10) broker with this script.

I can connect to the broker with home-assistant core and other paho-mqtt clients in other containers.

MQTT logs:

1623105951: New connection from 172.28.0.1:58226 on port 11883.
1623105951: New client connected from 172.28.0.1:58226 as mqtt-explorer-75d44b10 (p2, c1, k60, u'vto').
1623105968: Client mqtt-explorer-75d44b10 disconnected.
1623106109: New connection from 192.168.1.19:35084 on port 11883.
1623106109: Client <unknown> disconnected due to protocol error.
1623106109: New connection from 192.168.1.19:37385 on port 11883.
1623106109: New client connected from 192.168.1.19:37385 as 3UKJjG0b6yndsYVxNFUnGH (p2, c1, k60, u'vto').
1623106114: New connection from 192.168.1.19:34616 on port 11883.
1623106114: Client <unknown> disconnected due to protocol error.
1623106114: New connection from 192.168.1.19:39968 on port 11883.
1623106114: New client connected from 192.168.1.19:39968 as 0QgPy6PuLVd5gaXFLZTHFe (p2, c1, k60, u'vto').
1623106115: Client 0QgPy6PuLVd5gaXFLZTHFe closed its connection.
1623106115: Client 3UKJjG0b6yndsYVxNFUnGH closed its connection.

(The mqtt-explorer connection was just to check that the credentials used for dahuavto2mqtt work independently).

Script stdout:

2021-06-08 08:50:29,521 INFO __main__ Connecting
2021-06-08 08:50:29,521 DEBUG asyncio Using selector: EpollSelector
2021-06-08 08:50:29,531 DEBUG __main__ Connection established
2021-06-08 08:50:29,531 INFO __main__ Initializing MQTT Broker
2021-06-08 08:50:29,531 INFO __main__ MQTT Broker is trying to connect...
2021-06-08 08:50:29,533 DEBUG __main__ Prepare pre-login message
2021-06-08 08:50:29,535 DEBUG __main__ Data received: None
2021-06-08 08:50:29,535 ERROR __main__ Failed to handle message, error: 'NoneType' object has no attribute 'get', Line: 212
2021-06-08 08:50:29,536 INFO __main__ Server sent EOF message
2021-06-08 08:50:29,536 ERROR __main__ server closed the connection
2021-06-08 08:50:29,536 WARNING __main__ Disconnected, will try to connect in 5 seconds
2021-06-08 08:50:29,538 INFO __main__ MQTT Broker connected with result code 0
2021-06-08 08:50:34,537 INFO __main__ Connecting
2021-06-08 08:50:34,537 DEBUG asyncio Using selector: EpollSelector
2021-06-08 08:50:34,540 DEBUG __main__ Connection established
2021-06-08 08:50:34,540 INFO __main__ Initializing MQTT Broker
2021-06-08 08:50:34,540 INFO __main__ MQTT Broker is trying to connect...
2021-06-08 08:50:34,541 DEBUG __main__ Prepare pre-login message
2021-06-08 08:50:34,543 DEBUG __main__ Data received: None
2021-06-08 08:50:34,543 ERROR __main__ Failed to handle message, error: 'NoneType' object has no attribute 'get', Line: 212
2021-06-08 08:50:34,543 INFO __main__ Server sent EOF message
2021-06-08 08:50:34,544 ERROR __main__ server closed the connection
2021-06-08 08:50:34,545 WARNING __main__ Disconnected, will try to connect in 5 seconds

The 'NoneType' error appears to be referring to this function:


    def data_received(self, data):
        try:
            message = self.parse_response(data)
            _LOGGER.debug(f"Data received: {message}")

            message_id = message.get("id")

            handler: Callable = self.data_handlers.get(message_id, self.handle_default)
            handler(message)

Any suggestions on troubleshooting the mqtt connection ?

Integrating Dahua IP cameras

It would be really awesome if an integration with dahaua cameras will be added,

there is other dahua2mqtt project which provide solution for dahua cameraa:
https://github.com/algirdasc/appdaemon-apps/blob/master/dahua_mqtt.py

which working with apdaemon and it covers most of Dahua ivs functionalities ,maybe some can take a look and see if it be reuse to this project,a single running docker which give full cover for Dahua cameras and vto would be awesome :)

Error connecting after VTO disconnecting

Sometimes my Dahua VTO is disconnected from network for a couple of minutes, after that your addon can't connect again to VTO.
Logs:

2021-02-04 13:21:23,326 WARNING asyncio socket.send() raised exception.
2021-02-04 13:22:18,331 WARNING asyncio socket.send() raised exception.
2021-02-04 13:23:13,336 WARNING asyncio socket.send() raised exception.
2021-02-04 13:24:08,340 WARNING asyncio socket.send() raised exception.
2021-02-04 13:25:03,344 WARNING asyncio socket.send() raised exception.
2021-02-04 13:25:58,348 WARNING asyncio socket.send() raised exception.
2021-02-04 13:26:53,359 WARNING asyncio socket.send() raised exception.

Every minute is new log like this.

DahuaVTOClient doesn't handle packets larger than Ethernet frame.

DahuaVTOClient extends class asyncio.BufferedProtocol(BaseProtocol) this in general is ok, but with larger than 1500 bytes packets produces error like:
ERROR main Failed to read data: b' ..... , error: Unterminated string starting at: line 1 column 1397 (char 1396), Line: 323
ERROR main Failed to handle message, error: 'NoneType' object has no attribute 'get', Line: 170

I found the problem, you can change asyncio.BufferedProtocol(BaseProtocol) with class asyncio.BufferedProtocol(BaseProtocol) implement the buffer and create methods to handle the buffer:
get_buffer and buffer_updated the code can be found in my fork https://github.com/ToniRos/DahuaVTO2MQTT.

QUESTION: VTO2202F-P-S2 supported?

Since the VTO2202F-P isn't available in the Netherlands as standalone unit, i've been looking at a similar model named VTO2202F-P-S2.

I have seen one issue from a user who said that he had a specific issue with the repo and his S2 model, but haven't found a definitive answer if it works or not.

If you say it should work, I am willing to buy it and test some stuff out.

Thanks!

Installation error

Hi!!

When i try to install the addon, see this error

The command '/bin/ash -o pipefail -c apk update && apk upgrade && apk add --no-cache python3 py3-pip py3-setuptools git && pip3 install --upgrade pip --no-cache-dir paho-mqtt requests' returned a non-zero code

I try to install in a new clean HA 8.4, but I reciver the same error

image

Install on Hassio

hi, i feel like a stupid but in my HA installation (rpi4 with hassio) and i cannot install your repo, nothing from add-on and nothing from HACS, i try with portainer but don't know hot to modify the image config for the mqtt and vto settings

thanks for the help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.