Simplified check of API response.

This commit is contained in:
Shy 2024-08-03 23:24:07 +02:00
parent 11aa878e77
commit b3109c859e

6
wled
View file

@ -10,7 +10,7 @@ CURL_FLAGS="--silent --show-error --fail --ipv4 --max-filesize 64K"
print_usage() {
echo "Usage: $0 f(nordcenter)|w(ohnzimmer) on|off|1-17|list"
echo " $0 f(nordcenter)|w(ohnzimmer) b(rightness) [1-255]"
echo " $0 f(nordcenter)|w(ohnzimmer) b(rightness) 1-255"
}
# Parse host argument.
@ -90,8 +90,8 @@ if test $curl_exit -ne 0; then
exit 1
fi
# Check API responce. Should be {"success":true}.
if test "$(echo -n "$api_resp"|tr -c -d '[:alpha:]')" != 'successtrue'; then
# Check API responce.
if test "$api_resp" != '{"success":true}'; then
echo "Error: unexpected responce from WLED API." >&2
exit 1
fi