mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-17 13:14:21 +01:00
Add novnc support deCONZ & rework ingress (#1505)
* Add novnc support deCONZ & rework ingress * add page * rename index to ingress * fix issues * fix vnc setup * Fix config * fix lint * Fix docs
This commit is contained in:
@@ -90,7 +90,7 @@ function run_supervisor() {
|
|||||||
-e SUPERVISOR_SHARE="/workspaces/test_hassio" \
|
-e SUPERVISOR_SHARE="/workspaces/test_hassio" \
|
||||||
-e SUPERVISOR_NAME=hassio_supervisor \
|
-e SUPERVISOR_NAME=hassio_supervisor \
|
||||||
-e SUPERVISOR_DEV=1 \
|
-e SUPERVISOR_DEV=1 \
|
||||||
-e HOMEASSISTANT_REPOSITORY="homeassistant/qemux86-64-homeassistant" \
|
-e SUPERVISOR_MACHINE="qemux86-64" \
|
||||||
homeassistant/amd64-hassio-supervisor:dev
|
homeassistant/amd64-hassio-supervisor:dev
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 6.2.0
|
||||||
|
|
||||||
|
- Enable VNC per default
|
||||||
|
- Ingress entry page to select noVNC or Phoscon
|
||||||
|
|
||||||
## 6.1.2
|
## 6.1.2
|
||||||
|
|
||||||
- Disable default init system
|
- Disable default init system
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ To enable it:
|
|||||||
- Set a port number for VNC in the "Network" configuration section of the
|
- 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
|
add-on and hit "SAVE". Advised is to use port 5900, but any other port above
|
||||||
5900 works as well.
|
5900 works as well.
|
||||||
- Set a VNC password in the add-on configuration and hit "SAVE".
|
|
||||||
- Restart the add-on.
|
- Restart the add-on.
|
||||||
|
|
||||||
To access it, you need a [VNC Viewer][vnc-viewer] application. If you are using
|
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
|
```yaml
|
||||||
device: /dev/ttyUSB0
|
device: /dev/ttyUSB0
|
||||||
vnc_password: ""
|
|
||||||
dbg_aps: 1
|
dbg_aps: 1
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ RUN apt-get update \
|
|||||||
lsof \
|
lsof \
|
||||||
netcat \
|
netcat \
|
||||||
nginx \
|
nginx \
|
||||||
|
novnc \
|
||||||
sqlite3 \
|
sqlite3 \
|
||||||
tigervnc-common \
|
tigervnc-common \
|
||||||
tigervnc-standalone-server \
|
tigervnc-standalone-server \
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "deCONZ",
|
"name": "deCONZ",
|
||||||
"version": "6.1.2",
|
"version": "6.2.0",
|
||||||
"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"],
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
"boot": "auto",
|
"boot": "auto",
|
||||||
"init": false,
|
"init": false,
|
||||||
"ingress": true,
|
"ingress": true,
|
||||||
"ingress_entry": "pwa/index.html",
|
"ingress_entry": "ingress.html",
|
||||||
"panel_icon": "mdi:zigbee",
|
"panel_icon": "mdi:zigbee",
|
||||||
"homeassistant": "0.91.2",
|
"homeassistant": "0.91.2",
|
||||||
"discovery": ["deconz"],
|
"discovery": ["deconz"],
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
"40850/tcp": null
|
"40850/tcp": null
|
||||||
},
|
},
|
||||||
"ports_description": {
|
"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)",
|
"8081/tcp": "deCONZ WebSocket (Not required for Ingress)",
|
||||||
"40850/tcp": "deCONZ API backend (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"],
|
"devices": ["/dev/bus/usb:/dev/bus/usb:rwm", "/dev/mem:/dev/mem:rw"],
|
||||||
"snapshot_exclude": ["/data/otau/*"],
|
"snapshot_exclude": ["/data/otau/*"],
|
||||||
"options": {
|
"options": {
|
||||||
"device": null,
|
"device": null
|
||||||
"vnc_password": ""
|
|
||||||
},
|
},
|
||||||
"schema": {
|
"schema": {
|
||||||
"device": "str",
|
"device": "str",
|
||||||
"vnc_password": "str",
|
|
||||||
"dbg_aps": "int?",
|
"dbg_aps": "int?",
|
||||||
"dbg_info": "int?",
|
"dbg_info": "int?",
|
||||||
"dbg_otau": "int?",
|
"dbg_otau": "int?",
|
||||||
|
|||||||
7
deconz/rootfs/etc/cont-init.d/novnc.sh
Normal file
7
deconz/rootfs/etc/cont-init.d/novnc.sh
Normal file
@@ -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
|
||||||
@@ -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
|
|
||||||
@@ -43,6 +43,19 @@ http {
|
|||||||
proxy_set_header Connection $connection_upgrade;
|
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 / {
|
location / {
|
||||||
proxy_pass http://127.0.0.1:40850;
|
proxy_pass http://127.0.0.1:40850;
|
||||||
proxy_redirect default;
|
proxy_redirect default;
|
||||||
|
|||||||
@@ -2,13 +2,15 @@
|
|||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Start deCONZ service
|
# Start deCONZ service
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
TMP_FOLDER=$(mktemp -d)
|
||||||
|
|
||||||
# Lookup udev link
|
# Lookup udev link
|
||||||
bashio::log.info "Waiting for device..."
|
|
||||||
DECONZ_DEVICE=$(bashio::config 'device')
|
DECONZ_DEVICE=$(bashio::config 'device')
|
||||||
if [[ -c "${DECONZ_DEVICE}" ]]; then
|
if [[ -c "${DECONZ_DEVICE}" ]]; then
|
||||||
bashio::log.debug "Specified device points to a character special file, continuing"
|
bashio::log.debug "Specified device points to a character special file, continuing"
|
||||||
else
|
else
|
||||||
|
bashio::log.info "Waiting for device..."
|
||||||
|
|
||||||
# 180 second timeout to wait for udev to finish processing
|
# 180 second timeout to wait for udev to finish processing
|
||||||
timeout=180
|
timeout=180
|
||||||
while [[ ! -L "${DECONZ_DEVICE}" ]]; do
|
while [[ ! -L "${DECONZ_DEVICE}" ]]; do
|
||||||
@@ -23,6 +25,45 @@ else
|
|||||||
bashio::log.debug "Found device! Location: ${DECONZ_DEVICE}"
|
bashio::log.debug "Found device! Location: ${DECONZ_DEVICE}"
|
||||||
fi
|
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
|
# Load debug values
|
||||||
bashio::config.has_value 'dbg_info' \
|
bashio::config.has_value 'dbg_info' \
|
||||||
&& DBG_INFO="$(bashio::config 'dbg_info')" || DBG_INFO=1
|
&& 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' \
|
bashio::config.has_value 'dbg_zdp' \
|
||||||
&& DBG_ZDP="$(bashio::config 'dbg_zdp')" || DBG_ZDP=0
|
&& 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
|
# Send out discovery information to Home Assistant
|
||||||
./discovery &
|
./discovery &
|
||||||
|
|
||||||
# Start deCONZ
|
# Start deCONZ
|
||||||
bashio::log.info "Starting the deCONZ gateway..."
|
bashio::log.info "Starting the deCONZ gateway..."
|
||||||
exec deCONZ \
|
exec deCONZ \
|
||||||
-platform "${PLATFORM}" \
|
-platform "xcb" \
|
||||||
--auto-connect=1 \
|
--auto-connect=1 \
|
||||||
--dbg-info="${DBG_INFO}" \
|
--dbg-info="${DBG_INFO}" \
|
||||||
--dbg-aps="${DBG_APS}" \
|
--dbg-aps="${DBG_APS}" \
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
11
deconz/rootfs/etc/services.d/websockify/run
Normal file
11
deconz/rootfs/etc/services.d/websockify/run
Normal file
@@ -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
|
||||||
14
deconz/rootfs/usr/share/www/ingress.html
Normal file
14
deconz/rootfs/usr/share/www/ingress.html
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h2>Zigbee network by Dresden Elektronik</h2>
|
||||||
|
<p>You can use the webui Phoscon or the VNC based deCONZ</p>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a href="pwa/index.html">Phoscon</a></br>
|
||||||
|
<a href="novnc/vnc_lite.html">deCONZ</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user