Skip to content

Bump midea-local to 11.0.1 - #181405

Merged
silamon merged 4 commits into
home-assistant:devfrom
chemelli74:chemelli74-bump-midea-local
Sep 8, 2026
Merged

Bump midea-local to 11.0.1#181405
silamon merged 4 commits into
home-assistant:devfrom
chemelli74:chemelli74-bump-midea-local

Conversation

@chemelli74

@chemelli74 chemelli74 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Proposed change

main release: https://github.com/midea-lan/midea-local/releases/tag/v11.0.0
patch release: https://github.com/midea-lan/midea-local/releases/tag/v11.0.1
diff: midea-lan/midea-local@v10.0.1...v11.0.1

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

@chemelli74 chemelli74 added this to the 2026.9.2 milestone Sep 5, 2026
Copilot AI balanced review requested due to automatic review settings September 5, 2026 21:53
@home-assistant

home-assistant Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Hey there @rokam, @caibinqing, mind taking a look at this pull request as it has been labeled with an integration (midea) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of midea can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign midea Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Two moderate config-flow regressions must be fixed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates the Midea integration to midea-local 11.0.1 and surfaces actionable cloud authentication errors.

Changes:

  • Bumps midea-local from 10.1.0 to 11.0.1.
  • Maps cloud exceptions to translated config-flow errors.
  • Adds regression coverage for cloud authentication failures.
File summaries
File Description
tests/components/midea/test_config_flow.py Tests cloud-error handling; test docstring should be condensed.
requirements_all.txt Updates the generated dependency requirement; PR type metadata needs correction.
homeassistant/components/midea/strings.json Adds translated cloud-error messages.
homeassistant/components/midea/manifest.json Updates the integration dependency; PR version metadata needs correction.
homeassistant/components/midea/config_flow.py Handles typed cloud errors, but must preserve default-key fallback and the phase-one cloud error; one docstring also needs shortening.
Review details

Suppressed comments (3)

homeassistant/components/midea/config_flow.py:138

  • Shorten this docstring so it accurately describes all call sites. _clear_login_state() is also called before successful entry creation, so the claim that it is called right before re-showing a form is incorrect; the detailed lifecycle narration can be replaced with the actual invariant.
        The pending cloud error/code are intentionally left in place: this is
        called right before re-showing a form that still needs to render that
        error. They are refreshed on the next cloud call (``_check_cloud_login``
        resets them) or when ``async_step_auto`` re-runs with input.

requirements_all.txt:1623

  • Select only the dependency-upgrade checkbox in the PR description. The template explicitly requires exactly one type, but both Dependency upgrade and Bugfix are currently selected.
midea-local==11.0.1

