Skip to content

feat: support dpd.track_parcel for DPD Germany - #38

Merged
peter-mdf merged 1 commit into
ha-parcel-integrations:mainfrom
LeszekSwirski:feat/de-track-parcel
Nov 30, 2026
Merged

peter-mdf merged 1 commit into
ha-parcel-integrations:mainfrom
LeszekSwirski:feat/de-track-parcel

Conversation

@LeszekSwirski

Copy link
Copy Markdown
Contributor

Support dpd.track_parcel for DPD Germany (my.dpd.de)

Closes #34

Allows dpd.track_parcel to look up and add parcels by 14-digit parcel number on DPD Germany accounts (countries/de), matching the existing myDPD app (countries/general) action.

Summary of changes

  • countries/de/page.py: Added is_dataprotection_page, has_without_postcode_control, and is_unknown_parcel helpers for the dataprotection.aspx postcode prompt and DPD's unknown-parcel panel.
  • countries/de/session.py: Added DpdDeSession.async_add_parcel(parcel_number) under self._lock (and refactored _postback around _postback_page to return (final_url, html)). Submits btnHomeTrackYourParcel with txtHomeTrackYourParcel, continues through dataprotection.aspx via btnWithOutZipCode without ever submitting txtPostcode, and raises DpdParcelNotFoundError when DPD reports an unknown parcel or DpdApiError(200) on unexpected/signed-out responses.
  • services.py & translations: Updated _track to accept either entry.runtime_data.client or entry.runtime_data.de_session (strings.json, all 16 translations/*.json, and error message updated accordingly).
  • Docs: Updated README.md, ARCHITECTURE.md, and CLAUDE.md in the same commit without duplicating API wire mechanics.
  • Tests: Added page, session (postcode-skip flow, direct flow, unknown parcel at step 1/2, missing control, stuck page, signed-out responses, lock serialization with async_get_inbox), and service tests (tests/payloads.py, tests/countries/test_de_page.py, tests/countries/test_de_session.py, tests/test_services.py).

Verification

  • ruff check ., ruff format --check ., and mypy custom_components/dpd: clean
  • pytest tests/ --cov=custom_components.dpd: 1049 passed, 99% coverage (countries/de/page.py, countries/de/session.py, services.py at 100%)
  • Verified live on Home Assistant against my.dpd.de (unknown number raises ServiceValidationError; known parcel returns cleanly without submitting a postcode)

@peter-mdf

Copy link
Copy Markdown
Collaborator

Thanks @LeszekSwirski!

@peter-mdf
peter-mdf merged commit 2f90256 into ha-parcel-integrations:main Nov 30, 2026
8 checks passed
@peter-mdf peter-mdf mentioned this pull request Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Tracking based

2 participants