Skip to content

Bump pyiCloud to 2.6.1#172538

Draft
aram535 wants to merge 2 commits into
home-assistant:devfrom
aram535:bump-pyicloud-2.6.1
Draft

Bump pyiCloud to 2.6.1#172538
aram535 wants to merge 2 commits into
home-assistant:devfrom
aram535:bump-pyicloud-2.6.1

Conversation

@aram535
Copy link
Copy Markdown

@aram535 aram535 commented May 29, 2026

Breaking change

Proposed change

Bumps pyicloud from 2.4.1 to 2.6.1 to fix the iCloud 2FA verification code never arriving on trusted Apple devices.

Root cause: After Apple required SRP-6a authentication (adopted in HA 2025.10), the library completed the SRP handshake and correctly detected that 2FA was required (PyiCloud2FARequiredException), but never made the subsequent GET /appleauth/auth/verify/trusteddevice request that explicitly triggers Apple to push the 6-digit code to the user's trusted devices. Apple does not auto-push verification codes for API (non-browser) sessions — the push must be explicitly requested. The result: HA would display the "Enter your verification code" prompt, but the code never arrived on the user's iPhone/iPad/Mac.

What changed in pyicloud:

  • 2.5.0 (2026-05-07): Fixed the trusted-device bridge WebSocket push payload parser — Apple changed the payload field from sessionUUID to flowid, causing a Pydantic validation crash in the bridge flow.
  • 2.6.0 (2026-05-22): CloudKit-backed Photos/Notes/Reminders, shared photo stream fixes, further auth flow improvements.
  • 2.6.1 (2026-05-27): Added _request_2fa_code() — called automatically after SRP auth completes, it issues GET /appleauth/auth/verify/trusteddevice to explicitly trigger the push notification, with SMS fallback via PUT /appleauth/auth/verify/phone. This is the critical fix for the missing 2FA delivery.

No changes to HA's config_flow.py are required — the fix is entirely inside the library. The _request_2fa_code() call is made internally during PyiCloudService.__init__(), so by the time HA checks api.requires_2fa and shows the "Enter code" form, the push has already been dispatched to the user's devices.

Changelog diff: timlaing/pyicloud@2.4.1...2.6.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:

@aram535 aram535 requested a review from Quentame as a code owner May 29, 2026 07:17
Copilot AI review requested due to automatic review settings May 29, 2026 07:17
@home-assistant home-assistant Bot added cla-needed dependency Pull requests marked as a dependency upgrade integration: icloud small-pr PRs with less than 30 lines. labels May 29, 2026
Copy link
Copy Markdown
Contributor

@home-assistant home-assistant Bot left a comment

Choose a reason for hiding this comment

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

Hi @aram535

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!

@home-assistant home-assistant Bot marked this pull request as draft May 29, 2026 07:17
@home-assistant
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.

@home-assistant
Copy link
Copy Markdown
Contributor

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

Code owner commands

Code owners of icloud 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 icloud 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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Bumps the pyicloud dependency from 2.4.1 to 2.6.1 for the iCloud integration.

Changes:

  • Updated pyicloud version in the iCloud component manifest.
  • Updated pyicloud version in requirements_all.txt.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
homeassistant/components/icloud/manifest.json Bumps pyicloud requirement to 2.6.1
requirements_all.txt Syncs the global requirements file with the new pyicloud version

@aram535
Copy link
Copy Markdown
Author

aram535 commented May 29, 2026

Dependency conflict identified — blocking on upstream pyicloud fix

Testing locally revealed that pyicloud 2.6.1 requires protobuf>=7.34.1 but HA pins protobuf==6.32.0 in homeassistant/package_constraints.txt. CI will reject this PR until that conflict is resolved.

Root cause of the conflict: The protobuf>=7.34.1 minimum in pyicloud 2.6.0/2.6.1 was introduced by a dependabot auto-merge (PR timlaing/pyicloud#227, 2026-05-08) that had no functional purpose — pyicloud's .proto-generated files carry the comment # Protobuf Python Version: 6.31.1 and the 2FA fix itself (_request_2fa_code) has zero protobuf imports.

Upstream fix in progress: timlaing/pyicloud#265 ("Roll back protobuf to 6.32.0") is open and would make the next pyicloud release compatible with HA's existing protobuf pin. Once that merges and a new patch release is tagged, this PR can be updated to that version.

Live test result: Manually installing pyicloud 2.6.1 + protobuf 7.35.0 in a running HA 2026.5.x HAOS instance showed no regressions across all 25 protobuf-dependent integrations (ESPHome, Chromecast, MQTT, Google integrations, etc.). So if HA's protobuf constraint were relaxed (bdraco's draft PR #168811 does this), this PR would work as-is.

Options for maintainers:

  1. Wait for Roll back protobuf to 6.32.0 timlaing/pyicloud#265 → new pyicloud patch release → update this PR's version pin
  2. Coordinate with PR Bump protobuf to 7.34.1 #168811 to bump HA's protobuf constraint first, then merge this

Marking as blocked on upstream.

@aram535
Copy link
Copy Markdown
Author

aram535 commented May 29, 2026

waiting-for-upstream label needed for whatever the new version will be after pyicloud PR #265 merging.

@timlaing
Copy link
Copy Markdown
Contributor

@aram535 - updated version of PyiCloud released to fix this issue. Version: 2.6.2

@rlust
Copy link
Copy Markdown

rlust commented Jun 2, 2026

When will this be fixed? Has not worked for 2 months!

@Quentame
Copy link
Copy Markdown
Member

Quentame commented Jun 2, 2026

Could you update to the latest version ?

https://github.com/timlaing/pyicloud/releases

timlaing/pyicloud#265 has been merged and released on 2.6.2

And test if the integration is working.

Copy link
Copy Markdown
Member

@Quentame Quentame left a comment

Choose a reason for hiding this comment

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

To fix the protobuf issue

"iot_class": "cloud_polling",
"loggers": ["keyrings.alt", "pyicloud"],
"requirements": ["pyicloud==2.4.1"]
"requirements": ["pyicloud==2.6.1"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"requirements": ["pyicloud==2.6.1"]
"requirements": ["pyicloud==2.6.4"]

Comment thread requirements_all.txt

# homeassistant.components.icloud
pyicloud==2.4.1
pyicloud==2.6.1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
pyicloud==2.6.1
pyicloud==2.6.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed dependency Pull requests marked as a dependency upgrade integration: icloud Quality Scale: No score small-pr PRs with less than 30 lines.

Projects

None yet

5 participants