Code Monkey home page Code Monkey logo

dahuavto2mqtt's Introduction

DahuaVTO2MQTT

Listens to events from Dahua VTO unit and publishes them via MQTT Message

MQTT Events

Supported Models

Environment Variables

DAHUA_VTO_HOST: 			Dahua VTO hostname or IP
DAHUA_VTO_USERNAME: 		Dahua VTO username to access (should be admin)
DAHUA_VTO_PASSWORD: 		Dahua VTO administrator password (same as accessing web management)
MQTT_BROKER_HOST: 			MQTT Broker hostname or IP
MQTT_BROKER_PORT: 			MQTT Broker port, default=1883
MQTT_BROKER_USERNAME: 		MQTT Broker username
MQTT_BROKER_PASSWORD: 		MQTT Broker password
MQTT_BROKER_TOPIC_PREFIX: 	MQTT Broker topic prefix, default=DahuaVTO
DEBUG:                      Minimum log level (Debug / Info), default=False

Run manually

Requirements:

  • All environment variables above
python3 DahuaVTO.py

Docker Compose

version: '2'
services:
  dahuavto2mqtt:
    image: "eladbar/dahuavto2mqtt:latest"
    container_name: "dahuavto2mqtt"
    hostname: "dahuavto2mqtt"
    restart: always
    environment:
      - DAHUA_VTO_HOST=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
      - DEBUG=False

Changelog

  • 2020-Dec-11

    • Changed MQTT Client to Mosquitto\Client

    • Use one connection with keep alive

    • Update MQTT Events

  • 2020-Oct-21 - Reverted connection to per message, docker based image changed to php:7.4.11-cli

  • 2020-Oct-12 - Added deviceType and serialNumber to MQTT message's payload, Improved connection to one time instead of per message

  • 2020-Sep-04 - Edit Readme file, Added Supported Models and MQTT Events documentation

  • 2020-Mar-27 - Added new environment variable - MQTT_BROKER_TOPIC_PREFIX

  • 2020-Feb-03 - Initial version combing the event listener with MQTT

  • 2021-Jan-01 - Ported to Python

  • 2021-Jan-02 - MQTT Keep Alive, log level control via DEBUG env. variable

  • 2021-Jan-15 - Fix #19 - Reset connection after power failure or disconnection

  • 2021-Jan-21

    • Added open door action when publishing an MQTT message with the topic - {MQTT_BROKER_TOPIC_PREFIX}/Command/Open

    • Reset connection when server sends EOF message gracefully instead of WARNING asyncio socket.send() raised exception

Credits

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

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.