Skip to content

About

A Home Assistant custom integration for tracking household parcels via Ship24 API

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Parcel Tracker

Home Assistant Parcel Tracking

Tests codecov License: Apache 2.0 Marketplace validation

Custom Home Assistant integration for household parcel tracking via Ship24 universal tracking API.

Features

  • One sensor per parcel, with status, carrier, delivery estimates, and tracking links.
  • Ship24 carrier detection and cached courier-name lookup.
  • Optional direct DHL status updates and delivery time windows.
  • Optional authenticated Ship24 push updates, with periodic polling as a fallback.
  • Status-change events for automations and automatic cleanup after delivery.
  • Registration through Home Assistant actions or a private webhook.

Installation

Requires Home Assistant 2025.10 or newer and a Ship24 API key. API quotas and pricing depend on your Ship24 plan.

Marketplace

  1. Open Marketplace in Home Assistant.
  2. Open its menu and select Custom repositories.
  3. Add https://github.com/usimd/homeassistant-parcel-tracking with type Integration.
  4. Search for Parcel Tracker in Marketplace and download it.
  5. Restart Home Assistant.
  6. Go to Settings > Devices & services > Add integration, select Parcel Tracker, and enter your Ship24 API key.

Manual

Copy custom_components/parcel_tracker into your Home Assistant configuration's custom_components directory, restart Home Assistant, and add the integration as above.

Configuration

Open Settings > Devices & services > Parcel Tracker > Configure.

Option Default Purpose
DHL API key Not set Optional DHL Shipment Tracking API access
Destination country / postal code Home location, if available Improve Ship24 matching
Polling interval 2 hours Poll Ship24 and optional DHL tracking; configurable from 1 to 12 hours
Cleanup days 3 Remove delivered parcels after 1 to 30 days
External registration webhook Disabled Allow registration through your external Home Assistant URL
Ship24 webhook secret Not set Enable the separate public receiver for authenticated tracking updates

Register a Parcel

Use Developer tools > Actions or an automation:

action: parcel_tracker.add
data:
  tracking_url: "https://www.dhl.de/de/privatkunden/dhl-sendungsverfolgung.html?piececode=1234567890123456"
  description: "Keyboard"

URL extraction supports common DHL, DPD, Hermes, GLS, UPS, FedEx, and Amazon Germany links. Ship24 tracking supports many more carriers: provide the tracking number for an unsupported URL. The original URL and optional carrier name are forwarded to Ship24.

action: parcel_tracker.add
data:
  tracking_number: "9400111202544843610364"
  carrier: "USPS"
  courier_code: "us-post"
  description: "Replacement part"

courier_code is an optional Ship24 code and takes precedence over the carrier name. Carrier names are matched against Ship24's cached catalog when possible. Omit both to let Ship24 detect the carrier.

Optional shipping_date must be the actual shipment date in YYYY-MM-DD format; leave it out if unknown. restrict_courier: true disables tracking through additional carriers, so leave it off for shipments with carrier handoffs. Creation metadata is preserved across retries; existing trackers are reused rather than automatically recreated.

Remove a parcel with:

action: parcel_tracker.remove
data:
  tracking_number: "9400111202544843610364"

Phone Sharing

The integration's Configure dialog shows your private /api/webhook/<random-id> path. Configure Android HTTP Shortcuts or iOS Shortcuts to POST JSON to that path on your Home Assistant URL:

{"url": "<tracking-url>", "device": "my-phone", "description": "Keyboard"}

The webhook also accepts tracking_number, courier_code, carrier, shipping_date, and restrict_courier. For unsupported URLs, include tracking_number.

Keep the URL private: anyone who has it and can reach the endpoint can register parcels. Local network access is enabled by default; enable external access explicitly when needed.

Ship24 Push Updates

