Update use device on/off

This commit is contained in:
Hans Karlinius
2025-06-07 06:02:15 +02:00
parent 648879ce83
commit dba1529139
2 changed files with 2 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ if bashio::config.has_value 'usbdevices'; then
usbdevices_json=$(echo $options | jq -c '.usbdevices[]')
readarray -t usbdevices < <(echo "$usbdevices_json")
mapfile -t inuse_devices < <(/usr/bin/vh_list_inuse_devices)
bashio::log.info "Devices in use - ${inuse_devices[@]}"
for usbdevice in "${usbdevices[@]}"; do
use=$(echo $usbdevice | jq '. | if .use then true else false end')
device=$(echo $usbdevice | jq '.device | tostring')

View File

@@ -1,4 +1,3 @@
#!/command/with-contenv bashio
result=$(/usr/bin/vhclient -t list | awk '{ if ($1 ~ /\*-->/) { print substr($0, 8, index($0, "(In-use by you)") - 9 ) } }')
bashio::log.info "List device in use - ${result}"
/usr/bin/vhclient -t list | awk '{ if ($1 ~ /\*-->/) { print substr($0, 8, index($0, "(In-use by you)") - 9 ) } }'