USPS Mail Camera

Sorry about that. I made the commit locally and forgot to push to github. Changes should be there now.

Thank you! I can’t say I understand the image rotation (based on what I read from your reply this exists)

Can you explain how this works with multiple mails received?

It’s just the amount of time to show each piece of mail. So if you set it at 30s the camera will show each piece of mail for 30s before switching to the next one. Anything less than 10s won’t reflect in the dashboard, only in the pop-up view, due to hass limitations with refreshing the main camera cards.

It would be completely fine to take the nomail image and toss it in the camera component folder so it can be pulled locally.

Which files do I need to pull from your repo??? Is it just the usps.py file in the sensors folder?

And do I need to add @aneisch’s changes as well?

(Sorry for the noob questions :wink: )

You need the following files:

components\usps.py
components\sensor\usps.py
components\camera\usps.py

The usps.py in the sensor folder should overwrite your existing file. You’ll also need to adjust your configuration.yaml to look like this:

usps:
    username: userhere
    password: password
    name: mailname (optional)
    interval: 10 (optional, sets delay in rotating through the images)

I did it that way on my first test run, but there isn’t necessarily a precedent for packaging in another file like that. I know the demo images are there, but they kinda serve a different purpose.

Since it is the cleaner solution i’ll probably give it a shot and can always switch back during the PR process if someone doesn’t like it.

One step after the other :wink:

Now I have the following error messages - all files are in the right folder and configuration.yaml adjusted!

2017-07-25 22:32:00 ERROR (MainThread) [homeassistant.setup] Error during setup of component usps
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/setup.py", line 190, in _async_setup_component
component.setup, hass, processed_config)
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/usps.py", line 43, in setup
conf = config[DOMAIN]
KeyError: 'usps'
2017-07-25 22:32:00 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of sensor.usps. Setup failed for dependencies: usps
2017-07-25 22:32:00 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform sensor.usps: Could not setup all dependencies.

Thanks for your help!

Ok, lets figure out a few things… What version of HASS are you running and what version of python (looks like 3.4)? Did you have the usps component working before giving my changes a try?

  • I’m on HASS version 0.49.0
  • Python should be version 3.4, yes
  • The sensor (Standard usps component!) was working before and showed 3 packages on the way
  • I just started with your changes - never started with @aneisch’s changes

Am I missing any steps from @aneisch’s first post that I have to do? Or can I just implement your changes

You don’t need to do anything posted by @aneisch, I wrapped all his changes into a finished component. Can you post your yaml configuration? The new lines should go in the main configuration.yaml, not a sensor specific include file.

2 Likes

Does your new component also fix the pickle issue? I have been having to restart Hass a couple times as I am trying to get other components working. After restaring about 3 times I have to delete the usps.pickle file to get the usps component working again.

Unfortunately, no. The pickle issues need to be fixed in the underlying myusps library I believe.

Do I create a components folder under the .homeassistant directory?

I guess it’s too late at night!!

I still had it under the sensor section and not as its own component…

THANKS for the help - I appreciate the help and the awesome work on this component!

@Coolie1101 No need to make a new folder. These files need to go into your existing components folder.

@DanielGalle No problem, glad you got it figured out.

Where is the existing components folder?

EDIT:
For anyone else wondering, the folder is located in the following location.

/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components

Have a look here

I don’t understand what you are referring to, I know where the config directory is.

Are you referring to /packages/deps?

Ok, got it setup but, now getting the following error: