Coder Social home page Coder Social logo

baudneo / dahuavto2mqtt Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 133 KB

DahuaVTO2MQTT Image with some improvements specifically for the lorex 2k doorbell.

License: Apache License 2.0

Python 97.86% Dockerfile 2.14%
dahua doorbell home-assistant lorex mqtt vto

dahuavto2mqtt's Introduction

DahuaVTO2MQTT

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

Change log

Dahua VTO MQTT Events - examples

Supported Models

Notes

  • Lorex 2k Doorbell username is always admin
  • Lorex 2k Doorbell password is whatever you set it to in the lorex mobile app

How to install

Docker Compose

#version: '3'
services:
  dahuavto2mqtt:
    image: "baudneo/dahuavto2mqtt:latest"
    container_name: "dahuavto2mqtt"
    hostname: "dahuavto2mqtt"
    restart: "unless-stopped"
    environment:
      DAHUA_VTO_HOST: ip.of.vto.host
      DAHUA_VTO_USERNAME: Username
      DAHUA_VTO_PASSWORD: Password
      MQTT_BROKER_HOST: mqtt-host
      MQTT_BROKER_PORT: 1883
      MQTT_BROKER_USERNAME: Username
      MQTT_BROKER_PASSWORD: Password 
      MQTT_BROKER_TOPIC_PREFIX: DahuaVTO
      MQTT_BROKER_CLIENT_ID: DahuaVTO2MQTT
      MQTT_DEBUG: False
      API_DEBUG: False
      KEEPALIVE_DEBUG: False
      TZ: America/Chicago

Copy the above code into a file called docker-compose.yml and run docker-compose up -d in the same directory as the file. For logs, run docker-compose logs -f (Ctrl+C to exit logs) in the same directory as the file.

Environment Variables

Variable Default Required Description
DAHUA_VTO_HOST - + Dahua VTO hostname or IP
DAHUA_VTO_USERNAME - + Dahua VTO user name
DAHUA_VTO_PASSWORD - + Dahua VTO password
MQTT_BROKER_HOST - + MQTT Broker hostname or IP
MQTT_BROKER_PORT - + MQTT Broker port
MQTT_BROKER_USERNAME - + MQTT Broker user name
MQTT_BROKER_PASSWORD - + MQTT Broker password
MQTT_BROKER_TOPIC_PREFIX DahuaVTO - Topic to publish messages
MQTT_BROKER_CLIENT_ID DahuaVTO2MQTT - MQTT Broker client ID
API_DEBUG false - Enable debug log messages for the connection to the VTO device
MQTT_DEBUG false - Enable debug log messages for the connection to the MQTT broker
KEEPALIVE_DEBUG false - Enable debug log messages for keepalive packets
TZ America/Chicago - Timezone for proper logging timestamp

Commands

Open Door

By publishing MQTT message of {MQTT_BROKER_TOPIC_PREFIX}/Command/Open an HTTP request to the unit will be sent, If the payload of the message is empty, default door to open is 1, If unit supports more than 1 door, please add to the payload Door parameter with the number of the door

Home Assistant automations

Doorbell press

If you changed the dahua topic (env: MQTT_BROKER_TOPIC_PREFIX), make sure to edit it from the below images: DahuaVTO/.

lorex2k doorbell

Home Assistant automation example

Person detected

lorex2k doorbell

Home Assistant automation example

Credits

All credits goes to @riogrande who wrote that complicated integration Original code can be found in @riogrande75/Dahua

dahuavto2mqtt's People

Contributors

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

Stargazers

 avatar

Watchers

 avatar

Forkers

esand

dahuavto2mqtt's Issues

Does this this still work with Lorex 2K doorbells?

Trying to get anything working with a Lorex 2K doorbell (fw 1.000.010000000.8.R.20220903) and I tried this container from an HA thread. Building seems OK, but upon startup, it seems to error out and bootloops.

Update to using Paho MQTT v2 API calls

Request to update code to use the new Paho MQTT v2 API calls.

I have taken my uneducated attempt at changing the code here: https://github.com/esand/dahuavto2mqtt.

The reason codes changed from a straight int to a ReasonCode type which can be an int, or a list/dict of ints for multiple codes. Supposedly you can use .getName() to get the text description for the code(s), so I modified the code to remove the call to the const list of defined error codes. My understanding of Python is zero though, so I'm not sure if I did it right or not ๐Ÿ˜„

My hope is that the work I did in my fork helps you in updating your repo correctly.

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.