It's a simple (and primitive) script to control your hue lights around your home. The script is as described earlier, "primitive", as I'm still early in my studies around python, but wanted to experiment with current knowledge.
Basic Functions include;
- Toggling the light selected on/ off.
- Changing the colour of a light based on pre-sets configured in the script.
Below are the features I'll be looking to implement in the future;
- Custom colour presets created by user.
- Easier switching of colour's pre-defined.
- Targeting defined groups of lights, instead of single entities.
- Bug smashing and an easier to navigate/ use menu system.
- Locate your Hue bridge IP address.
- If you know this already, please ignore this step.
- If you do now know the IP, you can use Hue's broker server which will give this to you
- Using the IP you now have for the bridge, in your browser, head to: https://bridge-IP-address/debug/clip.html replacing the "bridge IP address with your own IP."
- Create a new user/ key to use with your bridge.
- in the URL textbox, set it to /api
- In the message body, insert the following, changing the details of the app name and username to whatever you choose.
- {"devicetype":"my_hue_app#iphone peter"}
- Click the POST button at the top of the menu
- You may be required to press the button on the hue bridge to sync.
- Once done, you'll be provided with an API key. Copy this.
- Create a secrets.py file in the same dir as the lights.py file, create the below variables;
- key
- Input your API key obtained earlier, into this variable.
- Example: key = "xx123xxx123xxx"
- Input your API key obtained earlier, into this variable.
- ip
- Input your Hue bridge IP address.
- Example: ip = "192.168.1.100"
- Input your Hue bridge IP address.
- key
If the lights.py script doesn't open, or immediately closes, you may be required to pip install "requests" and any other libraries.