English · 简体中文
美的空调 Windows 托盘控制器:局域网直连,无需 Home Assistant,界面参考「美的美居」App。
点托盘图标 → 拖动温度 → 完成。无需每次打开 App 等待加载,日常控制不依赖云端。
关于“无需云端”:V3 设备首次配置时需要联网获取一次 token/key;配置完成后,日常状态查询与控制走本地局域网。
| 开机状态 | 关机状态 |
|---|---|
![]() |
![]() |
- 托盘常驻:图标显示设定温度(开机)或室内温度(关机),悬停查看详细状态
- 基础控制:开关机、温度滑条、五种运行模式、风速调节
- 扫风与风向:上下/左右扫风,五档上下出风方向 + 五档左右出风方向
- 常用功能:防直吹、强冷、省电、电辅热(仅制热模式)
- 设备设置:屏显、提示音、干燥防霉
- 今日用电:根据设备累计电量与当日基线计算,基线保存在本地
- 状态反馈:关机时面板置灰,指令失败时显示中文原因并在 3 秒后自动消失
- 自动重连:空调 IP 变化后,在已知网段中重新发现设备
- Windows 10 / 11
- Python 3.10 或更高版本
- 已绑定「美的美居」的美的空调,电脑与空调可通过局域网通信
git clone https://github.com/LLLLOOK/midea-tray.git
cd midea-tray
install.batsetup.bat脚本会发现空调;V3 设备需要输入美的美居账号密码,以换取设备的 token / key。密码输入时不回显,也不会写入配置文件。
配置保存在本地 ac_config.json,之后启动无需再次登录。
配置文件示例与安全说明
{
"ip": "192.168.1.100",
"port": 6444,
"device_id": 123456789012345,
"token": "<128 位十六进制>",
"key": "<64 位十六进制>",
"known_subnets": ["192.168.1.", "192.168.110."]
}ac_config.json 已加入 .gitignore。不要提交或公开该文件,其中的 token/key 相当于设备控制凭据。
双击 run.bat。托盘出现温度图标后,左键单击即可打开控制面板。
- 真机验证型号:美的神机二代
KFR-35G/N8HE1II,V3 协议,美的美居国服账号;其他型号和地区账号尚未验证 - 设备范围:仅支持空调(设备类型
0xAC),当前仅支持单台设备 - 智控温 / 智能光感:真机测试中下发的局域网控制位被设备忽略,因此界面仅保留禁用状态,不作为已支持功能
- 云端功能:定时、历史电量、智清洁记录等未接入
- 电辅热:仅制热模式可用
- IP 变化:重新扫描已知网段时,首次连接可能延迟数秒
如果你的设备表现不同,欢迎在 Issues 提供型号、协议版本和已脱敏日志;请勿上传 ac_config.json。
美的空调使用 M-Smart 局域网协议:TCP 6444 用于控制,UDP 6445 用于发现,载荷采用 AES 加密;V3 设备还需 token/key 完成认证。
协议层基于 msmart-ng,本项目主要补充:
- 扩展状态位:解析标准状态帧中的干燥防霉、智控温和智能光感状态位;其中仅干燥防霉经过真机读写验证
- 保留扩展功能位:下发控制指令时保留相关位,避免调整其他设置时意外关闭干燥防霉
- 多网段重连:在已知网段中重新定位 IP 已变化的设备
midea_tray.py 主程序:托盘、轮询、协议扩展
pyside_panel.py Qt 桥接层:向 QML 暴露控制状态
panel.qml Qt Quick 控制面板
get_token.py 首次发现设备并获取 token/key
install.bat 创建虚拟环境并安装依赖
setup.bat 首次配置入口
run.bat 无控制台窗口启动
icons/ 界面图标
fonts/ HarmonyOS Sans SC 子集字体
docs/images/ README 截图与社交分享预览图
test_pyside_panel.py 离屏渲染测试,不连接真实空调
.venv\Scripts\python.exe test_pyside_panel.py测试使用 fake_ctrl.py 中的模拟设备,检查 QML 错误、状态字段和拖拽逻辑,并导出界面截图,无需连接真实空调。
Midea Tray is a Windows system-tray controller for Midea air conditioners. It uses the local M-Smart LAN protocol through msmart-ng, with a PySide6/QML interface inspired by the Midea Meiju app. No Home Assistant is required.
- Power, temperature, mode and fan-speed controls from the Windows tray
- Vertical/horizontal swing and five-step airflow direction controls
- Breeze-away, turbo, eco, display, sound and dry-clean controls where supported
- Local daily energy estimation and automatic rediscovery across known subnets
- Install Python 3.10+ on Windows 10/11.
- Clone this repository and run
install.bat. - Run
setup.batto discover the air conditioner. V3 devices require a one-time online token/key setup with a Midea Meiju account; the password is not saved. - Run
run.batand left-click the tray icon.
Compatibility: Tested with a Midea KFR-35G/N8HE1II using protocol V3 and a China-region Midea Meiju account. Other models and regions are unverified. Only one air conditioner is currently supported. Daily control is local after setup; smart-temperature and smart-light controls are disabled because the tested device ignored their LAN commands.
界面使用 HarmonyOS Sans SC。仓库中的字体经过子集化,仅保留界面字符与 GB2312 一级常用字。
- msmart-ng:M-Smart 协议基础实现
- midea-local:美的美居账号 token/key 获取接口
- 界面参考「美的美居」App;相关界面与品牌权利归美的所有,本项目仅作个人学习与非官方实现

