PostNL Integration

Just checking, this library right?: https://github.com/iMicknl/python-postnl-api/

I have tried downloading these files and use them as a custom component, unfortunately it didnā€™t work.

Correct. If you have a fix, make a PR to that one and ask the maintainer to tag. I will update the component in HA when possible.

Thanks for your help!

Done! Waiting for a reply now

1 Like

You could fix it short term by adding https://github.com/peternijssen/postnlpy to your /homeassistant/deps/lib/python3.7/site-packages/postnlpy and then modify the postnlapi.py

from:

DEFAULT_HEADER = {
    'api-version': '4.16',
    'X-Client-Library': 'PostnlPy',
}

to:

DEFAULT_HEADER = {
    'api-version': '4.16',
    'X-Client-Library': 'PostnlPy',
    'User-Agent': 'PostNL/Android/6.5.1',
}

And then restart HA

2 Likes

User agent Android? Or does it not matter which device? Seems like it shouldnā€™t matter :joy::rofl: will try this!

User-Agent Firefox and Chrome did not seem work, Postman and the PostNL Android app seem to work so yeahā€¦ :blush:

ehmm, and all credit go to IcyPalm, I just fiddled it in the postnlapi.py :wink:

2 Likes

Thanks all. I will try to get this all in HA asap. Most important is that the library is getting merged. Hope this time it goes quick, last time it took about 20 to 30 days.

How do I easily acces these files? :sweat_smile:

Iā€™ve created an issue in the repository of HA to track progress. I will write down the temporarily work around probably tonight when I am home.

Please follow this issue to stay up to date about the progress: https://github.com/home-assistant/home-assistant/issues/28726

3 Likes

How can I access the postnlapi.py file when I ssh into the RPi. My HA instance runs on Hassio.
Many thanks.

1 Like

You need to download it from github (I even posted the URL) and copy the files to the structure as outlined in my previous post. Then edit the file, make the change and restart.

Hi all. Great news as the library has been updated.

Best work-around you can do right now:

Iā€™ll try to get it in HA soon.

4 Likes

Hi all,

Iā€™m new to HA so please be gentle :slight_smile:

I try to install this great plugin into my system, though i understand that there are some issues related to PostNLā€™s API.

My first steps are:

  1. Copy the files that are mentioned in the first post in /custom_components/postnl/:
  2. I added the sensor in the configuration.yaml that is documented in https://www.home-assistant.io/components/postnl/
  3. I donā€™t have the 3 sensors, but only one that is doing nothing. Even after restart HA.
  4. I copied https://github.com/peternijssen/postnlpy to /custom_components/postnl/ and edit the postnlapi.py file with the new header.
  5. Restarted HA
  6. Error:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/postnlpy/postnlapi.py", line 179, in _request_login
    data = response.json()
  1. Downloaded the files from peters last post restart HA.

Strange thing is that i canā€™t connect to the webadmin anymore, just an error that the page canā€™t be displayed.
I can ping the system and connect through samba. When i delete the files mentioned in step 7, then i can use the webadmin again.

Any ideas ?

Kind Regards
Kevin

Iā€™m not 100% sure where this goes wrong but my current advice is: wait for just a moment(few days/weeks) until the new version of the plugin is officially released and then you can just use the official new plugin without all the hassle of the file-copying and fixing :slight_smile:

1 Like

Will do! Thanks!

Hi all. Yet another update.

I just created a PR that fixes the PostNL component (without support for the lovelace card). That at least makes sure that many people already can use the component again, without needing my changes.

If you are not using the PostNL Lovelace card, keep an eye on this PR: https://github.com/home-assistant/home-assistant/pull/28794
If you are using the PostNL Lovelace card, keep an eye on this PR: https://github.com/home-assistant/home-assistant/pull/27551

I dont think they will fix it in the next version. At least the 0.102 dev / rc version will not fix this problem :frowning:

My PR got merged yesterday. I think it will be in the next BETA of 0.102.

1 Like