Dahua VTO to MQTT Broker

@ros had the same issue and it was solved,
“Solved! There was a problem with Docker subnet setup…”

Are you trying to set an IP or HOSTNAME?
Can you access into the docker and see if you can ping that address?

thanks

Can multiple instances be done in hassio add-on? How to configure this?

you can set it up using docker, not Hass.io addon

solved, my mistake, I had entered an incorrect ip :sweat_smile:
thanks it works well and finally i can run it on raspberry :ghignante:

Great! I now have 2 instances running in docker. Two VTOs working in parallel!

I get the following error when installing the add-on:

Blockquote
20-03-31 13:37:46 ERROR (SyncWorker_6) [supervisor.docker.addon] Can’t build 26703e67/amd64-addon-dahuavto2mqtt:1.0.5: 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 && git clone GitHub - elad-bar/DahuaVTO2MQTT: Listens to events from Dahua VTO unit and publishes them via MQTT Message --branch ${DAHUA_BRANCH} --depth 1 /app && mv /app/DahuaEventHandler.php /app/DahuaVTO.php && chmod +x /app/DahuaVTO.php && apk del .build-dependencies’ returned a non-zero code: 129

Sharing my 2 cents - an mqtt sensor to check if the door is open.

  • platform: mqtt
    name: “Door Status”
    state_topic: “DahuaVTO/DoorStatus/Event”
    value_template: “{{ value_json.Data.Status }}”

It would be correct to insert in the package readme the models (and relative version of the firmware) that are known as working!
Could users who successfully use this package post their vto model and what firmware does it have?

Hay
That is what I’m looking for some time. I’m planing to bay the inter phone for two apartments and I’m looking for DAHUA VTO3211D-P. Does this work with this model.

1 Like

