UPS package tracking through UPS My Choice

Anybody else order a ton of crap through amazon and/or other such services? Thinking something similar to https://home-assistant.io/components/sensor.usps/ that could be used with your My Choice UPS account to notify you of approximate package arrival times etc.

1 Like

This is currently already possible with the imap email content sensor with a little templating.

That said, something built in would be simpler, provided it is easy to set up. I think the new USPS sensor works by scraping the web interface, so it wouldn’t likely be easy to adapt to the UPS site.

UPS does offer its own API.
Shippo offers a single API for multiple shippers. It might be another option for this. Haven’t dug into the docs too deeply yet.

I found a few other projects on github, but most haven’t been updated in awhile.

Unlikely to happen currently as UPS doesn’t have an API for My Choice.

1 Like

Will this be integrated into the next release? Or does this need to be manually imported? New to HA

Next release.

Hey, Just tried using the UPS Sensor, but getting the following error, any ideas?

17-04-26 16:51:11 ERROR (MainThread) [homeassistant.setup] Not initializing sensor.ups because could not install dependency upsmychoice==1.0.2
17-04-26 16:51:11 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform sensor.ups: Could not install all requirements.

From in your virtualenv, try pip install upsmychoice==1.0.2

No luck.

pip3 install upsmychoice==1.0.2
Downloading/unpacking upsmychoice==1.0.2
  Downloading upsmychoice-1.0.2.tar.gz
  Running setup.py (path:/tmp/pip-build-fspkp1kr/upsmychoice/setup.py) egg_info for package upsmychoice

Downloading/unpacking beautifulsoup4==4.5.1 (from upsmychoice==1.0.2)
  Downloading beautifulsoup4-4.5.1-py3-none-any.whl (83kB): 83kB downloaded
Downloading/unpacking python-dateutil==2.6.0 (from upsmychoice==1.0.2)
  Downloading python_dateutil-2.6.0-py2.py3-none-any.whl (194kB): 194kB downloaded
Downloading/unpacking requests==2.12.4 (from upsmychoice==1.0.2)
  Downloading requests-2.12.4-py2.py3-none-any.whl (576kB): 576kB downloaded
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil==2.6.0->upsmychoice==1.0.2)
Installing collected packages: upsmychoice, beautifulsoup4, python-dateutil, requests
  Running setup.py install for upsmychoice
    error: could not create '/usr/local/lib/python3.4/dist-packages/upsmychoice': Permission denied
    Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-fspkp1kr/upsmychoice/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-fufqdpfi-record/install-record.txt --single-version-externally-managed --compile:
    running install

running build

running build_py

creating build

creating build/lib

creating build/lib/upsmychoice

copying upsmychoice/__init__.py -> build/lib/upsmychoice

running install_lib

creating /usr/local/lib/python3.4/dist-packages/upsmychoice

error: could not create '/usr/local/lib/python3.4/dist-packages/upsmychoice': Permission denied

----------------------------------------
Cleaning up...
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-fspkp1kr/upsmychoice/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-fufqdpfi-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-fspkp1kr/upsmychoice
Storing debug log for failure in /home/pi/.pip/pip.log

You’re not in your virtualenv. Note how it’s installing to your system python site packages.

I’m not in a virtualenv

Then you’ll have to switch to a superuser

I am logged in as the only user = pi

If it matters, running Home Assistant on Raspberry Pi using HASSbian

Upgraded Hassbian, now get the following Error:-

17-04-28 14:32:36 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 4, in <module>
    from json.decoder import JSONDecodeError
ImportError: cannot import name 'JSONDecodeError'

Im getting the exact same error. Did you get it figured out?

Sorry, no, I ended up removing it from HASS.

Were you able to get this working?

nope and even todays update to 0.46 doesnt seem to do the trick either. Not sure whats wrong but i get this error still

2017-06-04 15:03: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 160, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
  File "/usr/lib/python3.4/asyncio/tasks.py", line 372, in wait_for
    return fut.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'

That’s the same error I get.

I tried upgrading to 0.46, but no go, HASS won’t load after upgrade, reverted back to 0.45.1.