Dahua VTO to MQTT Broker

currently the build doesn’t support arm64/32 builds,
hope that in the upcoming 2 weeks i will manage to set up build machine for that and finally fix it,
will update

released new version to fix the of failed messages (parsing issue)

The installation doesn’t seem to work?

Failed to install add-on
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: 3

What I am currently running just in case:

Core 2023.11.1
Supervisor 2023.11.0
Operating System 11.1
Frontend 20231030.1

Just saw this. I get a 404 on http://registry.gitlab.com/elad.bar/dahuavto2mqtt:latest.


No luck with Elad Bar / DahuaVTO2MQTT · GitLab either, says it’s not a valid addon. No idea how to use docker-compose on HA, is that something built-in where I need to edit a YAML file?

Also, this is running in a virtual machine.

Hi, this is not an addon but plain docker image, please follow instructions in the opening post or repo in GitLab

Thanks

The instructions are quite incomplete. According to another post, dockers can’t be run from Home Assistant OS: Docker compose - home assistant os - #2 by CentralCommand.

How could this be made compatible with HAOS?

It needs to be structured as addon, since i don’t have HA OS I can’t assist but will share later the link to the outdated repo i maintained in the past

I have started using this recently to get the doorbell notification from my doorbell to mqtt, it has worked really well but hung on an error until I restarted the container:

