summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2026-03-27 20:03:04 +0100
committerTom Smeding <tom@tomsmeding.com>2026-03-27 20:03:04 +0100
commit9f758a3ec0e549f22d1285662f05b0b51a1852df (patch)
tree75534936ece960558d9d8ada7924bd1f43e00696
parentfe6d2c66791763b69dba1db169cef22c2102645d (diff)
Match scene at start of scene name
-rwxr-xr-xset.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/set.sh b/set.sh
index 63da2c0..351e001 100755
--- a/set.sh
+++ b/set.sh
@@ -31,7 +31,7 @@ fi
if [[ $1 = "-s" ]]; then
namesubstr=$2
scenes=$(hue_request resource/scene | jq -r '.data.[] | .id + " " + .metadata.name')
- matches=$(cut -d' ' -f2- <<<"$scenes" | grep -niF "$namesubstr" | cut -d: -f1 || true)
+ matches=$(cut -d' ' -f2- <<<"$scenes" | grep -ni "^$namesubstr" | cut -d: -f1 || true)
[[ $(wc -l <<<"$matches") -gt 1 ]] && { echo >&2 "Multiple scenes matched, name must be unambiguous"; exit 1; }
sceneid=$(sed -n "$matches s/ .*//p" <<<"$scenes")
hue_request resource/scene/"$sceneid" PUT '{"recall":{"action":"active"}}' >/dev/null