keywords: zigbee, zigbee2mqtt, freenas, truenas, jail,
Enhanced version of jail's poststart script.
#!/bin/bash | |
function get_tty () { | |
local vendor="${1}" | |
local product="${2}" | |
# return the tty{} value, eg; U2 | |
sysctl dev.uchcom dev.umodem | grep "vendor=${vendor} product=${product}" | sed -r 's/.*ttyname=([^\s]+) .*/\1/' | |
} | |
function create_symlink () { | |
local source="${1}" | |
# failsafe | |
if [ "${source}" == 'tty' ]; then return; fi | |
local target="/mnt/server/iocage/jails/domoticz/root/dev/${2}" | |
if [ -e "${target}" ]; then rm -f "${target}"; fi | |
ln -s "${source}" "${target}" | |
} | |
# rflink is an arduino mega | |
create_symlink "tty$(get_tty '0x2341' '0x0010')" "ttyUrflink" | |
# zigbee is a Texas Instrument CC2531 | |
create_symlink "tty$(get_tty '0x0451' '0x16a8')" "ttyUzigbee" | |
# zwave is a Z-Stick Gen 5 | |
# note: it needs the 'cua' device in domoticz, not the tty device | |
create_symlink "cua$(get_tty '0x0658' '0x0200')" "cuaUzwave" | |
# zigbee is a cc2652p | |
create_symlink "tty$(get_tty '0x1a86' '0x7523')" "ttyUzigbee" |
From cf7440205902b842bc6910dd50b2bf5c322fe08c Mon Sep 17 00:00:00 2001 | |
From: partikus <partikus@users.noreply.github.com> | |
Date: Thu, 4 Mar 2021 12:22:42 +0100 | |
Subject: [PATCH] | |
--- | |
domoticz-poststart.sh | 6 ++++-- | |
1 file changed, 4 insertions(+), 2 deletions(-) | |
diff --git a/domoticz-poststart.sh b/domoticz-poststart.sh | |
index 9e207aa..b49f4b1 100644 | |
--- a/domoticz-poststart.sh | |
+++ b/domoticz-poststart.sh | |
@@ -4,7 +4,7 @@ function get_tty () { | |
local vendor="${1}" | |
local product="${2}" | |
# return the tty{} value, eg; U2 | |
- sysctl dev.umodem | grep "vendor=${vendor} product=${product}" | sed -r 's/.*ttyname=([^\s]+) .*/\1/' | |
+ sysctl dev.uchcom dev.umodem | grep "vendor=${vendor} product=${product}" | sed -r 's/.*ttyname=([^\s]+) .*/\1/' | |
} | |
function create_symlink () { | |
@@ -22,4 +22,6 @@ create_symlink "tty$(get_tty '0x2341' '0x0010')" "ttyUrflink" | |
create_symlink "tty$(get_tty '0x0451' '0x16a8')" "ttyUzigbee" | |
# zwave is a Z-Stick Gen 5 | |
# note: it needs the 'cua' device in domoticz, not the tty device | |
-create_symlink "cua$(get_tty '0x0658' '0x0200')" "cuaUzwave" | |
\ No newline at end of file | |
+create_symlink "cua$(get_tty '0x0658' '0x0200')" "cuaUzwave" | |
+# zigbee is a cc2652p | |
+create_symlink "tty$(get_tty '0x1a86' '0x7523')" "ttyUzigbee" | |
\ No newline at end of file | |
-- | |
2.28.0 |