This project enables you to control Nanoleaf lights using ChatGPT. You can issue text prompts to control what is shown on your lights. This project uses Python built-in libraries, there is no requirements except both Nanoleaf and OpenAI keys. Please refer to the Nanoleaf API Guide for info on how to obtain your device's API key.
The Nanoleaf Control with ChatGPT project bridges the gap between smart lighting and advanced AI communication. By leveraging the capabilities of ChatGPT, users can interact with their Nanoleaf lights by prompting the AI to display colors and patterns.
Follow these steps to set up the project and start controlling your Nanoleaf lights with ChatGPT:
- Python 3.7 or higher
- Requests library
pip install requests
- Nanoleaf API access token (use authhelper.py to obtain this)
- OpenAI API key for ChatGPT access
-
Set up environment variables:
Linux/Mac
Open the terminal in the project directory, and run:
export NANOLEAF_IP=<your light's IP> export NANOLEAF_KEY=<your nanoleaf key obtained with authhelper.py> export API_KEY=<your openai key>
Windows
Open Command Prompt in the project directory, and run:
SET NANOLEAF_IP=<your light's IP> SET NANOLEAF_KEY=<your nanoleaf key obtained with authhelper.py> SET API_KEY=<your openai key>
-
Run the application demo:
python3 nanoleaf.py
Once the installation is complete, you can start using the application to control your Nanoleaf lights via ChatGPT. Here are some example prompts you can use:
-
A red to blue gradient:
A red to blue gradient, with red on top and blue on the bottom.
-
Change the color to green:
All green
-
A rainbow:
Make a full rainbow, red at the top, violet at the bottom
This project is licensed under the MIT License. See the LICENSE file for details.
Thank you for using the NanoleafGPT project! Please credit the author of this project if you plan to use this in other projects.