USPS - No Element Found

Hello,

I am trying to configure USPS connector. This is the entry in configuration.yaml:

sensor:
  - platform: usps
    username: !secret usps_username
    password: !secret usps_password
    name: USPS

When I restart my HA, I receive the following:


About


Home Assistant
0.49.1

Path to configuration.yaml: /home/homeassistant/.homeassistant

Developed by a bunch of awesome people.

Published under the Apache 2.0 license
Source: server — frontend-ui

Built using Python 3, Polymer 1.9.2, Icons by Google and MaterialDesignIcons.com.

The following errors have been logged this session:
2017-07-29 14:51:02 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/homeassistant_venv/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/homeassistant_venv/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/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/sensor/usps.py", line 124, in update
    self._state = len(myusps.get_mail(self._session))
  File "/home/homeassistant/.homeassistant/deps/myusps/__init__.py", line 176, in wrapped
    return function(*args)
  File "/home/homeassistant/.homeassistant/deps/myusps/__init__.py", line 229, in get_mail
    container = _require_elem(response, INFORMED_DELIVERY_TAG, INFORMED_DELIVERY_ATTRS)
  File "/home/homeassistant/.homeassistant/deps/myusps/__init__.py", line 89, in _require_elem
    raise ValueError('No element found')
ValueError: No element found

Can someone help with this?
If I remove USPS from configuration, I do not have any errors at all.

Have you signed up for informed delivery?

Yes, I have. When I login to USPS website, I see there is one package is coming.

Informed Delivery is for mail, not packages.

Thank you, I missed that part. Now, when I opt-in for Informed delivery, I have the following errors. There are a few of them, but basically all the same. I am sure that user name and password are correct.

 File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/sensor/usps.py", line 78, in update 
  for package in myusps.get_packages(self._session):
 File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/myusps/__init__.py", line 179, in wrapped 
  _login(args[0])
 File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/myusps/__init__.py", line 156, in _login
   raise USPSError('authentication failed')
 myusps.USPSError: authentication failed

Suddenly it started working. Not sure why. Well…

Thank you.