Lovelace: PostNL

Thanks and done. Will let you know how it works.

By the way, today I saw the letter picture was not updated, while there was a new letter incoming which was also shown in the list. After restart of HA the right picture is showing now. Is that by design?

Nope itā€™s not. I experienced a similar issue in which I deleted the letter from the PostNL app, while the letter was still displayed together with the image. Iā€™m trying to figure out if this is part of the lovelace card, the component or the library.

Problem is that I need to reload HA to load my new code, which ā€œfixesā€ the issue.

Still digging in to it.

Restart HA to load your new codeā€¦thereby refreshing the letters anywaysā€¦haha how annoying. I get it.

I will watch it for this version but the amount of letters seems to have dropped massively the last few years in this digital age, so not a lot of testing opportunities too here.

No errors so far about no letter verification for the non letter enabled account. Nice. :ok_hand:

Update

The custom component has just been updated again. It solves a caching issue and validates if you have the letter option enabled in PostNL. Itā€™s not mandatory to perform this update.

Furthermore the card had an update too (0.9.5.). Showing you a message when you have letters enabled in the card, but not in PostNL itself. Requires the custom component to be updated, but it wonā€™t crash if you didnā€™t.

So both are optional and backwards compatible.

Latest custom component (update all):

@ptnijssen
Got lucky with an incoming letter today. No update for the letter picture with the version installed yesterday late however.

great work! this fixes my problem! thank you very much!

1 Like

Hi! Great component and card!

Would it be possible to include the url of the image of the latest letter as a sensor in the component?

1 Like

Hi @ptnijssen, thanks for the effort you put into this component. It really looks very nice! Is there a chance this custom component will be the default for HA? That would make things so much easier to useā€¦

Best regards,
QuaySo

2 Likes

Thanks guys! My idea always has been to replace the current version. Just wanted to make sure itā€™s stable.

Iā€™ve noticed a couple of bugs lately which I will fix when I back from my holiday.

After that Iā€™ll submit it to HA to become the default version. Meanwhile I am hoping to also create some automations so you can easily get notified by HA about your deliveries.

As for @9guiajkbk2, can you explain what you want to achieve? I think there is a work-around available if you can explain what you need :slight_smile:

2 Likes

Of course! Iā€™d like to create my own PostNL card by using the Templatable Configuration Card (https://github.com/custom-cards/config-template-card). And dynamically include the image of the latest letter.

Not sure though whether thatā€™s the best way to do it. Any help would be appreciated :slight_smile: Thanks!

Hope you add these great changes to the existing postnl integration soon, it looks really cool. :slight_smile:

My postnl component stops working (donā€™t know if it has something to do with updates HASS (version 0.93.2). I just updated the post nl to the latest version on the github.

After restart i get:

2019-05-25 12:07:28 ERROR (SyncWorker_1) [homeassistant.util.package] Unable to install package postnlpy==0.4.1: WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x756b95b0>: Failed to establish a new connection: [Errno -3] Try again')': /simple/postnlpy/
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x756b9c50>: Failed to establish a new connection: [Errno -3] Try again')': /simple/postnlpy/
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x756b92d0>: Failed to establish a new connection: [Errno -3] Try again')': /simple/postnlpy/
  WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x756d1730>: Failed to establish a new connection: [Errno -3] Try again')': /simple/postnlpy/
  WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x756d1cb0>: Failed to establish a new connection: [Errno -3] Try again')': /simple/postnlpy/
  ERROR: Could not find a version that satisfies the requirement postnlpy==0.4.1 (from versions: none)
ERROR: No matching distribution found for postnlpy==0.4.1
2019-05-25 12:07:28 ERROR (MainThread) [homeassistant.requirements] Not initializing postnl because could not install requirement postnlpy==0.4.1
2019-05-25 12:07:28 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform postnl: Could not install all requirements.

In lovelace it shows:
Entity not available: sensor_postnl_delivery or sensor.postnl_distribution or sensor.postnl_letters

Anyone a clue/solution for this?

Hey thanks for this great component.

Iā€™ve installed it from scrap 3 times already. It shows only 2 sensors and the card is also somewhat messed up.

Please advise.

      - type: "custom:postnl-card"
        delivery: sensor.postnl_delivery
        distribution: sensor.postnl_distribution
        letters: sensor.postnl_letters
        hide:
          delivered: false
          first_letter: false
          header: false
        date_format: "DD MMM YYYY"
        time_format: "HH:mm"
        past_days: 7
        - platform: postnl
          username: !secret postnl_user
          password: !secret postnl_pass

DeepinScreenshot_select-area_20190525225952 DeepinScreenshot_select-area_20190525230002

Within the PostNL app, you can request to retrieve also the letters that are shipped to you. Did you enable this? Any errors in your HA logs?

The card looks like I would expect at this point. What was your expectation?

I am just home from my holiday. Will check tomorrow and get back to you.

Threading works differently I see in this forum software. So let me summarize for all and delete my previous posts:

@eh50 anything in your logs?

@Clubeddie let me update tomorrow in my own instance and get back to you.

@9guiajkbk2 Iā€™ll check that tomorrow and get back to you.

Yeah lets keep it clean.

1st reply: I had that setup (letters, also rechecked!) prior to installing this component. I was using the post nl iOS app for my letters!
Let me know if i can help out!

2nd reply: Great, take it easy and settle down first :slight_smile: Hope you had a nice one.

3rd:

core-ssh:~# cat /config/home-assistant.log | grep post
2019-05-25 23:21:09 INFO (SyncWorker_5) [homeassistant.loader] Loaded postnl from custom_components.postnl
2019-05-25 23:21:09 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for postnl which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-05-25 23:21:10 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.postnl
2019-05-25 23:21:13 ERROR (MainThread) [homeassistant.components.sensor] postnl: Error on device update!
  File "/config/custom_components/postnl/sensor.py", line 201, in update

@Clubeddie Everything is fine on my 0.93.2 release. Could you just restart HA to see if it solves?

@eh50 Could you check within the custom component, if both in manifest.json as sensor.py there is a requirement ā€œpostnlpy==0.4.1ā€ present? It should be 0.4.1.

Replaced every file again, and they have the correct deps. New error log:

core-ssh:~# hassio ha check && hassio ha restart
Error: Testing configuration at /config
ERROR:homeassistant.scripts.check_config:BURB
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/scripts/check_config.py", line 205, in check
    check_ha_config_file(hass))
  File "uvloop/loop.pyx", line 1451, in uvloop.loop.Loop.run_until_complete
  File "/usr/local/lib/python3.7/site-packages/homeassistant/scripts/check_config.py", line 396, in check_ha_config_file
    platform = p_integration.get_platform(domain)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/loader.py", line 139, in get_platform
    "{}.{}".format(self.pkg_path, platform_name)
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/postnl/sensor.py", line 210, in <module>
    self._state = len(letters)
NameError: name 'letters' is not defined
Fatal error while loading config: name 'letters' is not defined
Failed config
  General Errors: 
    - name 'letters' is not defined
Successful config (partial)

edit: must been a wrong paste, no such error anymore. Still my card shows 2x the same entityā€™s, see the screen shot

2nd edit:
Works now with letters, although i have this now:
DeepinScreenshot_select-area_20190526230147
How to remove the double enroute and deliveredā€™s

I think i have another issue with my HA. It looks like it cannot connect to any outside sensor or api. Donā€™t know what that is? Disabled some addons, reboot, still same issue. I noticed it when i want to send a text to my google home. It wonā€™t connect to it. So i checked some other stuff. All outside sensors or apiā€™s could not receive anymore. Strange thing is that i can succesfull update or download addons. But there looks nothing wrong with your addon.

Disabled duckdns and all other unnecessary addons, rebootā€¦ same issueā€¦ gonna look further.