855
/ 1000
快速安装
pip install python-roborock
1. 治理
100/200
2. PEP 元数据
200/200
3. 安全性
200/200
4. 文档与 SEO
155/200
5. CI 工程
200/200
📣 分享审计报告:
以当前语言分享此报告和可视化卡片
PyPI 遥测数据
下载量与社区采用率
最近 30 天(不含镜像)
最近 7 天
15258
最近 30 天
54423
总计(180天)
475744
健康与工程分析(5大支柱)
1. 治理与社区100 / 200 ▾
LICENSE✓ 50 pts
SECURITY.md✕ 0 pts
CONTRIBUTING.md✓ 50 pts
CODE_OF_CONDUCT.md✕ 0 pts
2. PEP 元数据与打包200 / 200 ▾
Wheel (.whl)✓ 50 pts
pyproject.toml✓ 50 pts
Project URLs✓ 50 pts
Trove Classifiers✓ 50 pts
3. 安全与供应链200 / 200 ▾
零 CVE 漏洞 (OSV)✓ 60 pts
Trusted Publishing (OIDC)✓ 50 pts
Snyk / Audit Link✓ 40 pts
HTTPS 代码仓库✓ 50 pts
4. 文档、SEO 与生态系统155 / 200 ▾
结构化 README✓ 60 pts
Read the Docs✓ 50 pts
Django Packages✕ 0 pts
网站 / 技术文章✓ 45 pts
5. 工程、CI 与代码质量200 / 200 ▾
自动化测试✓ 65 pts
GitHub Actions CI✓ 65 pts
CHANGELOG.md✓ 35 pts
Env & Lockfile (uv/rye/poetry/pdm/hatch)✓ 35 pts
README & DOCS
PyPI Metadata v7.32.0
官方文档与使用指南 — python-roborock
显示完整原始文档(英文 README) ▾
Roborock
Roborock library for online and offline control of your vacuums.
Installation
Install this via pip (or your favourite package manager):
pip install python-roborock
To use the roborock command line tool, install the cli extra, which pulls in
its additional dependencies (click, pyyaml, pyshark):
pip install python-roborock[cli]
Example Usage
See examples/example.py for a more full featured example, or the API documentation for more details.
Here is a basic example:
import asyncio
from roborock.web_api import RoborockApiClient
from roborock.devices.device_manager import create_device_manager, UserParams
async def main():
email_address = "[email protected]"
web_api = RoborockApiClient(username=email_address)
# Send a login code to the above email address
await web_api.request_code()
# Prompt the user to enter the code
code = input("What is the code?")
user_data = await web_api.code_login(code)
# Create a device manager that can discover devices.
user_params = UserParams(username=email_address, user_data=user_data)
device_manager = await create_device_manager(user_params)
devices = await device_manager.get_devices()
# Get all vacuum devices. Each device generation has different capabilities
# and APIs available so to find vacuums we filter by the v1 PropertiesApi.
for device in devices:
if not device.v1_properties:
continue
# The PropertiesAPI has traits different device commands such as getting
# status, sending clean commands, etc. For this example we send a
# command to refresh the current device status.
status_trait = device.v1_properties.status
await status_trait.refresh()
print(status_trait)
asyncio.run(main())
Functionality
The library interacts with devices through specific API properties based on the device protocol:
- Standard Vacuums (V1 Protocol): Most robot vacuums use this. Interaction is done through
device.v1_properties, which contains traits likestatus,consumables, andmaps. Use thecommandtrait for actions like starting or stopping cleaning. - Wet/Dry Vacuums & Washing Machines (A01 Protocol): Devices like the Dyad and Zeo use this. Interaction is done through
device.a01_propertiesusingquery_values()andset_value().
You can find detailed documentation for Devices and Traits.
Supported devices
You can find what devices are supported here. Please note this may not immediately contain the latest devices.
Acknowledgements
- Thanks to @rovo89 for Login APIs gist.
- Thanks to @PiotrMachowski for Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor.