Moved --data flag into curl function.
This commit is contained in:
parent
c66362f87d
commit
471e5dae50
1 changed files with 6 additions and 6 deletions
12
wled
12
wled
|
@ -33,13 +33,13 @@ commands:
|
|||
|
||||
curl_fetch() {
|
||||
curl --silent --show-error --fail --ipv4 --max-filesize 32768 \
|
||||
--max-redirs 0 --header 'Accept: application/json' "$@"
|
||||
--max-redirs 0 --header 'Accept: application/json' "$1"
|
||||
}
|
||||
|
||||
curl_send() {
|
||||
curl --silent --show-error --fail --ipv4 --max-filesize 1024 \
|
||||
--max-redirs 0 --header 'Accept: application/json' \
|
||||
--header 'Content-Type: application/json' "$@"
|
||||
--header 'Content-Type: application/json' --data "$1" "$2"
|
||||
}
|
||||
|
||||
active_preset() {
|
||||
|
@ -76,10 +76,10 @@ esac
|
|||
# Parse and execute command argument.
|
||||
case "$2" in
|
||||
on) # Switch on.
|
||||
api_resp=$(curl_send --data '{"on":true}' "http://$wled_host/json")
|
||||
api_resp=$(curl_send '{"on":true}' "http://$wled_host/json")
|
||||
;;
|
||||
off) # Switch off.
|
||||
api_resp=$(curl_send --data '{"on":false}' "http://$wled_host/json")
|
||||
api_resp=$(curl_send '{"on":false}' "http://$wled_host/json")
|
||||
;;
|
||||
-b|--brightness) # Set brightness.
|
||||
if test -z "$3"; then
|
||||
|
@ -95,10 +95,10 @@ case "$2" in
|
|||
echo "Error: parameter for brightness is out of range." >&2
|
||||
exit 1
|
||||
fi
|
||||
api_resp=$(curl_send --data "{'bri':$bright}" "http://$wled_host/json")
|
||||
api_resp=$(curl_send "{'bri':$bright}" "http://$wled_host/json")
|
||||
;;
|
||||
[1-9]|1[0-7]) # Switch to preset.
|
||||
api_resp=$(curl_send --data "{'ps':$2}" "http://$wled_host/json")
|
||||
api_resp=$(curl_send "{'ps':$2}" "http://$wled_host/json")
|
||||
;;
|
||||
l|list) # List presets.
|
||||
printf "loading ...\r"
|
||||
|
|
Loading…
Reference in a new issue