Skip to content

Instantly share code, notes, and snippets.

@lucaspiller
Created July 20, 2016 15:25
Show Gist options
  • Save lucaspiller/e00b2d6f39907fea54391fe1b29f6cea to your computer and use it in GitHub Desktop.
Save lucaspiller/e00b2d6f39907fea54391fe1b29f6cea to your computer and use it in GitHub Desktop.
Lightify GU10 - Pair with Hue hub and test
#!/bin/bash
bridgeuser="" # Bridge user, see the API docs for this http://www.developers.meethue.com/documentation/configuration-api#71_create_user
bridgeip="" # Bridge IP address
lamp=$1 # The lamp number, usage ./find-test 5
curl -X POST "http://$bridgeip/api/$bridgeuser/lights"
echo $?
# Press enter once the bulb flashes
read -e
echo "OFF"
curl -s -d "{\"on\":false,\"transitiontime\":0}" -X PUT "http://$bridgeip/api/$bridgeuser/lights/$lamp/state"
sleep 0.5
echo "ON"
curl -s -d "{\"on\":true,\"bri\":1,\"transitiontime\":0}" -X PUT "http://$bridgeip/api/$bridgeuser/lights/$lamp/state"
sleep 0.5
echo "FULL BRIGHTNESS"
curl -s -d "{\"bri\":254,\"transitiontime\":1}" -X PUT "http://$bridgeip/api/$bridgeuser/lights/$lamp/state"
sleep 1
echo "50% BRIGHTNESS"
curl -s -d "{\"bri\":128,\"transitiontime\":1}" -X PUT "http://$bridgeip/api/$bridgeuser/lights/$lamp/state"
sleep 1
echo "5000K"
curl -s -d "{\"ct\":153,\"transitiontime\":2}" -X PUT "http://$bridgeip/api/$bridgeuser/lights/$lamp/state"
sleep 2
echo "2700K"
curl -s -d "{\"ct\":370,\"transitiontime\":2}" -X PUT "http://$bridgeip/api/$bridgeuser/lights/$lamp/state"
sleep 2
echo "10% BRIGHTNESS"
curl -s -d "{\"bri\":25,\"transitiontime\":1}" -X PUT "http://$bridgeip/api/$bridgeuser/lights/$lamp/state"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment