PostNL Integration

Im running 0.102.0b1 and postnl doesnt work yet.

B1 was released before my PR was merged.

0.102b2 is out. This should resolve the PostNL component for those not using the Lovelace card.

I continue my work now towards the bigger changes which allows you to drop the custom component when using the Lovelace card.

i’m running b2 now. But unfortunately i have the same error.

What exact error are you getting?

Thanx! Working again including lovelace card on 0.101.3

1 Like

So how did you fixed this ? :slight_smile: Just download these files ? https://github.com/home-assistant/home-assistant/tree/dev/homeassistant/components/postnl

Really want to try this plugin, is there a simple guide howto on getting this sensor/PR this to work?

Alright!

The simple instructions for now are:

  1. Download all three files from here: Github PR27551 Files

  2. Place them in the folder: custom_components/postnl (if the custom components and/or postnl directory don’t exist, create them)

  3. Install custom Lovelace card as described in the first post : Lovelace: PostNL

  4. Profit

1 Like

Thanks! Got it working with this info.

Was struggeling where to place the files and the postnl-dir did not exist.

I came here to check if i fucked up(or something else) but i guess the new 102.1 broke it.

I get the following error after updating to 102.1(from 101.3):

Can't connect to the PostNL webservice
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/postnl_api/postnl_api.py", line 179, in _request_login
    data = response.json()
  File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.7/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python3.7/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/postnl/sensor.py", line 50, in setup_platform
    api = PostNL_API(username, password)
  File "/usr/local/lib/python3.7/site-packages/postnl_api/postnl_api.py", line 57, in __init__
    self._request_login()
  File "/usr/local/lib/python3.7/site-packages/postnl_api/postnl_api.py", line 182, in _request_login
    raise (UnauthorizedException())
postnl_api.postnl_api.UnauthorizedException

Note that i just installed this epic plugin yesterday.

@IcyPalm I have the same issue with the library after your update. I guess PostNL made a change again to the headers :frowning:

Any chance you have your local environment still up to see what is the problem?

Will do! Today I have no time but will try tomorrow.

I will investigate if we can find another way, this is not really workable :frowning:

Just confirming that I also get this now after updating.

Thanks everyone. PostNL made some changes again which breaks the whole component once again. We are investigating and trying to see what we can do.

As we are not officially supported by PostNL, this could happen more often in the future. Other possibility is that they are actively trying to block this component to lower the amount of traffic to their API.

No further reports are needed as of now :slight_smile:

1 Like

Weird it works fine for me though I do use the custom component with your latest binaries.

I too am on 102.1. Hopefully you can find a way to fix it (and hopefully you will ever find a way to display the amount of incoming letters the way your card does it).

Thanks @ptnijssen for all the hard work!

Do you ever use the PostNL app? If so, are you on the latest version?

I never use the postnl app as I use your component :stuck_out_tongue: but the installed postnl app is indeed the latest version. Though the app doesn’t really do much for this component right?

Nope, but it’s strange that it’s working for you, while it doesn’t for me. I am just assuming, but maybe when PostNL sees a login through the latest app version and then uses a different login method, effectively not allowing the old one anymore.

Just a long shot guess though.

Our research is continuing in this GitHub issue; https://github.com/iMicknl/python-postnl-api/issues/17

1 Like