Add pump switch for Midea dehumidifiers - #181257
Conversation
There was a problem hiding this comment.
Hi @mattrossman
It seems you haven't yet signed a CLA. Please do so here.
Once you do that we will be able to review and accept this pull request.
Thanks!
|
Hey there @chemelli74, @rokam, @caibinqing, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
🟡 Changes recommended
The description omits mandatory sections from the repository’s pull-request template.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a controllable pump switch for Midea A1 dehumidifiers.
Changes:
- Adds the A1 pump switch with translation and icon metadata.
- Adds service-call tests and entity snapshots.
File summaries
| File | Description |
|---|---|
homeassistant/components/midea/switch.py |
Defines the A1 pump switch. |
homeassistant/components/midea/strings.json |
Adds the pump name. |
homeassistant/components/midea/icons.json |
Adds the pump icon. |
tests/components/midea/test_switch.py |
Tests pump state and services. |
tests/components/midea/snapshots/test_switch.ambr |
Captures pump entity state. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟡 Changes recommended
The switch is exposed on all A1 devices even when they lack the pump capability.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Balanced
| MideaSwitchEntityDescription( | ||
| key="pump", | ||
| translation_key="pump", | ||
| models=[DeviceType.A1], |
|
Hmm sounds like this might be benefit from a companion PR in the midea-local library to expose pump support detection. Will look into that. |
You can get some inspiration from this PR: midea-lan/midea-local#746 |
|
Appreciate the reference @rokam, I've opened an upstream PR midea-lan/midea-local#754 |
## Summary Expose A1 device capabilities through a public capability map. The A1 protocol already provides a `pump_enable` capability bit separately from the current `pump` state. This change exposes that existing signal through `device.capabilities["pump"]`, following the capability-reporting pattern used by other device implementations. This supports [Home Assistant core PR #181257](home-assistant/core#181257), which needs to create the A1 pump switch only for devices that report pump support. ## Testing Added focused A1 device coverage verifying that the capability map reflects both supported and unsupported pump capability states reported by the device. ## Notes Reference implementation: [midea-local PR #746](#746)
There was a problem hiding this comment.
🟡 Changes recommended
The dependency upgrade introduces unhandled cloud exceptions, and the A1 snapshot case currently creates no pump entity.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 2
- Review effort level: Balanced
|
The version bump should be made in a different PR |
|
Looks like the version bump will be handled by #181405, once that's merged I'll update this PR to focus back on the pump capability side. |
860afcc to
8307656
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The feature is narrowly scoped, capability-gated, and includes targeted tests plus updated snapshots for the new switch behavior.
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Lite
There was a problem hiding this comment.
🟢 Approval recommended
The capability-gated implementation is consistent with the dependency API and has focused coverage for supported and unsupported devices.
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
- Review effort level: Balanced
There was a problem hiding this comment.
🟢 Approval recommended
The capability-gated pump switch is implemented consistently with existing switch patterns and is covered by targeted tests and updated snapshots.
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
- Review effort level: Lite
Proposed change
Add support for the pump switch exposed by Midea A1 dehumidifiers.
The current Home Assistant base includes
midea-local11.0.1, which exposes device capabilities. This change creates the Home Assistant pump switch only when an A1 device reports pump support. Supported devices can then be controlled withswitch.turn_onandswitch.turn_off.Device verification
Verified with a Midea Cube 50-Pint Dehumidifier with Pump, model
MAD50PS1QWT-A.I turned the pump off and back on from Home Assistant and confirmed both state changes in the Midea smart-home app, verifying communication with the physical device.
Testing
Related
The capability support is provided by
midea-local11.0.1.Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running:
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: