mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 08:47:10 +00:00
fix usps? (#9557)
This commit is contained in:
parent
e2ce1d05ae
commit
84524e0712
@ -57,7 +57,7 @@ class USPSPackageSensor(Entity):
|
|||||||
for package in self._usps.packages:
|
for package in self._usps.packages:
|
||||||
status = slugify(package['primary_status'])
|
status = slugify(package['primary_status'])
|
||||||
if status == STATUS_DELIVERED and \
|
if status == STATUS_DELIVERED and \
|
||||||
package['date'] < now().date():
|
package['delivery_date'] < now().date():
|
||||||
continue
|
continue
|
||||||
status_counts[status] += 1
|
status_counts[status] += 1
|
||||||
self._attributes = {
|
self._attributes = {
|
||||||
|
@ -15,7 +15,7 @@ from homeassistant.helpers import (config_validation as cv, discovery)
|
|||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
from homeassistant.util.dt import now
|
from homeassistant.util.dt import now
|
||||||
|
|
||||||
REQUIREMENTS = ['myusps==1.2.1']
|
REQUIREMENTS = ['myusps==1.2.2']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -23,6 +23,7 @@ DOMAIN = 'usps'
|
|||||||
DATA_USPS = 'data_usps'
|
DATA_USPS = 'data_usps'
|
||||||
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=30)
|
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=30)
|
||||||
COOKIE = 'usps_cookies.pickle'
|
COOKIE = 'usps_cookies.pickle'
|
||||||
|
CACHE = 'usps_cache'
|
||||||
|
|
||||||
USPS_TYPE = ['sensor', 'camera']
|
USPS_TYPE = ['sensor', 'camera']
|
||||||
|
|
||||||
@ -45,7 +46,9 @@ def setup(hass, config):
|
|||||||
import myusps
|
import myusps
|
||||||
try:
|
try:
|
||||||
cookie = hass.config.path(COOKIE)
|
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:
|
except myusps.USPSError:
|
||||||
_LOGGER.exception('Could not connect to My USPS')
|
_LOGGER.exception('Could not connect to My USPS')
|
||||||
return False
|
return False
|
||||||
|
@ -432,7 +432,7 @@ mutagen==1.38
|
|||||||
mycroftapi==2.0
|
mycroftapi==2.0
|
||||||
|
|
||||||
# homeassistant.components.usps
|
# homeassistant.components.usps
|
||||||
myusps==1.2.1
|
myusps==1.2.2
|
||||||
|
|
||||||
# homeassistant.components.media_player.nad
|
# homeassistant.components.media_player.nad
|
||||||
# homeassistant.components.media_player.nadtcp
|
# homeassistant.components.media_player.nadtcp
|
||||||
|
Loading…
x
Reference in New Issue
Block a user