Push updates are optional and included in Ship24's free Tracking API plan. They remove the integration's polling delay after Ship24 discovers an event, not Ship24's upstream delay.

  1. Make Home Assistant reachable through an external HTTPS URL.
  2. Open Parcel Tracker > Configure and find the Ship24 tracking webhook path. This is different from the phone registration path.
  3. In the Ship24 webhook dashboard, set the tracking webhook URL to your external Home Assistant URL followed by that path.
  4. Enter the webhook secret allocated by Ship24 in the integration's Ship24 webhook secret option and save. This secret is not your Ship24 API key.
  5. Use Ship24's dashboard test to check delivery. Unknown or example tracker IDs are acknowledged but do not register parcels.

The tracking receiver checks Ship24's Authorization: Bearer <secret> header before processing a batch. If you use a reverse proxy, ensure that header reaches Home Assistant. The receiver only updates existing tracker IDs; it never creates parcels.

Polling continues at the configured interval to reconcile missed pushes, and direct DHL polling is unchanged. Incoming pushes do not postpone that schedule. Clear the Ship24 webhook secret to disable the receiver and return to polling-only operation. Phone registration can remain local-only even while Ship24 push is enabled.

Sensors and Automations

Each parcel appears under the integration as a sensor. States are registered, in_transit, out_for_delivery, available_for_pickup, delivered, failed_attempt, exception, and unknown. Ready-for-pickup parcels are not treated as delivered or automatically cleaned up.

Attributes include tracking_number, carrier, courier_code, description, eta, eta_timeframe, tracking_url, preference_url, registered_at, registered_by, last_api_update, status_source, latest_event_time, and latest_event_description, when available. Carrier preference links are available for the supported URL adapters, not every Ship24 carrier.

  • parcel_tracker.parcel_added fires on registration.
  • parcel_tracker.status_changed fires once per final observed status transition after provider results are merged. Its payload includes tracking_number, carrier, courier_code, old_status, new_status, status_source, eta, tracking_url, and preference_url.
alias: Parcel delivered
triggers:
  - trigger: event
    event_type: parcel_tracker.status_changed
    event_data:
      new_status: delivered
actions:
  - action: notify.mobile_app_your_phone
    data:
      message: "{{ trigger.event.data.carrier }} parcel delivered"

Dashboard

Add parcel sensors to any built-in Entities card, or use this automatic list. It shows the carrier, status, tracking number, and ETA; tapping a row opens the tracking page.

Install auto-entities and template-entity-row through Marketplace, then add a Manual dashboard card:

type: custom:auto-entities
card:
  type: entities
  title: Parcels
  show_header_toggle: false
filter:
  include:
    - integration: parcel_tracker
      domain: sensor
      options:
        type: custom:template-entity-row
        state: "{{ state_attr(config.entity, 'carrier') }}: {{ states(config.entity) | replace('_', ' ') | title }}"
        secondary: >
          {{ state_attr(config.entity, 'tracking_number') }}
          {% if state_attr(config.entity, 'eta') %}
            - ETA {{ state_attr(config.entity, 'eta') }}
          {% endif %}
        tap_action: >
          {{ {'action': 'url', 'url_path': state_attr(config.entity, 'tracking_url')} | to_json
             if state_attr(config.entity, 'tracking_url')
             else {'action': 'more-info'} | to_json }}
  exclude:
    - state: unavailable
sort:
  method: state
show_empty: false

Limitations

  • Without push configured, updates arrive through polling. With push enabled, Ship24's own upstream delay still applies; this does not force faster courier refreshes.
  • Direct DHL results can confirm delivery before Ship24. Other conflicting states use comparable event timestamps when available. Delivered parcels are no longer polled.
  • last_api_update records a successful fetch or accepted push update, not the time of the carrier's last scan. Use latest_event_time to judge tracking freshness.
  • Dates, delivery estimates, and carrier coverage depend on the upstream provider.

Development

uv sync --dev
uv run pytest
uv run ruff check .
uv run ruff format --check .

About

A Home Assistant custom integration for tracking household parcels via Ship24 API

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages