If you’re like me and rely heavily on Home Assistant to keep your smart home organized, you probably also want to track your incoming parcels alongside your automations. For quite some time, I used the PostNL integration in Home Assistant. It started as a core integration but eventually broke due to security restrictions on PostNL’s side. Later, it came back to life via a custom integration—only to break again when PostNL tightened their API access.
These days, PostNL tracking works again thanks to a browser extension for authentication, and it has been stable enough for me to get parcel updates reliably.
However, only about 50% of my packages are handled by PostNL. The other 50% typically come via DHL, with the occasional delivery from DPD or UPS. So naturally, I also wanted my DHL packages to show up in Home Assistant, providing a more complete overview of what’s on the way to my doorstep.
What You’ll Need
- A valid DHL account: https://my.dhlecommerce.nl/
- The Multiscrape custom component installed
Note: The DHL API used here is unofficial (reverse-engineered). Any changes on DHL’s side can break this setup without warning.
Setting up Multiscrape
The configuration involves two REST calls:
- Logging in to the DHL API
- Retrieving your parcel data
Below is the recommended YAML configuration. Replace EMAILADDRESS
and PASSWORD
with your DHL credentials.
multiscrape:
- resource: "https://my.dhlecommerce.nl/api/user/login"
scan_interval: 1800
method: "post"
headers:
Content-Type: "application/json"
payload: '{"email":"EMAILADDRESS","password":"PASSWORD"}'
- resource: "https://my.dhlecommerce.nl/receiver-parcel-api/parcels"
scan_interval: 1800
method: "get"
headers:
Content-Type: "application/json"
sensor:
- unique_id: dhl_packages
name: DHL Pakketten
value_template: "{{ value_json.parcels | selectattr('category', 'search', '(PROBLEM|CUSTOMS|DATA_RECEIVED|EXCEPTION|INTERVENTION|IN_DELIVERY|LEG|UNDERWAY|UNKNOWN)') | list | count }}"
attributes:
- name: parcels
value_template: "{{ value_json.parcels | selectattr('category', 'search', '(PROBLEM|CUSTOMS|DATA_RECEIVED|EXCEPTION|INTERVENTION|IN_DELIVERY|LEG|UNDERWAY|UNKNOWN)') | list }}"
After restarting Home Assistant, you’ll see a new sensor called sensor.dhl_packages
. The state of this sensor shows the number of parcels currently in transit. Its attributes contain detailed information about each package.
Tip: Initially, the sensor might be empty until the first successful refresh. Multiscrape maintains cookies or sessions between requests, which is why the subsequent calls populate your data.
Creating a Dashboard Card
Once your sensor is working, you can visualize your packages in your Lovelace dashboard. Here’s an example of a conditional Markdown card that displays a neat table with upcoming deliveries:
- type: conditional
conditions:
- condition: "numeric_state"
entity: sensor.dhl_packages
above: 0
card:
type: markdown
card_mod:
style:
ha-markdown$: |
table {
width: 100%;
}
thead {
font-weight: bold;
}
content: |
<table>
<thead>
<tr>
<td>Bezorger</td>
<td>Pakket</td>
<td>Datum</td>
<td>Tijd</td>
</tr>
</thead>
<tbody>
{%- if states('sensor.dhl_packages') | int(0) > 0 %}
{% for package in state_attr('sensor.dhl_packages', 'parcels') %}
{% if package.receivingTimeIndication is not none and 'start' in package.receivingTimeIndication %}
<tr>
<td>DHL</td>
<td>{{ package.sender.name }}</td>
<td>{{ as_timestamp(package.receivingTimeIndication.start) | timestamp_custom('%-d %b') }}</td>
<td>{{ as_timestamp(package.receivingTimeIndication.start) | timestamp_custom('%H:%M') }} - {{ as_timestamp(package.receivingTimeIndication.end) | timestamp_custom('%H:%M') }}</td>
</tr>
{% endif %}
{%- endfor %}
{% endif %}
</tbody>
</table>
This card only shows if there’s at least one package in transit, making your dashboard clean and relevant.
Conclusion
Although this setup isn’t bulletproof—since it relies on an unofficial API—it has worked reliably in my environment for over a year. If you’re looking to complete your Home Assistant parcel tracking beyond PostNL, this approach with Multiscrape offers a solution for DHL.
Join the discussion in the Home Assistant Community to see other implementations suggested by others.