Simplified active_preset().

This commit is contained in:
Shy 2024-08-06 10:56:01 +02:00
parent d08e07fd72
commit 24b3b8c945

5
wled
View file

@ -38,10 +38,9 @@ curl_cmd() {
active_preset() { active_preset() {
# Find number of active preset. API returns -1 if none is active, we return # Find number of active preset. API returns -1 if none is active, we return
# an empty string. # an empty string.
preset="$(curl_cmd "http://$1/json" | \ curl_cmd "http://$1/json" | \
# -1 will be a no-match. # -1 will be a no-match.
sed -n 's/.*"ps"[[:space:]]*:[[:space:]]*\(1\?[0-9]\).*/\1/p')" sed -n 's/.*"ps"[[:space:]]*:[[:space:]]*\(1\?[0-9]\).*/\1/p'
printf '%u' "$preset"
} }
# Parse host argument. # Parse host argument.