Skip to content

Commit

Permalink
Hassio Add-on support #1
Browse files Browse the repository at this point in the history
  • Loading branch information
elad-bar committed Mar 21, 2020
1 parent a4c7b93 commit 0bdc847
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM php:7.2.2-apache
ARG BUILD_FROM
FROM $BUILD_FROM

MAINTAINER Elad Bar <[email protected]>

WORKDIR /app
Expand All @@ -14,4 +16,5 @@ ENV MQTT_BROKER_PORT=1883
ENV MQTT_BROKER_USERNAME=Username
ENV MQTT_BROKER_PASSWORD=Password

CMD php -f /app/DahuaVTO.php
COPY data/run.sh .
CMD ./run.sh
42 changes: 42 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "DahuaVTO2MQTT",
"version": "1.0.1",
"slug": "dahua_mqtt",
"description": "Listens to events from Dahua VTO unit and publishes them via MQTT Message",
"arch": [
"armhf",
"armv7",
"aarch64",
"amd64",
"i386"
],
"startup": "services",
"boot": "auto",
"options": {
"intercom": {
"host": "192.168.1.110",
"username": "admin",
"password": "admin"
},
"mqtt": {
"host": "core-mosquitto",
"port": "1883",
"username": "homeassistant",
"password": "homeassistant"
}
},
"schema": {
"intercom": {
"host": "str?",
"username": "str?",
"password": "str?"
},
"mqtt": {
"host": "str?",
"port": "int?",
"username": "str?",
"password": "str?"
}
},
"image": "eladbar/{arch}-addon-dahuavto2mqtt"
}
15 changes: 15 additions & 0 deletions data/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bashio

export DAHUA_VTO_HOST=$(bashio::config 'intercom.host')
export DAHUA_VTO_USERNAME=$(bashio::config 'intercom.username')
export DAHUA_VTO_PASSWORD=$(bashio::config 'intercom.password')
export MQTT_BROKER_HOST=$(bashio::config 'mqtt.host')
export MQTT_BROKER_PORT=$(bashio::config 'mqtt.port')
export MQTT_BROKER_USERNAME=$(bashio::config 'mqtt.username')
export MQTT_BROKER_PASSWORD=$(bashio::config 'mqtt.password')

bashio::log.info "Staring Dahua to MQTT"
bashio::log.debug "Connecting to Intercom ${DAHUA_VTO_HOST} with username ${DAHUA_VTO_USERNAME}"
bashio::log.debug "Connecting to Broker ${MQTT_BROKER_HOST} with username ${MQTT_BROKER_USERNAME}"
php -f ./DahuaVTO.php
bashio::log.info "Finished Dahua to MQTT"

0 comments on commit 0bdc847

Please sign in to comment.