feat: support MGH20VE5PRO washer dryer - #44
Conversation
Add model-specific wash and dry program mappings with separate lower and upper drum controls. Route D9 commands and dryer status updates through their matching protocol buckets.
|
首先,感谢提交,从代码上初步看起来这是一种上下筒的D9设备,与https://github.com/Cyborg2017/midea_smart_home/issues/43中类似。
需要注意的是:
1、既然上筒和下筒完全采用不同的数据类型,那么理论上只需要初始化查询一次获得即时数据,之后只需要依赖设备上报就可以了,不需要交替轮询(默认设备因为左右筒采用共同数据结构,只有交替轮询才能分别获取左右筒数据,这是当前较优做法,但如果不同数据类型也去轮询就浪费资源了,这块建议修改区分开);
2、控制命令需要连同发送 bucket标识符,这个可以统一改为当前活动属性提取;
3、device-mapping 的结构不允许改动,请使用 sn8 新增映射,同时我有一个想法是:在不同映射中增加标识符,来区分轮询和非轮询设备,便于统一处理。
4、由于issue 里面提到了类似的设备,请与提问者确认一下是否属于同类型,主要的目的是,需要你把两个筒的控制属性和状态属性补齐,而不只是洗涤程序
5、以上内容修正后,代码会被重新审核和合并,如果有疑问,也可以加群交流:1080354329
…---- 回复的原邮件 ----
| 发件人 | ***@***.***> |
| 发送日期 | 2026年07月29日 22:13 |
| 收件人 | Cyborg2017/midea_smart_home ***@***.***> |
| 抄送人 | Subscribed ***@***.***> |
| 主题 | [Cyborg2017/midea_smart_home] feat: support MGH20VE5PRO washer dryer (PR #44) |
Summary
add MGH20VE5PRO-specific mappings for 20 wash programs and 16 dry/care programs
expose separate lower-drum and upper-drum start/stop switches
route D9 controls to the matching db, dc, or da protocol bucket
process asynchronous 03dc dryer status without consuming pending 03db poll state
add English and Simplified Chinese names and icons for the new entities
Root cause
D9 control preparation always forced the db bucket, so upper-drum dryer commands were sent as lower-drum washer commands. The D9 update path also required a pending DB poll location for every status packet, which discarded asynchronous DC dryer status.
User impact
MGH20VE5PRO owners can select the correct wash or dry program and independently start or pause the lower washer drum and upper dryer drum. State updates from the upper drum now reach Home Assistant.
Validation
python3 scripts/format_code.py --check
python3 scripts/sort_translations.py --check
Python compile and JSON parse checks for the changed integration files
targeted behavior checks for DB/DC/DA routing, model mappings, separate control status, DC state merging, and DB poll handling
real MGH20VE5PRO validation on v26.7.2: wash and dry program selection, lower and upper start/stop, upper 03dc state tracking, Home Assistant configuration check, and restart
You can view, comment on, or merge this pull request online at:
#44
Commit Summary
febe6f7 feat: support MGH20VE5PRO washer dryer
File Changes
(6 files)
Mcustom_components/midea_smart_home/device_mapping/T0xD9.py (74)
Mcustom_components/midea_smart_home/icons.json (3)
Mcustom_components/midea_smart_home/midea_lib/device.py (16)
Mcustom_components/midea_smart_home/midea_lib/extras.py (38)
Mcustom_components/midea_smart_home/translations/en.json (27)
Mcustom_components/midea_smart_home/translations/zh-Hans.json (27)
Patch Links:
https://github.com/Cyborg2017/midea_smart_home/pull/44.patch
https://github.com/Cyborg2017/midea_smart_home/pull/44.diff
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
There was a problem hiding this comment.
1、device_mapping中 程序 定义内联到 options 中以符合项目规范的,这个必须修正;
2、由于不清楚是否还存在其他双筒数据结构,因此暂时请与项目保持一致,即:上下筒请以原程序名+位置来做translation_key,例如 dc_program_t,db_program_b (top / bottom,分别代表上下桶缩写)
而翻译则使用后缀的形式区分,例如 洗涤程序(上筒)、洗涤程序(下筒)、剩余时间(下筒)等等区分;
以下是简要修正点:
-
程序定义修正:将所有程序选项直接内联到
options字典中,不允许存在 MGH20VE5PRO_PROGRAMS -
命名规范修正:所有实体键名使用后缀形式
- 下筒:
db_power_b,db_program_b,db_remain_time_b, etc. - 上筒:
dc_power_t,dc_program_t,dc_remain_time_t, etc.
- 下筒:
-
翻译规范修正:使用后缀区分
"db_program_b": {"name": "洗涤程序(下筒)"}"dc_program_t": {"name": "洗涤程序(上筒)"}
-
图标映射修正:icons.json 中的键名同步修改为
_b/_t后缀 -
另外 "default_values": {
"db_location": 2,
"dc_location": 1,
}, 是什么用?
|
已按 review 意见在 471058a 中完成修正:
关于 |
|
如果是这样的话,不需要新增`attribute用法,集成现用的方法就可以做到;另外不是要你直接将属性名修改了,而是使用translation_key来翻译和区分。
…---- 回复的原邮件 ----
| 发件人 | ***@***.***> |
| 发送日期 | 2026年07月30日 16:44 |
| 收件人 | ***@***.***> |
| 抄送人 | Yang ***@***.***>,
Comment ***@***.***> |
| 主题 | Re: [Cyborg2017/midea_smart_home] feat: support MGH20VE5PRO washer dryer (PR #44) |
jndxhuxiehang left a comment (Cyborg2017/midea_smart_home#44)
已按 review 意见在 471058a 中完成修正:
洗涤和烘干程序已分别内联到 options
型号专属实体、translation key 和 icons key 已统一改为 _b / _t 后缀
中文名称已改为 名称(下筒) / 名称(上筒) 的后缀形式
实体键与设备协议属性通过 attribute 分离,因此 Home Assistant 实体使用 db_power_b 等名称时,实际状态读取和控制仍使用设备协议中的 db_power,不会改变控制报文
关于 default_values:MGH20VE5PRO 的下筒使用 db_location=2,上筒使用 dc_location=1,但设备的部分状态上报不包含 location。这里的默认值会在状态缺少对应字段时补入设备当前数据;发送控制时,prepare_control_data() 根据当前控制属性提取 db / dc bucket,再自动附带相应的 location。这样每条上下筒控制命令都会带正确的位置标识,也避免在每个实体的 command 中重复配置 location。这两个值来自 MGH20VE5PRO 实机报文和控制验证。
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you commented.Message ID: ***@***.***>
|
|
这里有一个改动参考,看看是否有效:https://github.com/Cyborg2017/midea_smart_home/commits/D9-test/ |
|
已参考
另外验证参考映射时发现, 同时调整了 push 设备关机状态处理顺序,先把运行状态归一为 已通过格式、翻译排序、Python/JSON 静态校验,以及 push/poll 隔离、 |
|
直接在我提供的参考基础上,指出哪里与实际有出入的地方,我会调整合并。 |
|
可以,后续以你提供的
另外是展示层缺项,不涉及协议控制:参考分支目前缺少 其余 SN8 映射、20 个洗涤程序、16 个烘干/护理程序以及上下筒实体范围与实机适配一致。 |
|
03dc目前看只是看push数据就好了啊,跟轮询有什么关系?
关于power off的处理逻辑顺序问题,可以实际测一下,至少目前看原有排序对于轮询设备是可行的;
另外原d9设备的两个桶都是洗烘一体的,所以针对新T0xD9的洗衣桶、烘干桶需要你自己去调试,列出全部的progress对应映射。
…---- Replied Message ----
| From | ***@***.***> |
| Date | 7/31/2026 00:08 |
| To | ***@***.***> |
| Cc | Yang ***@***.***>,
***@***.***> |
| Subject | Re: [Cyborg2017/midea_smart_home] feat: support MGH20VE5PRO washer dryer (PR #44) |
jndxhuxiehang left a comment (Cyborg2017/midea_smart_home#44)
可以,后续以你提供的 D9-test 为基础统一调整即可。我们这边结合 MGH20VE5PRO 实机报文和现有定向验证,确认有以下差异:
上下筒控制必须带对应 location
下筒:db_location=2
上筒:dc_location=1
参考映射中的其他可控实体已经带了 location,但 db_power / dc_power 没有。按当前 prepare_control_data(),prepare_control_data({"dc_power": "on"}, {}) 会落到默认 db bucket,所以两个 power 实体也需要分别加 command: {"db_location": 2} / command: {"dc_location": 1}。
设备会独立异步上报 03dc
03dc 可能在等待传统 D9 的 03db 轮询响应期间到达。_pending_poll_location 应只在收到 03db 时取出并清空;如果任意状态包都清空,先到的 03dc 会消耗它,后续 03db 因 poll_location=None 被丢弃。
关机帧可能保留旧运行状态
实机在 db_power/dc_power=off 时,包内仍可能保留上一次的 running_status=start、progress 或 dry status。需要先把关机筒归一为 running_status=standby(上筒同时 dry_status=idle),再计算 control status、progress 和 remain time;否则 Home Assistant 会出现已关机但 control status 仍为 start、进度仍非 idle 的矛盾状态。
另外是展示层缺项,不涉及协议控制:参考分支目前缺少 db_detergent_needed_b 的英文翻译和图标,中文缺少 db_error_code_b、db_progress_b、db_remain_time_b,并且 db_progress_b、db_running_status_b、dc_dry_status_t、dc_running_status_t 的中英文 state 翻译未补齐。
其余 SN8 映射、20 个洗涤程序、16 个烘干/护理程序以及上下筒实体范围与实机适配一致。
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you commented.Message ID: ***@***.***>
|
如上回复,b3d4cac |
65b37b1 to
36554e0
Compare
|
长时间未回复,PR关闭 |
Summary
38208002and38209227dbanddcdata types once during initialization, then rely on device reports instead of alternate pollingbucketfrom the active property and attach the matching drum locationReview feedback addressed
dbpolling. The two independentdb/dcSN8 mappings setalternate_pollingto false and issue only the initialization queries.db,dc, ordafrom the active property, while the SN8 mapping suppliesdb_location=2anddc_location=1defaults.Root cause
The upper drum reports and accepts controls through the
dcdata type at location 1, while the lower drum usesdbat location 2. Treating this design as a legacy left/right D9 caused unnecessary alternating polls, discarded independent reports, and routed upper-drum controls through the lower-drum bucket.User impact
Owners of both known SN8 variants can monitor and control the lower washer and upper dryer independently. Existing D9 devices keep their current alternate-polling behavior.
Validation
python3 scripts/format_code.py --checkpython3 scripts/sort_translations.py --checkgit diff --check03db/03dcmerging, legacy_l/_rbehavior, command bucket/location generation, and power-off state normalizationdb/location 2anddc/location 1using the device Lua filestandby/idle/unknown-time state