This project provides a Docker wrapper for the python-miio library, allowing easy interaction with Mi Home devices, particularly Yeelight smart lights, across different platforms.
Yeelight is a brand of smart LED bulbs that can be controlled remotely via Wi-Fi. This tool allows you to control your Yeelight devices using simple command-line instructions.
- Prerequisites
- Finding Your Device's IP and Token
- Usage
- Available Commands
- Using the Published Image
- Updating the Image
- Notes
- Contributing
- License
- Docker installed on your system
- A Yeelight device on your local network
Before you can control your Yeelight device, you need to know its IP address and token:
Refer to the python-miio token extraction guide for detailed instructions.
-
Build the image:
docker build -t lights -f Dockerfile . -
Run the container with the following command:
docker run --rm lights [COMMAND] [OPTIONS]
Replace
[COMMAND]and[OPTIONS]with the specific miiocli command and options you want to use. -
To control a Yeelight device, use the following format:
docker run --rm lights yeelight --ip [YOUR_DEVICE_IP] --token [YOUR_DEVICE_TOKEN] [COMMAND]
For example, to turn on a Yeelight bulb:
docker run --rm lights yeelight --ip 192.168.0.XX --token xxxxxxxx on
Here are some of the available commands for Yeelight devices:
on: Power on the deviceoff: Power off the devicetoggle: Toggle the device stateset_brightness: Set the brightness levelset_color_temp: Set the color temperature in Kelvinset_rgb: Set the color in RGBstatus: Retrieve device properties
For a full list of commands and options, run:
docker run --rm lights yeelight --helpThis image is published on Docker Hub as mrugesh/lights. To use the published image instead of building it locally, replace the docker run commands above with:
docker run --rm mrugesh/lights [COMMAND] [OPTIONS]For example:
docker run --rm mrugesh/lights yeelight --ip 192.168.0.XX --token xxxxxxxx on- Build the image locally:
docker build -t lights -f Dockerfile . - Tag and push to Docker Hub:
docker tag lights mrugesh/lights:latest docker push mrugesh/lights:latest
- Make sure your Yeelight device is on the same network as your Docker host.
- The
--tokenis required for authentication. You can find this token using the Mi Home app or other methods described in thepython-miiodocumentation. - This Docker image is designed to be stateless. Each command runs in a new container instance, which is removed after execution (
--rmflag).
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open-source and available under the MIT License.