2023-12-05 10:10:06,686 ERROR clients.DahuaAPI Failed to read data:  DHIPZ{C{"error":{"code":268632079,"message":"Component error: login challenge!"},"id":2,"params":{"authorization":"37a266f79d50f73e70e91f40b038d5294157eea9","encryption":"Default","random":"1126542776","realm":"Login to ND032110032555"},"result":false,"session":1140292442}, error: Expecting property name enclosed in double quotes: line 1 column 2 (char 1), Line: 429

Any fix for this?

released new image with fix for that error

1 Like

Manage to build images for arm32v7, arm64v8.

Image tags per architecture

  • latest: linux/amd64
  • arm32v7: linux/arm32/v7
  • arm64v8: linux/arm64/v8

Since your fix it has worked well until today and had the following errors when it stopped working again:

2023-12-24 21:30:33,069 ERROR clients.DahuaAPI Failed to handle message, error: 'NoneType' object is not iterable, Line: 96
2023-12-24 23:15:59,780 ERROR clients.DahuaAPI Failed to read data:  DHIP>{FF{"id":123,"params":{"timeout":55},"result":true,"session":2134805948}, Original Data: b' \x00\x00\x00DHIP\xbc\x8d>\x7f{\x00\x00\x00F\x00\x00\x00\x00\x00\x00\x00F\x00\x00\x00\x00\x00\x00\x00{"id":123,"params":{"timeout":55},"result":true,"session":2134805948}\n', Error: Expecting property name enclosed in double quotes: line 1 column 2 (char 1), Line: 438
2023-12-24 23:19:38,214 INFO clients.DahuaAPI Server sent EOF message
2023-12-24 23:19:38,215 INFO clients.DahuaClient Disconnected, will try to connect in 5 seconds
2023-12-24 23:19:43,217 INFO clients.DahuaClient Connecting
2023-12-24 23:19:43,511 ERROR clients.DahuaAPI Failed to read data:  DHIPh{{"error":{"code":268632079,"message":"Component error: login challenge!"},"id":2,"params":{"authorization":"37a266f79d50f73e70e91f40b038d5294157eea9","encryption":"Default","random":"1423618514","realm":"Login to ND032110032555"},"result":false,"session":2070474123}, Original Data: b' \x00\x00\x00DHIP\x8b\xedh{\x02\x00\x00\x00\x0b\x01\x00\x00\x00\x00\x00\x00\x0b\x01\x00\x00\x00\x00\x00\x00{"error":{"code":268632079,"message":"Component error: login challenge!"},"id":2,"params":{"authorization":"37a266f79d50f73e70e91f40b038d5294157eea9","encryption":"Default","random":"1423618514","realm":"Login to ND032110032555"},"result":false,"session":2070474123}\n', Error: Expecting property name enclosed in double quotes: line 1 column 2 (char 1), Line: 438

Also the following on a restart of the container:

2023-12-26 16:19:40,188 ERROR clients.DahuaAPI Failed to handle message, Data: b' \x00\x00\x00DHIP\xfc\x93\x8c\x13\x07\x00\x00\x00F\x00\x00\x00\x00\x00\x00\x00F\x00\x00\x00\x00\x00\x00\x00{"id":7,"params":{"type":"B451AJ"},"result":true,"session":327980028}\n \x00\x00\x00DHIP\xfc\x93\x8c\x13\x06\x00\x00\x00\xae\x01\x00\x00\x00\x00\x00\x00\xae\x01\x00\x00\x00\x00\x00\x00{"id":6,"params":{"table":{"Address":"p2p.lorexservices.com","Enable":true,"HttpsRegisterPort":12367,"HttpsRegisterPortEx":12367,"Key":"******","Port":8800,"RecvBufferSize":524288,"RegisterPort":12366,"RegisterServer":"p2pasplus.lorexservices.com","RegisterServerEx":"p2pasplus.lorexservices.com","ThreadNum":1,"Type":"dhp2p","UUID":"LNWZ7A62C282AAC","Username":"Lorex","WebVersion":"2.420.0"}},"result":true,"session":327980028}\n \x00\x00\x00DHIP\xfc\x93\x8c\x13\x04\x00\x00\x00\x9d\x00\x00\x00\x00\x00\x00\x00\x9d\x00\x00\x00\x00\x00\x00\x00{"error":{"code":268959743,"message":"Unknown error! error code was not set in service!"},"id":4,"params":{"table":null},"result":false,"session":327980028}\n', Error: 'NoneType' object is not iterable, Line: 103

can you please share the /metrics endpoint data,
it contains the information which version you are using

thanks

according to the lines of the errors, you are not on the latest version, most probably you will not have the /metrics endpoint.

Logs say:

DahuaVTO2MQTT, Version: 2023.12.26.30509

clients.DahuaAPI Version: 1.000.030000000.8.R, Build Date: 2022-09-03

Pulling image from:

registry.gitlab.com/elad.bar/dahuavto2mqtt:latest

Do I need to pull the image different?

I am still getting errors so hope you can help…

2024-01-02 12:53:55,586 ERROR clients.DahuaAPI Failed to handle message, Data: b' \x00\x00\x00DHIPI\xe7\x8fK\x04\x00\x00\x00\x9e\x00\x00\x00\x00\x00\x00\x00\x9e\x00\x00\x00\x00\x00\x00\x00{"error":{"code":268959743,"message":"Unknown error! error code was not set in service!"},"id":4,"params":{"table":null},"result":false,"session":1267722057}\n', Error: 'NoneType' object is not iterable, Line: 103
1 Like

Dear @baudneo , I’ve installed your docker image. But I’m still having previous issue.

Every time I do a backup of the docker image and docker container restarts, it sends me a MQTT notification as if someone rings the bell.

Any ideas why may happen?

Hereby the log:

      
2024-02-28 09:47:25,051 INFO clients.BaseClient Initialize MQTTClient
2024-02-28 09:47:25,051 INFO clients.BaseClient Starting to connect MQTTClient, Should connect: True
2024-02-28 09:47:25,051 INFO clients.BaseClient Initialize DahuaClient
2024-02-28 09:47:25,051 INFO clients.BaseClient Starting to connect DahuaClient, Should connect: True
2024-02-28 09:47:26,051 INFO clients.MQTTClient MQTT Broker is trying to connect...
2024-02-28 09:47:26,051 INFO clients.DahuaClient Connecting
2024-02-28 09:47:26,052 INFO clients.MQTTClient MQTT Broker connected with result code 0
2024-02-28 09:47:26,098 INFO clients.DahuaAPI Get access control configuration
2024-02-28 09:47:26,098 INFO clients.DahuaAPI Get version
2024-02-28 09:47:26,098 INFO clients.DahuaAPI Get serial number
2024-02-28 09:47:26,098 INFO clients.DahuaAPI Get device type
2024-02-28 09:47:26,098 INFO clients.DahuaAPI Attach event manager
2024-02-28 09:47:26,132 ERROR clients.DahuaAPI Failed to read data: b' \x00\x00\x00DHIP\x18\x9e\x03t\x04\x00\x00\x00f\x10\x00\x00\x00\x00\x00\x00f\x10\x00\x00\x00\x00\x00\x00{"id":4,"params":{"table":[{"AccessProtocol":"Local","AutoRemoteCheck":{"Enable":false,"Time":255},"BreakInAlarmEnable":false,"CardNoConvert":0,"CloseAlwaysTime":255,"CloseTimeout":60,"CustomPasswordEnable":false,"DoorNotClosedAlarmEnable":false,"DuressAlarmEnable":true,"Enable":true,"FirstEnter":{"Enable":false,"Status":"Normal","Time":1},"HelmetEnable":false,"HolidayTime":255,"LockMode":2,"Method":42,"Name":"Door1","OpenAlwaysTime":255,"ProtocolType":0,"ReadCardState":0,"RemoteCheck":false,"RemoteDetail":{"TimeOut":0,"TimeOutDoorStatus":"Close"},"RepeatEnterAlarm":false,"RepeatEnterTime":0,"SensorEnable":false,"State":"Normal","TimeSchedule":[[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00', error: Expecting ',' delimiter: line 1 column 1380 (char 1379), Line: 406
2024-02-28 09:47:26,132 ERROR clients.DahuaAPI Failed to handle message, error: 'NoneType' object has no attribute 'get', Line: 87
2024-02-28 09:47:26,132 ERROR clients.DahuaAPI Failed to handle message, error: 'NoneType' object has no attribute 'get', Line: 87
2024-02-28 09:47:26,189 INFO clients.DahuaAPI Version: 4.600.0000000.0.R, Build Date: 2022-08-13
2024-02-28 09:47:26,189 INFO clients.DahuaAPI Serial Number: 9C072E4PAJDCDBA
2024-02-28 09:51:21,878 INFO clients.BaseClient Initialize MQTTClient
2024-02-28 09:51:21,878 INFO clients.BaseClient Starting to connect MQTTClient, Should connect: True
2024-02-28 09:51:21,878 INFO clients.BaseClient Initialize DahuaClient
2024-02-28 09:51:21,878 INFO clients.BaseClient Starting to connect DahuaClient, Should connect: True
2024-02-28 09:51:22,878 INFO clients.MQTTClient MQTT Broker is trying to connect...
2024-02-28 09:51:22,878 INFO clients.DahuaClient Connecting
2024-02-28 09:51:22,880 INFO clients.MQTTClient MQTT Broker connected with result code 0
2024-02-28 09:51:22,979 INFO clients.DahuaAPI Get access control configuration
2024-02-28 09:51:22,979 INFO clients.DahuaAPI Get version
2024-02-28 09:51:22,979 INFO clients.DahuaAPI Get serial number
2024-02-28 09:51:22,979 INFO clients.DahuaAPI Get device type
2024-02-28 09:51:22,979 INFO clients.DahuaAPI Attach event manager
2024-02-28 09:51:23,028 ERROR clients.DahuaAPI Failed to read data: b' \x00\x00\x00DHIP\xe3\x07\xfaP\x04\x00\x00\x00f\x10\x00\x00\x00\x00\x00\x00f\x10\x00\x00\x00\x00\x00\x00{"id":4,"params":{"table":[{"AccessProtocol":"Local","AutoRemoteCheck":{"Enable":false,"Time":255},"BreakInAlarmEnable":false,"CardNoConvert":0,"CloseAlwaysTime":255,"CloseTimeout":60,"CustomPasswordEnable":false,"DoorNotClosedAlarmEnable":false,"DuressAlarmEnable":true,"Enable":true,"FirstEnter":{"Enable":false,"Status":"Normal","Time":1},"HelmetEnable":false,"HolidayTime":255,"LockMode":2,"Method":42,"Name":"Door1","OpenAlwaysTime":255,"ProtocolType":0,"ReadCardState":0,"RemoteCheck":false,"RemoteDetail":{"TimeOut":0,"TimeOutDoorStatus":"Close"},"RepeatEnterAlarm":false,"RepeatEnterTime":0,"SensorEnable":false,"State":"Normal","TimeSchedule":[[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"}],[{"Method":42,"TimeSection":"00:00:00-23:59:59"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00-00:00:00"},{"Method":42,"TimeSection":"00:00:00', error: Expecting ',' delimiter: line 1 column 1380 (char 1379), Line: 406
2024-02-28 09:51:23,028 ERROR clients.DahuaAPI Failed to handle message, error: 'NoneType' object has no attribute 'get', Line: 87
2024-02-28 09:51:23,028 ERROR clients.DahuaAPI Failed to handle message, error: 'NoneType' object has no attribute 'get', Line: 87

I will take a look here after work and report back.

I haven’t noticed any issues like that myself. What device are you running?

PoE, 1080P, HD, VTO2201F-P

@mglc28 which image are you using?

thanks

what do you mean by “image”?
Thanks