diff --git a/.devcontainer/start_supervisor.sh b/.devcontainer/start_supervisor.sh index e974214..4deca98 100755 --- a/.devcontainer/start_supervisor.sh +++ b/.devcontainer/start_supervisor.sh @@ -90,7 +90,7 @@ function run_supervisor() { -e SUPERVISOR_SHARE="/workspaces/test_hassio" \ -e SUPERVISOR_NAME=hassio_supervisor \ -e SUPERVISOR_DEV=1 \ - -e HOMEASSISTANT_REPOSITORY="homeassistant/qemux86-64-homeassistant" \ + -e SUPERVISOR_MACHINE="qemux86-64" \ homeassistant/amd64-hassio-supervisor:dev } diff --git a/deconz/CHANGELOG.md b/deconz/CHANGELOG.md index 36844c3..a3fbbe9 100644 --- a/deconz/CHANGELOG.md +++ b/deconz/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 6.2.0 + +- Enable VNC per default +- Ingress entry page to select noVNC or Phoscon + ## 6.1.2 - Disable default init system diff --git a/deconz/DOCS.md b/deconz/DOCS.md index 2e3a33a..ae3c85d 100644 --- a/deconz/DOCS.md +++ b/deconz/DOCS.md @@ -77,7 +77,6 @@ To enable it: - Set a port number for VNC in the "Network" configuration section of the add-on and hit "SAVE". Advised is to use port 5900, but any other port above 5900 works as well. -- Set a VNC password in the add-on configuration and hit "SAVE". - Restart the add-on. To access it, you need a [VNC Viewer][vnc-viewer] application. If you are using @@ -138,7 +137,6 @@ Example add-on config with `dbg_aps` enabled on log level 1: ```yaml device: /dev/ttyUSB0 -vnc_password: "" dbg_aps: 1 ``` diff --git a/deconz/Dockerfile b/deconz/Dockerfile index 2b50d10..d4f2a40 100644 --- a/deconz/Dockerfile +++ b/deconz/Dockerfile @@ -23,6 +23,7 @@ RUN apt-get update \ lsof \ netcat \ nginx \ + novnc \ sqlite3 \ tigervnc-common \ tigervnc-standalone-server \ diff --git a/deconz/config.json b/deconz/config.json index cde021c..34bf46b 100644 --- a/deconz/config.json +++ b/deconz/config.json @@ -1,6 +1,6 @@ { "name": "deCONZ", - "version": "6.1.2", + "version": "6.2.0", "slug": "deconz", "description": "Control a Zigbee network with ConBee or RaspBee by Dresden Elektronik", "arch": ["amd64", "armhf", "aarch64"], @@ -9,7 +9,7 @@ "boot": "auto", "init": false, "ingress": true, - "ingress_entry": "pwa/index.html", + "ingress_entry": "ingress.html", "panel_icon": "mdi:zigbee", "homeassistant": "0.91.2", "discovery": ["deconz"], @@ -19,7 +19,7 @@ "40850/tcp": null }, "ports_description": { - "5900/tcp": "deCONZ graphical desktop via VNC", + "5900/tcp": "deCONZ desktop via VNC (Not required for Ingress)", "8081/tcp": "deCONZ WebSocket (Not required for Ingress)", "40850/tcp": "deCONZ API backend (Not required for Ingress)" }, @@ -32,12 +32,10 @@ "devices": ["/dev/bus/usb:/dev/bus/usb:rwm", "/dev/mem:/dev/mem:rw"], "snapshot_exclude": ["/data/otau/*"], "options": { - "device": null, - "vnc_password": "" + "device": null }, "schema": { "device": "str", - "vnc_password": "str", "dbg_aps": "int?", "dbg_info": "int?", "dbg_otau": "int?", diff --git a/deconz/rootfs/etc/cont-init.d/novnc.sh b/deconz/rootfs/etc/cont-init.d/novnc.sh new file mode 100644 index 0000000..c133526 --- /dev/null +++ b/deconz/rootfs/etc/cont-init.d/novnc.sh @@ -0,0 +1,7 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# Setup noVNC +# ============================================================================== +declare ingress_entry +ingress_entry=$(bashio::addon.ingress_entry) +sed -i "s#websockify#${ingress_entry#?}/novnc/websockify#g" /usr/share/novnc/vnc_lite.html diff --git a/deconz/rootfs/etc/cont-init.d/vnc.sh b/deconz/rootfs/etc/cont-init.d/vnc.sh deleted file mode 100644 index 63844aa..0000000 --- a/deconz/rootfs/etc/cont-init.d/vnc.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/with-contenv bashio -# ============================================================================== -# Configure VNC for use with deCONZ -# ============================================================================== - -# Check if VNC is enabled -VNC_PORT="$(bashio::addon.port 5900)" -if ! bashio::var.has_value "${VNC_PORT}"; then - # VNC is not enabled, skip this. - bashio::exit.ok -fi - -# Require password when VNC is enabled -if ! bashio::config.has_value 'vnc_password'; then - bashio::exit.nok "VNC has been enabled, but no password has been set!" -fi - -VNC_PASSWORD=$(bashio::config 'vnc_password') -echo "${VNC_PASSWORD}" | tigervncpasswd -f > /root/.vncpasswd \ No newline at end of file diff --git a/deconz/rootfs/etc/nginx/nginx.conf b/deconz/rootfs/etc/nginx/nginx.conf index f41dc6d..e570219 100644 --- a/deconz/rootfs/etc/nginx/nginx.conf +++ b/deconz/rootfs/etc/nginx/nginx.conf @@ -43,6 +43,19 @@ http { proxy_set_header Connection $connection_upgrade; } + location /novnc { + proxy_pass http://127.0.0.1:5901/; + proxy_redirect default; + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + } + + location =/ingress.html { + root /usr/share/www/; + } + location / { proxy_pass http://127.0.0.1:40850; proxy_redirect default; diff --git a/deconz/rootfs/etc/services.d/deconz/run b/deconz/rootfs/etc/services.d/deconz/run index 63e1ce1..f923a54 100644 --- a/deconz/rootfs/etc/services.d/deconz/run +++ b/deconz/rootfs/etc/services.d/deconz/run @@ -2,13 +2,15 @@ # ============================================================================== # Start deCONZ service # ============================================================================== +TMP_FOLDER=$(mktemp -d) # Lookup udev link -bashio::log.info "Waiting for device..." DECONZ_DEVICE=$(bashio::config 'device') if [[ -c "${DECONZ_DEVICE}" ]]; then bashio::log.debug "Specified device points to a character special file, continuing" else + bashio::log.info "Waiting for device..." + # 180 second timeout to wait for udev to finish processing timeout=180 while [[ ! -L "${DECONZ_DEVICE}" ]]; do @@ -23,6 +25,45 @@ else bashio::log.debug "Found device! Location: ${DECONZ_DEVICE}" fi +# VNC is not enabled as a seperate service, as it cannot handle multiple +# session when running in the foreground. +VNC_PORT="$(bashio::addon.port 5900)" +ARCH="$(bashio::info.arch)" + +# Fix tigervnc for 32 bits ARM +if [[ "armhf armv7" = *"${ARCH}"* ]]; then + export LD_PRELOAD=/lib/arm-linux-gnueabihf/libgcc_s.so.1 +fi + +# Fix tigervnc for 64 bits ARM +if [[ "aarch64" = "${ARCH}" ]]; then + export LD_PRELOAD=/lib/aarch64-linux-gnu/libgcc_s.so.1 +fi + +# Run it only on localhost if not expose +if bashio::var.has_value "${VNC_PORT}"; then + LOCAL_ONLY=no +else + LOCAL_ONLY=yes +fi + +export XDG_RUNTIME_DIR="${TMP_FOLDER}" +export DISPLAY=":0" + +bashio::log.info "Starting VNC server (local/${LOCAL_ONLY})..." +tigervncserver \ + -name "Home Assistant - deCONZ" \ + -geometry 1920x1080 \ + -depth 16 \ + -localhost ${LOCAL_ONLY} \ + -SecurityTypes None \ + "${DISPLAY}" \ + &> /dev/null + +# Wait for VNC server to start before continuing +bashio::log.info "deCONZ waiting for VNC to start" +bashio::net.wait_for 5900 + # Load debug values bashio::config.has_value 'dbg_info' \ && DBG_INFO="$(bashio::config 'dbg_info')" || DBG_INFO=1 @@ -35,52 +76,13 @@ bashio::config.has_value 'dbg_zcl' \ bashio::config.has_value 'dbg_zdp' \ && DBG_ZDP="$(bashio::config 'dbg_zdp')" || DBG_ZDP=0 - -# Check if VNC is enabled -# VNC is not enabled as a seperate service, as it cannot handle multiple -# session when running in the foreground. -PLATFORM="minimal" -VNC_PORT="$(bashio::addon.port 5900)" -if bashio::var.has_value "${VNC_PORT}"; then - ARCH="$(bashio::info.arch)" - TMP_FOLDER=$(mktemp -d) - export XDG_RUNTIME_DIR="${TMP_FOLDER}" - export DISPLAY=":0" - PLATFORM="xcb" - - # Fix tigervnc for 32 bits ARM - if [[ "armhf armv7" = *"${ARCH}"* ]]; then - export LD_PRELOAD=/lib/arm-linux-gnueabihf/libgcc_s.so.1 - fi - - # Fix tigervnc for 64 bits ARM - if [[ "aarch64" = "${ARCH}" ]]; then - export LD_PRELOAD=/lib/aarch64-linux-gnu/libgcc_s.so.1 - fi - - bashio::log.info "Starting VNC server..." - tigervncserver \ - -name "Home Assistant - deCONZ" \ - -geometry 1920x1080 \ - -depth 16 \ - -localhost no \ - -PasswordFile /root/.vncpasswd \ - "${DISPLAY}" \ - &> /dev/null - - # Wait for VNC server to start before continuing - bashio::log.info "Waiting for VNC to start" - bashio::net.wait_for "${VNC_PORT}" -fi - - # Send out discovery information to Home Assistant ./discovery & # Start deCONZ bashio::log.info "Starting the deCONZ gateway..." exec deCONZ \ - -platform "${PLATFORM}" \ + -platform "xcb" \ --auto-connect=1 \ --dbg-info="${DBG_INFO}" \ --dbg-aps="${DBG_APS}" \ diff --git a/deconz/rootfs/etc/services.d/otau-deconz/finish b/deconz/rootfs/etc/services.d/otau-deconz/finish deleted file mode 100644 index a29ced9..0000000 --- a/deconz/rootfs/etc/services.d/otau-deconz/finish +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/execlineb -S1 -# ============================================================================== -# Take down the S6 supervision tree based on service exit code -# ============================================================================== -if { s6-test ${1} -ne 0 } -if { s6-test ${1} -ne 256 } - -s6-svscanctl -t /var/run/s6/services diff --git a/deconz/rootfs/etc/services.d/otau-ikea/finish b/deconz/rootfs/etc/services.d/otau-ikea/finish deleted file mode 100644 index a29ced9..0000000 --- a/deconz/rootfs/etc/services.d/otau-ikea/finish +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/execlineb -S1 -# ============================================================================== -# Take down the S6 supervision tree based on service exit code -# ============================================================================== -if { s6-test ${1} -ne 0 } -if { s6-test ${1} -ne 256 } - -s6-svscanctl -t /var/run/s6/services diff --git a/deconz/rootfs/etc/services.d/otau-ledvance/finish b/deconz/rootfs/etc/services.d/otau-ledvance/finish deleted file mode 100644 index a29ced9..0000000 --- a/deconz/rootfs/etc/services.d/otau-ledvance/finish +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/execlineb -S1 -# ============================================================================== -# Take down the S6 supervision tree based on service exit code -# ============================================================================== -if { s6-test ${1} -ne 0 } -if { s6-test ${1} -ne 256 } - -s6-svscanctl -t /var/run/s6/services diff --git a/deconz/rootfs/etc/services.d/udev/finish b/deconz/rootfs/etc/services.d/udev/finish deleted file mode 100644 index a29ced9..0000000 --- a/deconz/rootfs/etc/services.d/udev/finish +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/execlineb -S1 -# ============================================================================== -# Take down the S6 supervision tree based on service exit code -# ============================================================================== -if { s6-test ${1} -ne 0 } -if { s6-test ${1} -ne 256 } - -s6-svscanctl -t /var/run/s6/services diff --git a/deconz/rootfs/etc/services.d/websockify/run b/deconz/rootfs/etc/services.d/websockify/run new file mode 100644 index 0000000..d75921d --- /dev/null +++ b/deconz/rootfs/etc/services.d/websockify/run @@ -0,0 +1,11 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# Start ozw-admin +# ============================================================================== + +# Wait until ozwadmin is up and running +bashio::log.info "Websockify waiting for VNC to start" +bashio::net.wait_for 5900 + +bashio::log.info "Starting websockify..." +exec websockify -v --web /usr/share/novnc/ 127.0.0.1:5901 127.0.0.1:5900 diff --git a/deconz/rootfs/usr/share/www/ingress.html b/deconz/rootfs/usr/share/www/ingress.html new file mode 100644 index 0000000..da9f40a --- /dev/null +++ b/deconz/rootfs/usr/share/www/ingress.html @@ -0,0 +1,14 @@ + + + + +

Zigbee network by Dresden Elektronik

+

You can use the webui Phoscon or the VNC based deCONZ

+ +
+ Phoscon
+ deCONZ +
+ + + \ No newline at end of file