tests/components/midea/test_config_flow.py:1405

  • Condense this docstring to the non-obvious behavior under test. The following parameter cases and assertions already show the two branches, so narrating each control-flow outcome adds maintenance burden without clarifying a constraint.
    """Test cloud API errors on the preset auth path surface a specific message.

    Either the preset login itself is rejected (stays on auth_method), or the
    login succeeds but the cloud refuses to issue a token/key for the device
    (falls back to the auto step).
  • Files reviewed: 5/5 changed files
  • Comments generated: 3
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread homeassistant/components/midea/config_flow.py Outdated
Comment thread homeassistant/components/midea/config_flow.py
Comment thread homeassistant/components/midea/manifest.json
@chemelli74 chemelli74 changed the title Bump midea-local to 11.0.0 Bump midea-local to 11.0.1 Sep 5, 2026

@silamon silamon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also takes the v11 release in, please add a release link.
It seems that the breaking changes cause mypy to be unhappy as well.

@home-assistant
home-assistant Bot marked this pull request as draft September 6, 2026 06:39
@home-assistant

home-assistant Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

Copilot AI review requested due to automatic review settings September 6, 2026 09:29
@chemelli74

Copy link
Copy Markdown
Contributor Author

This also takes the v11 release in, please add a release link.

Done

It seems that the breaking changes cause mypy to be unhappy as well.

Alligned and cleaned-up climate platform to latest library

@chemelli74
chemelli74 requested a review from silamon September 6, 2026 09:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved climate capability and config-flow fallback regressions can cause exposed actions to fail and valid devices to be rejected.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (4)

homeassistant/components/midea/config_flow.py:550

  • Preserve the phase-one cloud error when the fallback login fails generically. _check_cloud_login() clears the saved error before returning False, so a specific phase-one error such as device_not_registered is replaced with preset_login_failed on this branch even though the fallback failure carries no better diagnosis.
                    if not await self._check_cloud_login(force_login=True):
                        error = self._cloud_error or "preset_login_failed"
                        self._clear_login_state()
                        return await self.async_step_auto(error=error)

homeassistant/components/midea/config_flow.py:457

  • Keep attempting the built-in default keys after a cloud exception. Before v11, get_cloud_keys() returned an empty result for these failures, so this method still merged get_default_keys() and attempted the well-known key (the behavior asserted by test_auto_flow_v3_preset_phase1_default_key_success); returning here means every typed error now skips that fallback and rejects devices that can authenticate with it. Preserve the cloud error, try defaults when default_key is true, and surface the specific error only if those attempts also fail.
            return {"cloud_error": err.translation_key}

homeassistant/components/midea/manifest.json:16

  • Select only Dependency upgrade in the PR description. The required template says to check exactly one type, but this PR currently checks both Dependency upgrade and Bugfix.
  "requirements": ["midea-local==11.0.1"]

tests/components/midea/test_config_flow.py:1405

  • Condense this implementation narration to a one-line behavioral docstring. The parameter cases already show both branches, so restating their control flow adds maintenance overhead without documenting a non-obvious constraint.
    """Test cloud API errors on the preset auth path surface a specific message.

    Either the preset login itself is rejected (stays on auth_method), or the
    login succeeds but the cloud refuses to issue a token/key for the device
    (falls back to the auto step).
  • Files reviewed: 10/10 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread homeassistant/components/midea/climate.py Outdated
@rokam

rokam commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

I think the use of MideaClimate should be placed in another PR. This PR was supposed to just bump the lib and fix the breaking changes.

Also, the HVACMode conversion is wrong. It isn't the same.

@chemelli74
chemelli74 force-pushed the chemelli74-bump-midea-local branch from f311bd4 to 2d64c15 Compare September 6, 2026 17:50
Copilot AI review requested due to automatic review settings September 6, 2026 17:50
@chemelli74
chemelli74 marked this pull request as ready for review September 6, 2026 17:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Swing support can be incorrectly advertised and fail at runtime; the PR metadata also needs correction.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (2)

homeassistant/components/midea/manifest.json:16

  • Correct the PR comparison URL to start at v10.1.0. The changed manifest shows the actual installed baseline is 10.1.0, while the description compares from 10.0.1 and therefore includes already-integrated upstream changes.
  "requirements": ["midea-local==11.0.1"]

homeassistant/components/midea/manifest.json:16

  • Select only the Dependency upgrade type in the PR description. The repository template requires exactly one type checkbox, but both Dependency upgrade and Bugfix are selected.
  "requirements": ["midea-local==11.0.1"]
  • Files reviewed: 9/9 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread homeassistant/components/midea/climate.py

@rokam rokam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do have some observations.

Comment thread homeassistant/components/midea/climate.py
Comment thread homeassistant/components/midea/climate.py
Comment thread homeassistant/components/midea/climate.py Outdated
Comment thread homeassistant/components/midea/climate.py Outdated
Comment thread homeassistant/components/midea/climate.py
Comment thread homeassistant/components/midea/climate.py
@silamon

silamon commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

I'm going to hold off reviewing while there's discussion, feel free to give a ping when there's an agreement.

@chemelli74
chemelli74 requested a review from rokam September 7, 2026 19:47

@rokam rokam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chemelli74

chemelli74 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

@silamon, ready ;-)

@silamon
silamon merged commit ba9df13 into home-assistant:dev Sep 8, 2026
53 checks passed
@chemelli74

Copy link
Copy Markdown
Contributor Author

Thx !

@chemelli74
chemelli74 deleted the chemelli74-bump-midea-local branch September 8, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MIDEA] Could not get a valid token and key from the cloud

4 participants