PostNL Integration

Tried adding this integration several times but it just doesn’t want to create sensors.

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:359
Integration: Sensor (documentation, issues)
First occurred: 15:18:38 (2 occurrences)
Last logged: 15:25:27

Error while setting up postnl platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 290, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/postnl/coordinator.py", line 47, in _async_update_data
    colli = track_and_trace_details['colli'].get(shipment['barcode'], {})
            ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
KeyError: 'colli'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/postnl/sensor.py", line 19, in async_setup_entry
    await coordinator.async_config_entry_first_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 262, in async_config_entry_first_refresh
    raise ex
homeassistant.exceptions.ConfigEntryNotReady: 'colli'

@Kliko could you please update to the latest beta release?

@schumi2004 ah, I see that I made a little mistake. Hopefully I fixed it. Could you please update to the latest beta release?

Both issues are related to responses from the PostNL API. For some reason the track and trace API doesn’t return any data for the track and trace codes.

I am very curious what the PostNL track and trace API returns for those barcodes. Is there a way you can send me privately more details? It’s very hard to debug without the response from the API.

1 Like

Works great! Thanks for the good work!

1 Like

@arjenbos , is this only working with the browser extension? Because I don’t use Chrome (but Opera)… Great you’re working on this!

The browser extension is only needed when you install the integration. You do not need to use it constantly.

I am not experienced with Opera, but the chrome extension uses a common browser API. According to this documentation Opera supports the API. So, creating an Opera extension should be possible.

1 Like

According to Opera docs, you can install Chrome extensions in Opera because the browser is based on the same engine (Chromium).

Hey Home assistant enthusiasts! I’m installing the PostNL integration today and it feels like I’m almost there. I have authenticated it, and the default (small card) works. The attributes show my past parcels so I’m good from the data-fetching side.

I can’t however make the card (GitHub - peternijssen/lovelace-postnl-card: Lovelace card for PostNL) work. And I know it’s due to my lack of Home Assistant knowledge (I spent way longer on Domoticz than I should have).

I simply do not understand the instructions.

I did this: 1. Download the lovelace-postnl.js from the latest release and store it in your configuration/www folder.

I cant seem to figure out how to ’ 1. Configure Lovelace to load the card:’

Any pointers for this HASS noob? HACS is enabled.

You should edit your dashboard, in edit mode top right you can click manage resources (under the triple dot)
Then you can add postnl-card.js

My file is located in www/postnl-card/postnl-card.js, local means www folder.

1 Like

I’ve come to the same problem. All of the authentication succeeded but the card isn’t working properly.
I tried adding the HACS module of the PostNL card, tried adding ‘GitHub - peternijssen/lovelace-postnl-card: Lovelace card for PostNL’ as custom repo, then added GitHub - arjenbos/lovelace-postnl-card: Lovelace card for PostNL as custom repo. I also did your steps by downloading the JS and moving it to the configuration/www folder but it all doesn’t work out.

I keep getting the ‘no card type configured’ error on my dashboard after doing all of the steps. I neither can find the card in the menu when editing the dashboard.

Anyone knows how to fix the problem?

I’ve tried this by downloading it locally and putting it in the www folder but it’s still not showing up.

It won’t be selectable as a card from GUI. Create manual card and copy/pasta code from example found in readme on github.
That should work

Ah I found out what was wrong. I used the - type: from the GitHub example. Where I needed to remove the -

I released version 1.0.0 of the PostNL integration. All reported bugs are fixed and the integrations looks stable.

If you encounter a bug, please create an issue on Github. Github is the place to keep track of the development of the integration.

3 Likes

All good now! many thanks!

works like a charm @arjenbos thanks!

see your chat, there is an privacy issue you forget to remove.

1 Like

Had a quick go with the component and looking good so far. Have to wait till more packages arrive :slight_smile:

Unfortunately I do not have the time (and perhaps knowledge) to manage the lovelace card. It might even be too much outdated for today’s standards of Home Assistant. Anyone is free to take over development and submit it to HACS for inclusion. Or start from scratch :slight_smile:

I am hoping that one day we have one single card showing all packages of different vendors. I know DHL launched “Mijn DHL” a while back, long after the postNL integration and card were created. Might be interesting for someone to review if they can reverse engineer that DHL app and let it work together with the PostNL integration leading to one single source of truth regarding our packages. #wish

4 Likes

+1 for DHL.
I did find one but not sure it will work GitHub - glance-/dhl: A custom_component for home-assistant to track DHL packages via their api.

/edit
I was unable to create a API key for the Dutch Parcel EU API, submitted a ticket to support.

1 Like

Really awesome that you guys got it working! :slight_smile:
Does anyone know how to get rid of specific text + icons in the lovelace card ?
( I marked it red in the screenshot below ) TY!

EDIT : Found it already in the CSS. :slight_smile:

dashn

2 Likes

Can you share code?

Yes ofcourse.
In the postnl-card.yaml:

Find the CSS for the Header ( Removes the Header & title ) and or Info ( removes the icons/counter )
And change/add the code: display: none;

In my case, it looks like this:

          header {
            display: none;
            flex-direction: row;
            align-items: center;
            font-family: var(--paper-font-headline_-_font-family);
            -webkit-font-smoothing: var(
              --paper-font-headline_-_-webkit-font-smoothing
            }
1 Like