Update use device on/off

This commit is contained in:
Hans Karlinius
2025-06-06 14:18:42 +02:00
parent de36df872c
commit 4da92371ac
3 changed files with 13 additions and 1 deletions

View File

@@ -8,7 +8,7 @@ fi
autouse=$(bashio::cache.get autouse)
if $autouse; then
bashio::log.info "AutoShare enabled, will not use devices from configuration"
bashio::log.info "AutoShare All enabled, will not use devices from configuration"
exit 0
fi
@@ -21,6 +21,12 @@ if bashio::config.has_value 'usbdevices'; then
use=$(echo $usbdevice | jq '. | if .use then true else false end')
device=$(echo $usbdevice | jq '.device | tostring')
deviceid=$(echo $device | sed 's/.*(\(.*\)).*/\1/g')
server_serial=$(/usr/bin/vh_server_serial_number ${deviceid%.*})
device2=$(/usr/bin/vh_usb_product_vendor $deviceid)
deviceid2=$(server_serial.$device2)
bashio::log.info "GURKA-${deviceid2}"
if $use; then
bashio::log.info "AUTO USE DEVICE,${deviceid}"
/usr/bin/vhclient -t "AUTO USE DEVICE,${deviceid}"

View File

@@ -0,0 +1,3 @@
#!/command/with-contenv bashio
/usr/bin/vhclient -t "server info,$1" | awk '{ if ($0 ~ /SERIAL NUMBER/) { print $3 } }'

View File

@@ -0,0 +1,3 @@
#!/command/with-contenv bashio
/usr/bin/vhclient -t "device info,$1" | awk '{ if ($0 ~ /PRODUCT ID/) { p=$3 } if ($0 ~ /VENDOR ID/) { v=$3 } } END { printf("%d.%d",p,v) }'