Make sure you are running the latest version of Home Assistant before reporting an issue.
You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:
**Home Assistant release (hass --version):0.39.0
**Python release (python3 --version):3.4.2
Component/platform:rpi3
Description of problem:
Both new sensors FEDEX and UPS causing error at startup and not loading / working
Expected:
Problem-relevant configuration.yaml entries and steps to reproduce:
- platform: fedex
name: 'FedEx'
username: !secret fedex_username
password: !secret fedex_password
update_interval: 02:00
- platform: ups
name: 'UPS'
username: !secret ups_username
password: !secret ups_password
update_interval: 02:00
Traceback (if applicable):
```17-02-26 10:34:50 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform ups
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 151, in _async_setup_platform
entity_platform.add_entities, discovery_info
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/ups.py", line 44, in setup_platform
import upsmychoice
File "/home/homeassistant/.homeassistant/deps/upsmychoice/__init__.py", line 4, in
from json.decoder import JSONDecodeError
ImportError: cannot import name 'JSONDecodeError'
17-02-26 10:34:51 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform fedex
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 151, in _async_setup_platform
entity_platform.add_entities, discovery_info
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/fedex.py", line 55, in setup_platform
config.get(CONF_UPDATE_INTERVAL))])
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/fedex.py", line 68, in __init__
self.update()
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/util/__init__.py", line 296, in wrapper
result = method(args, *kwargs)
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/fedex.py", line 84, in _update
for package in fedexdeliverymanager.get_packages(self._session):
File "/home/homeassistant/.homeassistant/deps/fedexdeliverymanager/__init__.py", line 62, in wrapped
return function(args)
File "/home/homeassistant/.homeassistant/deps/fedexdeliverymanager/__init__.py", line 111, in get_packages
'estimated_delivery_date': str(parse(package['estDelTs']).date()),
File "/home/homeassistant/.homeassistant/deps/dateutil/parser.py", line 1168, in parse
return DEFAULTPARSER.parse(timestr, *kwargs)
File "/home/homeassistant/.homeassistant/deps/dateutil/parser.py", line 562, in parse
raise ValueError("String does not contain a date.")
ValueError: String does not contain a date.
```
Additional info:
This seems like a bug in the dependency. JSONDecodeError is an exception class that is only available in Python 3.5+.
CC @happyleavesaoc
thanks, looking into how to upgrade python versions ....
edit: not finding a simple way to upgrade python to 3.5+ in my home assistant venv ... have to do more research tomorrow.
Same issue here. I installed HASSBIAN on my Pi3 less than a month ago, shouldn't it have installed the latest Python automatically?
edit: After some research it looks like Python 3.4 is the version that comes with the current stable Raspbian release with 3.5 being available as part of the next release image that is out for testing. As mentioned by @lukewayne , I found several places giving instructions to update to 3.5 in the current image, but I wouldn't know how to "transfer" Home Assistant to use the new version instead of the current one.
Dependencies for these components should support 3.4. Will do that when I get a chance.
This is also still an issue in v0.39.1
Obviously, these kind of components are 'nice-to-haves' and not blocking for using Home Assistant, but something that could have been caught before release.
Thanks for the effort though, @happyleavesaoc
I was actually planning on creating these 2 myself in the coming weeks, after trying your USPS component ;)
@happyleavesaoc Is there a quick fix for this that users can make, or is it something we should wait for to be committed?
FWIW - The FedEx component works fine for me, but the UPS My Choice one gives the JSONDecodeError error above.
@mariniertje Things can only be caught if people help test. Of course I test things, but the nature of the services we're interacting with preclude me from testing every possibility.
@eiddor It looks like there's a package in UPS My Choice without an estimated delivery date. It should work if/when that field gets populated. I need to update the module to make that field optional.
@happyleavesaoc Interesting - Looking at the three deliveries in my queue, they all have estimated delivery dates already, so I might be hitting something else. Here's the output from my log:
17-03-01 08:37:28 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.ups
17-03-01 08:37:28 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform ups
Traceback (most recent call last):
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 151, in _async_setup_platform
entity_platform.add_entities, discovery_info
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/ups.py", line 44, in setup_platform
import upsmychoice
File "/home/homeassistant/.homeassistant/deps/upsmychoice/__init__.py", line 4, in <module>
from json.decoder import JSONDecodeError
ImportError: cannot import name 'JSONDecodeError'
Let me know if you need me to test anything - Thanks for the help!
FWIW - commenting out from json.decoder import JSONDecodeError made it work on my end, but I know that doesn't fix the estimated delivery date issue.
I also get a Cannot read property 'v' of undefined× when I click on UPS, so I'll stop messing around now :-)
@eiddor Yep, those are two unrelated issues, though they co-occurred for another user.
The Cannot read ... thing is another unrelated Home Assistant issue. I assume you're talking about the graph in the UI.
@happyleavesaoc Yep, it's in the graph (which I rarely look at). On the bright side, I now have a nice Deliveries card that works :-)

@eiddor Did you have to edit and put it on the custom folder?
@J-CMartin I just commented out line 4 in deps/upsmychoice/__init__.py
Gotcha, did that on the ups one and realized that Fedex didn't have that dependency and was throwing a different error due to an old shipment without a delivery date. Cleaned-up old shipments and it's working now.
Thanks for the tip @eiddor
Quick question... How did u do the Deliveries Card on your screenshot? Mine are showing on the top of the page.
@J-CMartin
Good stuff!
To make them a card, just put them in a group, like so:
Deliveries:
name: Deliveries
entities:
- sensor.ups
- sensor.fedex
@J-Cmartin
You can change icons and names as well, if you like, by putting something
like the following in customized:
or in customized.yaml, if you're using a separate file like me:
sensor.usps:
icon: package-variant-closed
friendly_name: USPS
sensor.ups:
icon: package-variant-closed
friendly_name: UPS
sensor.fedex:
icon: package-variant-closed
friendly_name: FedEx
On 1 March 2017 at 07:55, Roddie Hasan notifications@github.com wrote:
@J-CMartin https://github.com/J-CMartin
Good stuff!
To make them a card, just put them in a group, like so:
Deliveries:
name: Deliveries
entities:
- sensor.ups
- sensor.fedex—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/home-assistant/home-assistant/issues/6251#issuecomment-283380173,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AXYVLalzGdslmFhrPtGemczLswbthzKEks5rhZTjgaJpZM4MMee4
.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:
0.45 hopefully solves these issues.
Issue with the JSONDecodeError is still there for us using Python 3.4. Is there an alternative for this? The other 2 components(USPS and Fedex) don't have it and work fine but I have to manually update (comment out line 7) the init.py file for the UPS component every time HASS version is updated.
I copied the most recent version from the Github and just tested it. The component is working again after the latest update except for this issue with the JSONDecoder import.
2017-05-19 22:32:56 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform ups
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 155, in _async_setup_platform
entity_platform.schedule_add_entities, discovery_info
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/ups.py", line 44, in setup_platform
import upsmychoice
File "/home/homeassistant/.homeassistant/deps/upsmychoice/__init__.py", line 7, in <module>
from json.decoder import JSONDecodeError
ImportError: cannot import name 'JSONDecodeError'
0.45 has not loaded the latest versions for me. Still loading 1.0.2 for UPS and 1.0.5 for USPS.
With the 0.46 update, UPS is now loading the latest version 1.0.4, but the JSONDecodeError still remains for us running on Raspberry Pi and any other machine with Python 3.4. I've changed the code on GitHub so it'd work for either version. The Pull Request is waiting for @happyleavesaoc approval.
Glad to report that the Pull Request was approved and the JSONDecodeError is fixed on the UPS component 1.0.5 onward. No more manual edits
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:
Works well in the latest versions!
Most helpful comment
@J-Cmartin
You can change icons and names as well, if you like, by putting something
like the following in customized:
DELIVERIES
icon: package-variant-closed
friendly_name: USPS
icon: package-variant-closed
friendly_name: UPS
icon: package-variant-closed
friendly_name: FedEx
or in customized.yaml, if you're using a separate file like me:
DELIVERIES
sensor.usps:
icon: package-variant-closed
friendly_name: USPS
sensor.ups:
icon: package-variant-closed
friendly_name: UPS
sensor.fedex:
icon: package-variant-closed
friendly_name: FedEx
On 1 March 2017 at 07:55, Roddie Hasan notifications@github.com wrote: