Somebody know why I only see [object] instead of information of the delivery and letters?
You probably donāt have mail coming.
I mean, did you get any mail in the last 5 days and/or are you going to receive some in a day? To check this you can open the postnl app. If you didnāt get mail the past few days and are not receiving mail tomorrow it will not show details (hence the object object).
@jimz011 thanks. But I received a letter yesterday and today I get 3 letters. Stille seeing only object object.
So i don 't know where itās going wrong. Itās updating the total.
Now also see the following error:
Log Details (ERROR)
Fri Oct 04 2019 07:28:42 GMT+0200 (Midden-Europese zomertijd)
Update for sensor.postnl_letters fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 441, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/postnl/sensor.py", line 204, in update
letters = self._api.get_letters()
File "/usr/local/lib/python3.7/site-packages/postnlpy/postnlapi.py", line 134, in get_letters
self.update()
File "/usr/local/lib/python3.7/site-packages/postnlpy/postnlapi.py", line 79, in update
self.update_letter_status()
File "/usr/local/lib/python3.7/site-packages/postnlpy/postnlapi.py", line 117, in update_letter_status
if validate.get('status') == 'Validated':
AttributeError: 'bool' object has no attribute 'get'
Also itās strange because i can see information thatās is recieve:
But still itās has the Object Object information showing in the attributes
It always has been [object], both in the current component and this component. The lovelace card nicely translates this to a nice view.
To all: A pull request has been created towards HA which removes the necessity for the custom component. Assuming it will be part of 0.101, I suggest to remove the custom component when updating.
very good news! Will look forward to it.
So I recently started to change my lovelace UI and I have stumbled upon a problem. I get 3 sensors namely delivery, packages and letters. They work fine, however I do have a problem with the letters sensor. When I use your lovelace card it will say I have 2 letters arriving, but when I look at the sensor it says there are 6 letters arriving. Looking at the history I received 4 packages this week and the sensor counts those 4 packages (that have already been received) into the letters sensor.
I this something that can be overcome? As your lovelace card does show the right amount of letters incoming. I wanted to create something like your example a few posts back (examples you made to show people how to make a āsmallerā card). But this way the sensor isnāt that useful.
I hope you could tell me what is wrong and/or fix it or tell me how I could try to fix it XD.
Thanks for this awesome component/card though and I canāt wait for it to be in core HA.
@everyone. Unfortunately my PR didnāt got merged yet, probably due to the high amount of PRs that HA received during Hacktoberfest. Hopefully it will be part of version 0.102. So for now, you need to continue using the custom component.
Thanks for your report and I am aware of the problem. The problem is the fact that a package has a clear ādeliveredā or āenrouteā state in the PostNL API. So I know if a package is enroute or delivered and I only show the enroute in the state of the object.
The letters are different. PostNL does not have a ādeliveredā or āenrouteā state for letters as they canāt even track letters themselves. So the component only retrieves all letters and displays that number, while the lovelace card actually tries to calculate, based on the probable delivery date, if the letter is enroute or delivered.
So the change I need to make, is to make sure that within the library or component, I try to make a difference between enroute and delivered and only add the enroute ones to the state. I will add this to my list and try to fix it.
At the moment I use a template sensor and deduct 4 letters from the total. This works somewhat okayish, but it isnāt perfect obviously. Your card however displays it pretty good but with the aforementioned problems. Though it is better than my solution . Hope you can fix it one day. Thanks though!
Edit: I use it to display the amount of letters in the header:
What do you mean, the solution to the sensor? Well it is not really a solution, more or less a nasty workaround.
Basically I made a template sensor with the letters I receive and deducted 4 letters from the total. I can share the sensor but I donāt have access to an actual computer at the moment. Though mind you this doesnāt work very well, but well enough for the time being.
Your āfrontpageā looks great, nice done! I also like the icons with badge counters. How did you do that? Iām always looking for examples to improve my setup. Iām not an expert but have fun playing around with HA. Thanks anyway for your reply.
Actually it is experimental and I am currently rewriting my complete lovelace setup to make it more compact and the use of different cards/mods. Unfortunately the code is currently very experimental and the header alone is comprised out of 6 files! So I am not confident to share it (yet).
However, I will release my code as a package soon. For my current releases you can check out my repo.
I will update the repo when I release the new code.
Super! Thanks!!
When I add the lines to the configuration without custom component, the postnl sensor works fine. As soon as I create a folder for custom component with the files and restart I get this error:
Can't connect to the PostNL API
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/postnlpy/postnlapi.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 518, 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 43, in setup_platform
api = PostnlApi(username, password, refresh_rate.total_seconds())
File "/usr/local/lib/python3.7/site-packages/postnlpy/postnlapi.py", line 62, in __init__
self._request_login()
File "/usr/local/lib/python3.7/site-packages/postnlpy/postnlapi.py", line 182, in _request_login
raise (UnauthorizedException())
postnlpy.postnlapi.UnauthorizedException
What causes it? Is it something that i am doing wrong?