概述
yeelight 是掌控板或micropython驱动库,用于控制局域网内的YeeLight智能灯泡/小米智能灯具设备。
库的安装方法
可通过以下任一方法进行安装。
- 将项目中的
yeelight.py - 在掌控板REPL界面中,使用upip安装,步骤如下:
- 前置条件需要掌控板连接网络
- 导入upip模块,执行
import upip - 执行`upip.install('mPython-yeelight')
>>> import upip
>>> upip.install('mPython-yeelight')
使用
准备工作:
- YeeLight智能灯泡在使用前,须要先配置好连接好wifi,并将
局域网控制功能打开。 - 掌控板确保已与智能灯泡在同个局域网内,并网络通畅。
yeelight Library Documentation:https://mpython-yeelight.readthedocs.io
YeeLight第三方控制协议:https://www.yeelight.com/download/Yeelight_Inter-Operation_Spec.pdf
简单示例
from mpython import *
from yeelight import *
my_wifi = wifi() # 连接到与YeeLight相同的局域网内
my_wifi.connectWiFi("","")
discover_bulbs() # 发现局域网内YeeLight的设备信息
bulb=Bulb("192.168.0.7") # 构建Bulb类用于控制,传入IP参数
bulb.turn_on() # 开灯
sleep(2)
bulb.turn_off() # 关灯
sleep(2)
bulb.toggle() # 翻转
sleep(2)
bulb.set_rgb(255,0,0) # 设置RGB值
bulb.set_brightness(50) # 调节亮度
sleep(2)
bulb.set_hsv(180,100) # 设置HSV值
sleep(2)
执照
所有代码均在MIT许可下发布。
Metadata
Release files for mPython-yeelight 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mPython-yeelight-0.0.1.tar.gz | 5.6 kB | Without provenance | Details |
Release files / mPython-yeelight-0.0.1.tar.gz
| Download URL | mPython-yeelight-0.0.1.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d67ae057038378716493883c40e5f85b27ef761354b810abca7f32612b507a74
|
|
BLAKE2b-256 checksum How to use checksums |
32f19a3edd615b2b743bbec0e775c608ea1163c5afc5e699bdf0904beb421f4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
|
Security for mPython-yeelight 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.