[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
[19:16:27] ERROR: Unknown HTTP error occured
System: (armv7 / raspberrypi3)
Home Assistant Core: 0.107.7
Home Assistant Supervisor: 214

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.
[19:16:35] INFO: Staring Dahua to MQTT
<*** Dahua VTO Event Listener START ***>
Start login
Login success
Started keepAlive thread
keepAlive failed
Failure no keep alive received
Start login
Login success
Started keepAlive thread
keepAlive failed
Failure no keep alive received
Start login
Login success
Started keepAlive thread
keepAlive failed
Failure no keep alive received

I can get the MQTT service and the log keep says that cant keep alive.
What a hack I’m doing wrong??

Thanks

@teraamper @bar

<< edit as found the cause >>
I got below error:

dahuavto2mqtt    | Warning: array_key_exists() expects parameter 2 to be array, null given in /app/DahuaVTO.php on line 97

The reason:

case of mqtt has no user/pass you should remove parameters from docker-compose

      - MQTT_BROKER_USERNAME=
      - MQTT_BROKER_PASSWORD=

I Can confirm VTO3211D-P2 working with Dahua2Mqtt perfectly !

see log:


dahuavto2mqtt    | <*** Dahua VTO Event Listener START ***>
dahuavto2mqtt    | Start login
dahuavto2mqtt    | Login success
dahuavto2mqtt    | Started keepAlive thread
dahuavto2mqtt    | keepAlive back
dahuavto2mqtt    | Event Manager subscription reply
dahuavto2mqtt    | Event BackKeyLight with State 1
dahuavto2mqtt    | MQTT message published, Topic: DahuaVTO/BackKeyLight/Event, Payload: {"Action":"Pulse","Data":{"LocaleTime":"2000-01-01 00:42:10","State":1,"UTC":946680130}}
dahuavto2mqtt    | Event Call from VTO
dahuavto2mqtt    | MQTT message published, Topic: DahuaVTO/CallNoAnswered/Event, Payload: {"Action":"Start","Data":{"CallID":"2","LocaleTime":"2000-01-01 00:42:10","UTC":946680130}}
dahuavto2mqtt    | Event BackKeyLight with State 11
dahuavto2mqtt    | MQTT message published, Topic: DahuaVTO/BackKeyLight/Event, Payload: {"Action":"Pulse","Data":{"LocaleTime":"2000-01-01 00:42:40","State":11,"UTC":946680160}}

@bar ,

great work man!!!
I have also Dahua cameras and i’m working with :

it’s working great , the question:
is there an option combing the solution u did with Dahua intercom which will support also Dahua IP cameras?
or from the other hand , will it be possible to somehow add the functionality to dahya_mqtt.py to listen also to the Intercom events?
A single solution for both Intercom and IP camera would be truly amazing .
Dahua camera URL_TEMPLATE = “http://{host}:{port}/cgi-bin/eventManager.cgi?action=attach&codes=%5B{events}%5D”

Second , question /suggestion :

is it possible to publish in DahuaVTO topic ON/OFF when receiving any event?
I explain why…
for better setup we can set binary sensor which be set by triggering any event (from DahuaVTO {on/off})
and specifically by some attrribuite find in event type .
see example:

binary_sensor:

  - platform: mqtt
    name: intercom
    state_topic: DahuaVTO
    value_template: "{{ 'ON' if value_json.action == 'ON' else 'OFF' }}"
    json_attributes_topic: DahuaVTO/BackKeyLight/Event
    json_attributes_template: >-
      {"State":"{{value_json.data.State}}",
       "object_type":"{{value_json.data.Object.ObjectType}}"}

So now we have binary sensor which trigger by clicking any button (I believe State is the button),
and in the automation we can refer to specific button :



 - alias: 'Some1 click the Intgercom'
   trigger:
     platform: state
     entity_id: binary_sensor.intercom
     to: 'on'
   condition:
     condition: template
     value_template: >
       {{ trigger.from_state and trigger.to_state.attributes.state == '1' }}
   action:
     - service: camera.snapshot
      # do something...

Again , tnx for ur work !

pls, help how i can get “open door” button in ui?

i install mqtt and dahua addon, but no new sensors, no new entities available,
what do I need to add to the configuration.yaml?
Maybe there is an step by step instruction how to do it?
sorry for my english

1 Like

Hi, i’ve just installed hassio addon but i get strange error in the log:

parse error: Expected string key before ‘:’ at line 1, column 4
? there is nothing wrong in column 4

and also:

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.

how can i get update if addon store says it is the latest?

I have the exact same issue.

The services and entities are not created, the log says its getting info form the device, and i get topics in the MQTT broker, but i get no binary_sensor nor dahua2vto services.

Can you help please bar?

I stopped maintaining the addon as I moved to HA docker (more control on the environment),
I will change the title of the topic and redirect to the docker instructions

changed the OP - only docker supported (works better than the Addon)

While it sucks it’s hard to maintain, I think there is going to be a need flood-in of people who want to use this add-on since I recently made this video: https://youtu.be/GbkCuT4qHbA .

I installed the add-on recently and although it doesn’t make the devices (like others have mentioned) it is an easy way to run the Docker container inside an official Home Assistant install (which is now basically always on HassOS). Creating the needed device yourself (mostly button press) is easy.

So the add-on still works fine with some manual configuration. But without the repository and easy add-on this will make it a lot harder for people to run the Docker container. Or is there maybe an easy guide you could provide to run it on a HassOS configuration?

Your add-on basically completes basically the best HA linked doorbell solution out there right now, hope there is a half way! :slight_smile:

1 Like

Hi, just saw the video, second person and third person are the same :slight_smile:

hey @bar thanks for that awesome work!

i’ve purchased the Dahua VTO2111D-WP and i can tell it works great!

quick question, i was trying to figure out if the dahua doorbell api support also to send a message to open the door (like doing from the app).

i can see that i can get sensors regarding the event, but i think i’m not the only one who doesn’t want to use the dahua app and just integrate everything to HA.

thanks again!

I understand what you are trying to achieve,
I tried the same, created momentary switch that turns off and on according to the event, but that’s not bullet proof, so I asked myself why keep trying if I can leverge that event to trigger automation (NodeRED).

The automation reacts to the event, check if it was triggered in the last 10 seconds and then simply:

  • Activates ring bell at home
  • Sends push message with image and button to open the gate
  • after 30 seconds if no one clicked on the open gate from push, button will be deleted
  • Announcement through Google Home that someone is waiting

If you would like to create also binary sensor, use that script also to set a new / update binary sensor X state according to the event or lack of event

If you are using NodeRED, I can share with you the flow

1 Like