USPS Sensor

I added the USPS sensor at V0.52.0 (IIRC) and it never worked. Not having time to fuss with it, I let it slide. Upgraded to V0.52.1 today. I get the same USPS errors.

I worked through this thread: USPS Sensor 'myusps.USPSError: Not logged in' but nothing there fixed my issue.

Before I spend much time on it, is this sensor just wonky? Or does anyone have it working reliably? Trying to decide if I should plug away at it or give up and wait for future updates. It isn’t the most important item to me, although I’d like it to work.

My configuration is the very simple:

USPS Mail Images

usps:
username: MyLogin
password: MySecretPassword

If anyone is interested, the error is as follows…

2017-09-01 13:35:13 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.4/asyncio/tasks.py”, line 233, in _step
result = coro.throw(exc)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py”, line 381, in async_process_entity
new_entity, self, update_before_add=update_before_add
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py”, line 212, in async_add_entity
yield from self.hass.async_add_job(entity.update)
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/usps.py”, line 107, in update
self._usps.update()
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/util/init.py”, line 306, in wrapper
result = method(*args, **kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/usps.py”, line 80, in update
self.packages = myusps.get_packages(self.session)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 177, in wrapped
return function(*args)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 208, in get_packages
dashboard = _require_elem(response, DASHBOARD_TAG, DASHBOARD_ATTRS)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 89, in _require_elem
raise ValueError(‘No element found’)
ValueError: No element found
2017-09-01 13:35:45 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.usps_packages fails
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity.py”, line 225, in async_update_ha_state
yield from self.hass.async_add_job(self.update)
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/usps.py”, line 55, in update
self._usps.update()
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/util/init.py”, line 306, in wrapper
result = method(*args, **kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/usps.py”, line 80, in update
self.packages = myusps.get_packages(self.session)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 177, in wrapped
return function(*args)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 208, in get_packages
dashboard = _require_elem(response, DASHBOARD_TAG, DASHBOARD_ATTRS)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 89, in _require_elem
raise ValueError(‘No element found’)
ValueError: No element found
2017-09-01 13:35:56 WARNING (MainThread) [homeassistant.components.remote] Setup of platform harmony is taking over 10 seconds.
2017-09-01 13:35:56 WARNING (MainThread) [homeassistant.components.media_player] Setup of platform cast is taking over 10 seconds.
2017-09-01 13:36:16 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.usps_packages fails
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity.py”, line 225, in async_update_ha_state
yield from self.hass.async_add_job(self.update)
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/usps.py”, line 55, in update
self._usps.update()
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/util/init.py”, line 306, in wrapper
result = method(*args, **kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/usps.py”, line 80, in update
self.packages = myusps.get_packages(self.session)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 177, in wrapped
return function(*args)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 208, in get_packages
dashboard = _require_elem(response, DASHBOARD_TAG, DASHBOARD_ATTRS)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 89, in _require_elem
raise ValueError(‘No element found’)
ValueError: No element found
2017-09-01 13:36:47 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.usps_packages fails
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity.py”, line 225, in async_update_ha_state
yield from self.hass.async_add_job(self.update)
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/usps.py”, line 55, in update
self._usps.update()
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/util/init.py”, line 306, in wrapper
result = method(*args, **kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/usps.py”, line 80, in update
self.packages = myusps.get_packages(self.session)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 177, in wrapped
return function(*args)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 208, in get_packages
dashboard = _require_elem(response, DASHBOARD_TAG, DASHBOARD_ATTRS)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 89, in _require_elem
raise ValueError(‘No element found’)
ValueError: No element found
2017-09-01 13:37:18 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.usps_packages fails
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity.py”, line 225, in async_update_ha_state
yield from self.hass.async_add_job(self.update)
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/usps.py”, line 55, in update
self._usps.update()
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/util/init.py”, line 306, in wrapper
result = method(*args, **kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/usps.py”, line 80, in update
self.packages = myusps.get_packages(self.session)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 177, in wrapped
return function(*args)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 208, in get_packages
dashboard = _require_elem(response, DASHBOARD_TAG, DASHBOARD_ATTRS)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 89, in _require_elem
raise ValueError(‘No element found’)
ValueError: No element found
2017-09-01 13:37:49 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.usps_packages fails
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity.py”, line 225, in async_update_ha_state
yield from self.hass.async_add_job(self.update)
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/usps.py”, line 55, in update
self._usps.update()
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/util/init.py”, line 306, in wrapper
result = method(*args, **kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/usps.py”, line 80, in update
self.packages = myusps.get_packages(self.session)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 177, in wrapped
return function(*args)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 208, in get_packages
dashboard = _require_elem(response, DASHBOARD_TAG, DASHBOARD_ATTRS)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 89, in _require_elem
raise ValueError(‘No element found’)
ValueError: No element found
2017-09-01 13:38:21 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.usps_packages fails
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity.py”, line 225, in async_update_ha_state
yield from self.hass.async_add_job(self.update)
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/usps.py”, line 55, in update
self._usps.update()
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/util/init.py”, line 306, in wrapper
result = method(*args, **kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/usps.py”, line 80, in update
self.packages = myusps.get_packages(self.session)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 177, in wrapped
return function(*args)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 208, in get_packages
dashboard = _require_elem(response, DASHBOARD_TAG, DASHBOARD_ATTRS)
File “/srv/homeassistant/lib/python3.4/site-packages/myusps/init.py”, line 89, in _require_elem
raise ValueError(‘No element found’)
ValueError: No element found

When I had issues a little while back I got them fixed by running these:

sudo apt-get install libxslt1-dev
sudo su -s /bin/bash homeassistant
source /srv/homeassistant/bin/activate

pip3 install myusps

and following these instructions:

Not sure if that is still applicable more than two months later (esp. the second part) but the first part might be worth a try at least.

Please note:
My HASS is installed in a virtual environment.

I’ll give that a go. Thanks!

Appreciate the idea. Did step one. Rebooted. Same error. Went to do step 2, but did a file compare using Notepad++ compare plugin and my source code matched the GIT source code. So it didn’t make any difference.

Thanks again. I’ll probably just wait and see if future upgrades fixes it for me. I have other HA stuff I can play with.

Are you fully “opted-in” on the usps site?

See the first paragraph on the component docs: https://home-assistant.io/components/usps/

Yes. I can sign in and use the web site. I get email notifications with the images, etc. So I think I am good there.

@gooberautomation I have it working on 0.52.0. I do get an ‘error loading image’ if there is no mail coming for that day, which is annoying. But other than that it seems to be working for me.

Fully working on .52.1

Would love too see that no image error replaced with a picture of a smiling Uncle Vernon.

Too bad that didn’t work.
I must admit, though, that it’s a little finicky - there are days when I have to restart HAss two or three times because the USPS info doesn’t show up after the first restart.

@gooberautomation The usps related errors in the log you posted are all on the package fetching call. The package side is separate from the normal mail delivery notifications/images, but required for the component to function. If you are positive you’ve opted in to everything we may be seeing a different page presentation by region since the errors indicate the underlying myusps library was unable to parse the package info for your account.

@jhall0712 and @atomicpapa Adding in an option to the camera platform to specify a default image is on my todo list, but in the meantime I did get a wording changed merged into the front end to change the error text to “Image not available” so it doesn’t look like an error occurred.

@mezz64 That’s awesome. Thanks for all your work on it!

Awesome… But I’m still pushing for the image of Uncle Vernon!

I’m having a similar issue using Hassio. Posts shows as 0 even though I know I have some coming. I get emailed the USPS daily digest with images of what’s coming that day so I know that part works but Hassio always shows 0 and the camera says error loading image. My config looks like this:

usps:
username: !username
password: !password

Some of the error logs mention not being logged in:

Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/myusps/init.py”, line 177, in wrapped
return function(*args)
File “/usr/lib/python3.6/site-packages/myusps/init.py”, line 208, in get_packages
dashboard = _require_elem(response, DASHBOARD_TAG, DASHBOARD_ATTRS)
File “/usr/lib/python3.6/site-packages/myusps/init.py”, line 86, in _require_elem
raise USPSError(‘Not logged in’)
myusps.USPSError: Not logged in

Right now the USPS sensor is generating error logs a mile long.

I just added the one for UPS (not USPS) and it works fine.