Dahua VTO custom integration

Hi, I thank you for the nice work.
Please let me ask, sorry I’m a newbie, does this project will allow two way audio between the HA and Dahua VTO? anf if so will it be possible to do it through a dasboard card?
thanks in advance for you time
bests

it’s fail in github. does it work now ?

No, this integration for now allow only to receive events from VTO, send commands and open the locks (actually it’s a set of commands inside integration). I’m not sure if it’s even possible to do two way audio using this DHIP protocol. Latest versions of VTO firmware has SIP server and you can try to make two way audio using SIP softphone.

Validate failing on github means that it’s doesn’t pass HA integration validation (because vendor images pull request doesn’t approved yet). But sure the integration is working.

thanks. BTW the comands sent to VT from HA will go through ethernet and acitvate terminals connected to the lock. Is it right?

Yes, it’s go through ethernet directly to VT and use same protocol as for events (you can open lock using http protocol as well as it’s done at Dahua VTO to MQTT Broker) but I think to use same communication for opening the lock it’s more reliable than http. Integration open the lock exactly as Dahua DMSS application.
What you mean under terminals - Dahua VTH devices?

BTW You can use same integration for Dahua VTH devices but you should look to events which you will receive and thinks if it’s report something useful for you.

I have tried the 2-way communication with the SIP server FW in the past but didn’t succeed
I have used a VTO2111D-WP-S1 with a softphone and I only managed to get a call from VTO to the softphone without audio
If someone can try and get it work it would be great!
actually, I believe your integration with a SIP integration for VTO it would be perfect for HA

@myhomeiot
Thanks for you integration. I have questions concerning event, is it possible to get door status event as a binary sensor ?
I can get this info on my vto2202fp.

Hello,
I can’t say exactly because my door sensor doesn’t connected to VTO but if you see corresponding events when you open and close door, sure it’s possible to do by using input_boolean. Turn it on when you receives door open event and turn it off when door close. If you post here data from door open and close event I will help you with configuration.

I tried to add it to my HA but for some reason it would not work! It failed and this is my log:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 143, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1515, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 206, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 649, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 692, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 686, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/template/lock.py", line 146, in async_unlock
    await self._command_unlock.async_run(context=self._context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1195, in async_run
    await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 341, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 359, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 559, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1515, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 719, in admin_handler
    await result
  File "/config/custom_components/dahua_vto/__init__.py", line 59, in service_open_door
    raise HomeAssistantError("entity not found")
homeassistant.exceptions.HomeAssistantError: entity not found 

@aalmarshad As I see you try to call open_door service and get “entity not found”, in Developer Tools check that you have sensor.dahua_vto entity (or simular if you specified the name in integration configuration) and check that you specified correct entity_id in open_door service call, example you can see here

Yes, for some reason I cannot find sensor.dahua_vto even I did the configuration in the configuration.yaml as explained in the GitHub page

@aalmarshad Can you turn on debugging as explained here and check if you have communication with a VTO.

You should see something similar to:

2021-04-08 08:46:59 DEBUG (MainThread) [custom_components.dahua_vto.sensor] Connecting 192.168.x.x:5000, username xxxxx
2021-04-08 08:46:59 DEBUG (MainThread) [custom_components.dahua_vto.sensor] >>> {"method":"global.login","params":{"clientType":"","ipAddr":"(null)","loginType":"Direct"},"id":1,"session":0}
2021-04-08 08:46:59 DEBUG (MainThread) [custom_components.dahua_vto.sensor] <<< {"error":{"code":268632079,"message":"Component error: login challenge!"},"id":1,"params":{"authorization":"5dfb193508f162df191c8a12f96f82af75589683","encryption":"Default","mac":"14A78B0CB798","random":"1827976903","realm":"Login to XXXXXXXXXXXXXXX"},"result":false,"session":2147483500}
2021-04-08 08:46:59 DEBUG (MainThread) [custom_components.dahua_vto.sensor] >>> {"method":"global.login","params":{"clientType":"","ipAddr":"(null)","loginType":"Direct","userName":"admin","password":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"},"id":2,"session":2147483500}
2021-04-08 08:46:59 DEBUG (MainThread) [custom_components.dahua_vto.sensor] <<< {"id":2,"params":{"keepAliveInterval":60},"result":true,"session":2147483500}
2021-04-08 08:46:59 DEBUG (MainThread) [custom_components.dahua_vto.sensor] >>> {"method":"eventManager.attach","params":{"codes":["All"]},"id":3,"session":2147483500}
2021-04-08 08:46:59 DEBUG (MainThread) [custom_components.dahua_vto.sensor] >>> {"method":"magicBox.getSystemInfo","id":4,"session":2147483500}
2021-04-08 08:46:59 DEBUG (MainThread) [custom_components.dahua_vto.sensor] <<< {"id":3,"params":{"SID":513},"result":true,"session":2147483500}

I found my problem. I was naming the service main instead of dahua_vto. it works like charm now. Thanks for your help and support

Great! Can you share the model of your VTO, I will update a list of supported models here

1 Like

Sure, it’s VTO2202F

I wish to see the integration on the official HA list.

best wishes and thanks for your hard work

Thanks!
I’m not sure about HA official list, but I hope soon we will see this integration in HACS default. This will make installation and maintenance of integration much easy.

Tested, working great - don’t see any unexpected behavior.

Button example for HA:

type: 'custom:button-card'
icon: 'mdi:doorbell-video'
name: Doorstation - Door 1
tap_action:
  action: call-service
  service: dahua_vto.open_door
  service_data:
    entity_id: sensor.dahua_vto
    channel: 1
    short_number: HA
styles:
  card:
    - font-size: 12px
    - font-weight: bold
color: auto
show_state: false

I added review approve to your commit - 2 more

2 Likes