Python library for interfacing with Xiaomi smart appliances
Project description
This library (and its accompanying cli tool) can be used to interface with devices using Xiaomi’s miIO and miOT protocols.
Getting started
If you already have a token for your device and the device type, you can directly start using miiocli tool. If you don’t have a token for your device, refer to Getting started section of the manual for instructions how to obtain it.
The miiocli is the main way to execute commands from command line. You can always use –help to get more information about the available commands. For example, executing it without any extra arguments will print out options and available commands:
$ miiocli --help Usage: miiocli [OPTIONS] COMMAND [ARGS]... Options: -d, --debug -o, --output [default|json|json_pretty] --help Show this message and exit. Commands: airconditioningcompanion ..
You can get some information from any miIO/miOT device, including its device model, using the info command:
miiocli device --ip <ip> --token <token> info Model: some.device.model1 Hardware version: esp8285 Firmware version: 1.0.1_0012 Network: {'localIp': '<ip>', 'mask': '255.255.255.0', 'gw': '<ip>'} AP: {'rssi': -73, 'ssid': '<nnetwork>', 'primary': 11, 'bssid': '<bssid>'}
Each different device type is supported by their corresponding module (e.g., vacuum or fan). You can get the list of available commands for any given module by passing –help argument to it:
$ miiocli vacuum --help Usage: miiocli vacuum [OPTIONS] COMMAND [ARGS]... Options: --ip TEXT [required] --token TEXT [required] --id-file FILE --help Show this message and exit. Commands: add_timer Add a timer. ..
API usage
All functionality is accessible through the miio module:
from miio import Vacuum vac = Vacuum("<ip address>", "<token>") vac.start()
Each separate device type inherits from miio.Device (and in case of miOT devices, miio.MiotDevice) which provides common API.
Please refer to API documentation for more information.
Troubleshooting
You can find some solutions for the most common problems can be found in Troubleshooting section.
If you have any questions, or simply want to join up for a chat, check our Matrix room.
Contributing
We welcome all sorts of contributions from patches to add improvements or fixing bugs to improving the documentation. To ease the process of setting up a development environment we have prepared a short guide for getting you started.
Supported devices
Xiaomi Mi Robot Vacuum V1, S5, M1S
Xiaomi Mi Home Air Conditioner Companion
Xiaomi Mi Air Purifier
Xiaomi Aqara Camera
Xiaomi Aqara Gateway (basic implementation, alarm, lights)
Xiaomi Mijia 360 1080p
Xiaomi Mijia STYJ02YM (Viomi)
Xiaomi Mi Smart WiFi Socket
Xiaomi Chuangmi Plug V1 (1 Socket, 1 USB Port)
Xiaomi Chuangmi Plug V3 (1 Socket, 2 USB Ports)
Xiaomi Smart Power Strip V1 and V2 (WiFi, 6 Ports)
Xiaomi Philips Eyecare Smart Lamp 2
Xiaomi Philips RW Read (philips.light.rwread)
Xiaomi Philips LED Ceiling Lamp
Xiaomi Philips LED Ball Lamp (philips.light.bulb)
Xiaomi Philips LED Ball Lamp White (philips.light.hbulb)
Xiaomi Philips Zhirui Smart LED Bulb E14 Candle Lamp
Xiaomi Philips Zhirui Bedroom Smart Lamp
Xiaomi Universal IR Remote Controller (Chuangmi IR)
Xiaomi Mi Smart Pedestal Fan V2, V3, SA1, ZA1, ZA3, ZA4, P5
Xiaomi Mi Air Humidifier V1, CA1, CA4, CB1, MJJSQ, JSQ001
Xiaomi Mi Water Purifier (Basic support: Turn on & off)
Xiaomi PM2.5 Air Quality Monitor V1, B1, S1
Xiaomi Smart WiFi Speaker
Xiaomi Mi WiFi Repeater 2
Xiaomi Mi Smart Rice Cooker
Xiaomi Smartmi Fresh Air System VA2 (zhimi.airfresh.va2), T2017 (dmaker.airfresh.t2017)
Yeelight lights (basic support, we recommend using python-yeelight)
Xiaomi Mi Air Dehumidifier
Xiaomi Tinymu Smart Toilet Cover
Xiaomi 16 Relays Module
Xiaomi Xiao AI Smart Alarm Clock
Smartmi Radiant Heater Smart Version (ZA1 version)
Xiaomi Mi Smart Space Heater
Feel free to create a pull request to add support for new devices as well as additional features for supported devices.
Home Assistant support
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file python-miio-0.5.3.tar.gz
.
File metadata
- Download URL: python-miio-0.5.3.tar.gz
- Upload date:
- Size: 160.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.4 Linux/5.7.7-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3be5275b569844dfa267c80a1e23dc0957411dd501cae0ed3cccf43467031ceb |
|
MD5 | ea9d3b3e3113097d9a9c3cbc3184ed6d |
|
BLAKE2b-256 | 3b08f6c413a73ed9ebaad515929e207803a86ad9419e98a4e2767176421d9b15 |
File details
Details for the file python_miio-0.5.3-py3-none-any.whl
.
File metadata
- Download URL: python_miio-0.5.3-py3-none-any.whl
- Upload date:
- Size: 212.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.4 Linux/5.7.7-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b0a4a8d8e34a892c020fad2d2cb9cff1b2bad7cfae8d36a364e5aa77ca9b73a |
|
MD5 | 190fcee227d1b350b041e742428eac6f |
|
BLAKE2b-256 | 0c68dda208e029165947f4cbc6db08c10ae4359ce68c6bb34af005320ccd5aa1 |