Skip to content

Instantly share code, notes, and snippets.

@yumu19
Created December 1, 2014 11:45
Show Gist options
  • Save yumu19/803834858233b7809eff to your computer and use it in GitHub Desktop.
Save yumu19/803834858233b7809eff to your computer and use it in GitHub Desktop.
shell script of access hue API in radihue
IPADDR="10.1.100.101"
NUM=$1
SAT=$2
BRI=$3
HUE=$4
i=0
QUERY="{\"on\":true, \"sat\":${SAT}, \"bri\":${BRI}, \"hue\":${HUE}}"
echo ${QUERY}
while [ $i -lt 555555 ]
do
curl -v -H "Content-type: application/json" -X PUT -d "${QUERY}" http://${IPADDR}/api/newdeveloper/lights/${NUM}/state
sleep 1s
i=`expr $i + 1`
done
QUERY="{\"on\":true, \"sat\":0, \"bri\":0, \"hue\":${HUE}}"
curl -v -H "Content-type: application/json" -X PUT -d "${QUERY}" http://${IPADDR}/api/newdeveloper/lights/${NUM}/state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment