Skip to content
Snippets Groups Projects
Commit a8784f9a authored by happyleavesaoc's avatar happyleavesaoc Committed by Paulus Schoutsen
Browse files

update usps (#9540)

* update usps

* fix syntax issue
parent e7c08921
No related branches found
No related tags found
No related merge requests found
......@@ -77,7 +77,7 @@ class USPSCamera(Camera):
def model(self):
"""Return date of mail as model."""
try:
return 'Date: {}'.format(self._usps.mail[0]['date'])
return 'Date: {}'.format(str(self._usps.mail[0]['date']))
except IndexError:
return None
......
......@@ -11,7 +11,7 @@ from homeassistant.components.usps import DATA_USPS
from homeassistant.const import ATTR_ATTRIBUTION, ATTR_DATE
from homeassistant.helpers.entity import Entity
from homeassistant.util import slugify
from homeassistant.util.dt import now, parse_datetime
from homeassistant.util.dt import now
_LOGGER = logging.getLogger(__name__)
......@@ -57,7 +57,7 @@ class USPSPackageSensor(Entity):
for package in self._usps.packages:
status = slugify(package['primary_status'])
if status == STATUS_DELIVERED and \
parse_datetime(package['date']).date() < now().date():
package['date'] < now().date():
continue
status_counts[status] += 1
self._attributes = {
......@@ -116,7 +116,7 @@ class USPSMailSensor(Entity):
attr = {}
attr[ATTR_ATTRIBUTION] = self._usps.attribution
try:
attr[ATTR_DATE] = self._usps.mail[0]['date']
attr[ATTR_DATE] = str(self._usps.mail[0]['date'])
except IndexError:
pass
return attr
......
......@@ -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.1.3']
REQUIREMENTS = ['myusps==1.2.1']
_LOGGER = logging.getLogger(__name__)
......
......@@ -428,7 +428,7 @@ mutagen==1.38
mycroftapi==2.0
# homeassistant.components.usps
myusps==1.1.3
myusps==1.2.1
# homeassistant.components.media_player.nad
# homeassistant.components.media_player.nadtcp
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment