fix usps? (#9557)
This commit is contained in:
parent
e2ce1d05ae
commit
84524e0712
3 changed files with 7 additions and 4 deletions
|
@ -57,7 +57,7 @@ class USPSPackageSensor(Entity):
|
|||
for package in self._usps.packages:
|
||||
status = slugify(package['primary_status'])
|
||||
if status == STATUS_DELIVERED and \
|
||||
package['date'] < now().date():
|
||||
package['delivery_date'] < now().date():
|
||||
continue
|
||||
status_counts[status] += 1
|
||||
self._attributes = {
|
||||
|
|
|
@ -15,7 +15,7 @@ from homeassistant.helpers import (config_validation as cv, discovery)
|
|||
from homeassistant.util import Throttle
|
||||
from homeassistant.util.dt import now
|
||||
|
||||
REQUIREMENTS = ['myusps==1.2.1']
|
||||
REQUIREMENTS = ['myusps==1.2.2']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -23,6 +23,7 @@ DOMAIN = 'usps'
|
|||
DATA_USPS = 'data_usps'
|
||||
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=30)
|
||||
COOKIE = 'usps_cookies.pickle'
|
||||
CACHE = 'usps_cache'
|
||||
|
||||
USPS_TYPE = ['sensor', 'camera']
|
||||
|
||||
|
@ -45,7 +46,9 @@ def setup(hass, config):
|
|||
import myusps
|
||||
try:
|
||||
cookie = hass.config.path(COOKIE)
|
||||
session = myusps.get_session(username, password, cookie_path=cookie)
|
||||
cache = hass.config.path(CACHE)
|
||||
session = myusps.get_session(username, password,
|
||||
cookie_path=cookie, cache_path=cache)
|
||||
except myusps.USPSError:
|
||||
_LOGGER.exception('Could not connect to My USPS')
|
||||
return False
|
||||
|
|
|
@ -432,7 +432,7 @@ mutagen==1.38
|
|||
mycroftapi==2.0
|
||||
|
||||
# homeassistant.components.usps
|
||||
myusps==1.2.1
|
||||
myusps==1.2.2
|
||||
|
||||
# homeassistant.components.media_player.nad
|
||||
# homeassistant.components.media_player.nadtcp
|
||||
|
|
Loading…
Add table
Reference in a new issue