Voice command for LIFX.
Lights is a simple Python program that uses voice recognition to turn on your LIFX bulbs. Alexa and Google Home have this functionality available out of the box, but why not code it yourself?
Lights consists of only four files:
lights.py- Python script that runs the program.helper.py- Reads the configuration token and user-defined command to toggle the lights.request.py- Contains the logic and API request functions.config.json- Contains the LIFX OAuth token and user-defined command to toggle the lights.
The request.py file uses Uberi's Speech Recognition module for Python.
- Install Uberi's Speech Recognition module:
pip install SpeechRecognition. - Clone this repo.
- Edit
config.jsonwith your LIFX OAuth token. If you don't have a token, you can easily generate one here: LIFX Cloud Settings - Run the program:
python lights.py. - Irreverently declare "let there be light."
Note that the LIFX API only allows for a toggle. Therefore "let there be light" will turn the lights on as well as off. Bummer.