diff --git a/deconz/CHANGELOG.md b/deconz/CHANGELOG.md index a65b985..1527f98 100644 --- a/deconz/CHANGELOG.md +++ b/deconz/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 3.9 + +- Adds support for enabling UPnP +- Improve waiting for udev devices mechanism + ## 3.8 - Bump deCONZ to 2.05.71 diff --git a/deconz/Dockerfile b/deconz/Dockerfile index af959af..a58239c 100644 --- a/deconz/Dockerfile +++ b/deconz/Dockerfile @@ -9,7 +9,6 @@ ARG BUILD_ARCH RUN apt-get update \ && apt-get install -y --no-install-recommends \ curl \ - udev \ iproute2 \ iputils-ping \ kmod \ @@ -26,6 +25,7 @@ RUN apt-get update \ sqlite3 \ tigervnc-common \ tigervnc-standalone-server \ + udev \ wget \ wmii \ xfonts-base \ diff --git a/deconz/README.md b/deconz/README.md index 1cb5d2e..514de6a 100644 --- a/deconz/README.md +++ b/deconz/README.md @@ -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 Add-on configuration: diff --git a/deconz/config.json b/deconz/config.json index 5138aa5..5f159ec 100644 --- a/deconz/config.json +++ b/deconz/config.json @@ -1,6 +1,6 @@ { "name": "deCONZ", - "version": "3.8", + "version": "3.9", "slug": "deconz", "description": "Control a ZigBee network with ConBee or RaspBee by Dresden Elektronik", "arch": ["amd64", "armhf", "aarch64"], @@ -26,17 +26,11 @@ "udev": true, "gpio": true, "apparmor": false, - "privileged": [ - "SYS_MODULE", - "SYS_RAWIO" - ], - "devices": [ - "/dev/bus/usb:/dev/bus/usb:rwm", - "/dev/mem:/dev/mem:rw" - ], + "privileged": ["SYS_MODULE", "SYS_RAWIO"], + "devices": ["/dev/bus/usb:/dev/bus/usb:rwm", "/dev/mem:/dev/mem:rw"], "options": { - "device": null, - "vnc_password": "" + "device": null, + "vnc_password": "" }, "schema": { "device": "str", @@ -45,7 +39,8 @@ "dbg_info": "int?", "dbg_otau": "int?", "dbg_zcl": "int?", - "dbg_zdp": "int?" + "dbg_zdp": "int?", + "upnp": "bool?" }, "image": "homeassistant/{arch}-addon-deconz" } diff --git a/deconz/data/run.sh b/deconz/data/run.sh index 6bbb180..5ecda07 100755 --- a/deconz/data/run.sh +++ b/deconz/data/run.sh @@ -24,11 +24,21 @@ VNC_PASSWORD=$(bashio::config 'vnc_password') WEBSOCKET_PORT=$(bashio::addon.port 8080) # Lookup udev link -sleep 3 -if [ -L "${DECONZ_DEVICE}" ]; then +if [[ -c "${DECONZ_DEVICE}" ]]; then + bashio::log.debug "Specified device points to a character special file, continuing" +else + # 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!" + fi + bashio::log.debug "Waiting for udev to link device..," + sleep 1 + ((timeout--)) + done DECONZ_DEVICE="$(readlink -f "${DECONZ_DEVICE}")" -elif [ ! -e "${DECONZ_DEVICE}" ]; then - bashio::exit.nok "No device ${DECONZ_DEVICE} found!" + bashio::log.debug "Found device! Location: ${DECONZ_DEVICE}" fi # Load debug values @@ -43,6 +53,10 @@ bashio::config.has_value 'dbg_zcl' \ bashio::config.has_value 'dbg_zdp' \ && DBG_ZDP="$(bashio::config 'dbg_zdp')" || DBG_ZDP=0 +# Handle UPNP +bashio::config.true 'upnp' \ + && UPNP=1 || UPNP=0 + # Check if port is available if bashio::var.is_empty "${API_PORT}" \ || bashio::var.is_empty "${WEBSOCKET_PORT}"; @@ -96,7 +110,7 @@ deCONZ \ --dbg-zdp="${DBG_ZDP}" \ --http-port="${API_PORT}" \ --ws-port="${WEBSOCKET_PORT}" \ - --upnp=0 \ + --upnp="${UPNP}" \ --dev="${DECONZ_DEVICE}" & WAIT_PIDS+=($!)