* deconz: Adds support for enabling UPnP

* deconz: Improve waiting for udev devices mechanism

* deconz: Sort dependencies
This commit is contained in:
Pascal Vizeli
2019-12-06 10:08:57 +01:00
committed by GitHub
parent 35e9244cb9
commit f71edff3fa
5 changed files with 51 additions and 18 deletions

View File

@@ -1,5 +1,10 @@
# Changelog # Changelog
## 3.9
- Adds support for enabling UPnP
- Improve waiting for udev devices mechanism
## 3.8 ## 3.8
- Bump deCONZ to 2.05.71 - Bump deCONZ to 2.05.71

View File

@@ -9,7 +9,6 @@ ARG BUILD_ARCH
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y --no-install-recommends \ && apt-get install -y --no-install-recommends \
curl \ curl \
udev \
iproute2 \ iproute2 \
iputils-ping \ iputils-ping \
kmod \ kmod \
@@ -26,6 +25,7 @@ RUN apt-get update \
sqlite3 \ sqlite3 \
tigervnc-common \ tigervnc-common \
tigervnc-standalone-server \ tigervnc-standalone-server \
udev \
wget \ wget \
wmii \ wmii \
xfonts-base \ xfonts-base \

View File

@@ -122,6 +122,25 @@ Example add-on config with `dbg_aps` enabled on log level 1:
} }
``` ```
## Enabling UPnP
The add-on, by default, disables the native UPnP functionality of deCONZ.
This is because the add-on uses an alternative discovery mechanism that allows
for an improved integration experience.
Nevertheless, the add-on allows you to enable UPnP again, in case you want
deCONZ to be discovered by other applications (that are not Home Assistant).
Add the `upnp` add-on option, and set it to `true` to enable UPnP:
```json
{
"device": "/dev/ttyUSB0",
"vnc_password": "",
"upnp": true
}
```
## Configuration ## Configuration
Add-on configuration: Add-on configuration:

View File

@@ -1,6 +1,6 @@
{ {
"name": "deCONZ", "name": "deCONZ",
"version": "3.8", "version": "3.9",
"slug": "deconz", "slug": "deconz",
"description": "Control a ZigBee network with ConBee or RaspBee by Dresden Elektronik", "description": "Control a ZigBee network with ConBee or RaspBee by Dresden Elektronik",
"arch": ["amd64", "armhf", "aarch64"], "arch": ["amd64", "armhf", "aarch64"],
@@ -26,14 +26,8 @@
"udev": true, "udev": true,
"gpio": true, "gpio": true,
"apparmor": false, "apparmor": false,
"privileged": [ "privileged": ["SYS_MODULE", "SYS_RAWIO"],
"SYS_MODULE", "devices": ["/dev/bus/usb:/dev/bus/usb:rwm", "/dev/mem:/dev/mem:rw"],
"SYS_RAWIO"
],
"devices": [
"/dev/bus/usb:/dev/bus/usb:rwm",
"/dev/mem:/dev/mem:rw"
],
"options": { "options": {
"device": null, "device": null,
"vnc_password": "" "vnc_password": ""
@@ -45,7 +39,8 @@
"dbg_info": "int?", "dbg_info": "int?",
"dbg_otau": "int?", "dbg_otau": "int?",
"dbg_zcl": "int?", "dbg_zcl": "int?",
"dbg_zdp": "int?" "dbg_zdp": "int?",
"upnp": "bool?"
}, },
"image": "homeassistant/{arch}-addon-deconz" "image": "homeassistant/{arch}-addon-deconz"
} }

View File

@@ -24,11 +24,21 @@ VNC_PASSWORD=$(bashio::config 'vnc_password')
WEBSOCKET_PORT=$(bashio::addon.port 8080) WEBSOCKET_PORT=$(bashio::addon.port 8080)
# Lookup udev link # Lookup udev link
sleep 3 if [[ -c "${DECONZ_DEVICE}" ]]; then
if [ -L "${DECONZ_DEVICE}" ]; then bashio::log.debug "Specified device points to a character special file, continuing"
DECONZ_DEVICE="$(readlink -f "${DECONZ_DEVICE}")" else
elif [ ! -e "${DECONZ_DEVICE}" ]; then # 60 second timeout to wait for udev to finish processing
timeout=60
while [[ ! -L "${DECONZ_DEVICE}" ]]; do
if [[ "${timeout}" -eq 0 ]]; then
bashio::exit.nok "No device ${DECONZ_DEVICE} found!" bashio::exit.nok "No device ${DECONZ_DEVICE} found!"
fi
bashio::log.debug "Waiting for udev to link device..,"
sleep 1
((timeout--))
done
DECONZ_DEVICE="$(readlink -f "${DECONZ_DEVICE}")"
bashio::log.debug "Found device! Location: ${DECONZ_DEVICE}"
fi fi
# Load debug values # Load debug values
@@ -43,6 +53,10 @@ bashio::config.has_value 'dbg_zcl' \
bashio::config.has_value 'dbg_zdp' \ bashio::config.has_value 'dbg_zdp' \
&& DBG_ZDP="$(bashio::config 'dbg_zdp')" || DBG_ZDP=0 && DBG_ZDP="$(bashio::config 'dbg_zdp')" || DBG_ZDP=0
# Handle UPNP
bashio::config.true 'upnp' \
&& UPNP=1 || UPNP=0
# Check if port is available # Check if port is available
if bashio::var.is_empty "${API_PORT}" \ if bashio::var.is_empty "${API_PORT}" \
|| bashio::var.is_empty "${WEBSOCKET_PORT}"; || bashio::var.is_empty "${WEBSOCKET_PORT}";
@@ -96,7 +110,7 @@ deCONZ \
--dbg-zdp="${DBG_ZDP}" \ --dbg-zdp="${DBG_ZDP}" \
--http-port="${API_PORT}" \ --http-port="${API_PORT}" \
--ws-port="${WEBSOCKET_PORT}" \ --ws-port="${WEBSOCKET_PORT}" \
--upnp=0 \ --upnp="${UPNP}" \
--dev="${DECONZ_DEVICE}" & --dev="${DECONZ_DEVICE}" &
WAIT_PIDS+=($!) WAIT_PIDS+=($!)