Dahua VTO to MQTT Broker

On hassio integrations i find only DahuaVTO and no MQTT Variant.

|Hostname|hassio|
|System|HassOS 3.12|
|Deployment|production|

1 Like

My log says ‘Socket open failed’ - would anyone know the reason for this?

Don’t know what are the exact parameters but it supposed to be supported, since it’s not mapped you will get it as unmapped event (warning message in log), post it once you are doing it and receiving the event so I’ll be able to document it

thanks

Can’t tell you what was done in the HASS.io integration as I still didn’t implement it - don’t know how to do that (mostly the DockerHub configuration for different variations of platform / BUILD_FROM)

Can you please post the entire log?

2020-03-26T06:41:34.312589979Z <*** Dahua VTO Event Listener START ***>
2020-03-26T06:41:37.343915845Z Socket open failed
2020-03-26T06:42:40.409993833Z Socket open failed
2020-03-26T06:43:43.469720786Z Socket open failed

… and on and on.
This is generated by the DahuaEventHandler.php:

function Main($reconnectTimeout=60) {
    $error = false;
    while (true){
        if($error){
            sleep($reconnectTimeout);
        }
		
        $error = true;
        $this->sock = @fsockopen($this->host, 5000, $errno, $errstr, 5);
		
        if($errno){
            logging("**Socket open failed**");
            continue;
        }

Is this a trouble reaching the VTO or the MQTT server?
Is there a way in Portainer to check if the container can reach LAN resource and Internet?

@Artem_Vladimirov could you please share the camera settings.
I have setup as a generic cam but it throws hundred of errors in the log
even if it is visible
thanks!

I have these settings in Home Assistant

camera:
  - platform: generic
    name: "VTO"
    still_image_url: http://192.168.1.120/cgibin/snapshot.cgi?channel=1
    authentication: digest
    username: admin
    password: PASSWORD
    stream_source: rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=1
1 Like

this is mine and I get errors will check url fromatting

Uhm

#- platform: generic
#  name:  TelecameraCitofono
#  still_image_url: !secret TelecameraCitofonostill
#  stream_source: !secret TelecameraCitofonostream
#  authentication: digest
#  username: !secret TelecameraCitofonousername
#  password: !secret TelecameraCitofonodahuapass

nope.
I still have

2020-03-26 19:06:48 ERROR (SyncWorker_19) [homeassistant.components.generic.camera] Error getting camera image: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

According to the error, it cannot access the VTO, did you declared the ip / host in the environment parameters?

Solved! There was a problem with Docker subnet setup…

hi all,

I changed the subject according to the latest update, that code became now an addon:

Hass.io Add-on: Dahua VTO to MQTT Broker

Sends Dahua Intercom events to the MQTT Broker

Supports aarch64 Architecture Supports amd64 Architecture Supports armhf Architecture Supports armv7 Architecture Supports i386 Architecture

Installation

The installation of this add-on is straightforward and easy to do.

  1. Navigate in your Home Assistant frontend to Hass.io -> Add-on Store.
  2. Add a new repository by URL https://github.com/elad-bar/Hassio-addons
  3. Find the “DahuaVTO2MQTT” add-on and click it.
  4. Click on the “INSTALL” button.

How to use

To use this add-on, you need to supply the config for your intercom and MQTT Broker

Configuration

Add-on configuration:

{
    "intercom": {
      "host": "192.168.1.110",
      "username": "admin",
      "password": "admin"
    },
    "mqtt": {
      "host": "core-mosquitto",
      "port": "1883",
      "username": "homeassistant",
      "password": "homeassistant"
    }
  }

Known issues and limitations

  • None. Let me know.

Credits

Using riogrande75’s PHP code that connects your intercom and publishes events via MQTT broker.
Thanks to troykelly’s, I created that Hass.io addon.

Support

Got questions?

You have several options to get them answered:

In case you’ve found a bug, please open an issue on our GitHub.

Original Docker

Available at:

Now it supposed to work for you as the new approach supports all platforms

are there any ways to use it with home assistant core?

yes, you can use the docker

Is it possible to connect more that one VTO? If not, can I run a separate container for each VTO? In this case, is it possible to change/define a different Topic for MQTT?

It supports by creating multiple instances with different configurations,
but the message will have the same,
I removed the support to edit the topic, but I will get it back so you will be able to use it

For Docker:
Added new environment variable - MQTT_BROKER_TOPIC_PREFIX

For Hass.io addon:
Added parameter mqtt.topic_prefix

Default: DahuaVTO

Hi BHA thanks for updating in addon for HASSIO.

I installed the addon but I get the following errors:

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

Add-on version: 1.0.5
You are running the latest version of this add-on.
parse error: Expected string key before ‘:’ at line 1, column 4
[21:43:48] ERROR: Unknown HTTP error occured
System: (armv7 / raspberrypi4)
Home Assistant Core: 0.107.6
Home Assistant Supervisor: 209

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:43:50] INFO: Staring Dahua to MQTT
<*** Dahua VTO Event Listener START ***>
Socket open failed
Socket open failed