Mail and Packages: Custom component for UPS, FEDEX, and USPS

I uninstalled, reinstalled and tried to debug. If I only do the USPS mail sensors, those work fine. Once I add an Amazon or a UPS package sensor from the integration options, everything goes ‘unavailable’. Even if I then remove the package sensor from the integration options, it still has everything ‘unavailable’. Could it be this issue #205? I don’t know where to edit core.config_entities.

Error log (DEBUG):
2021-02-27 11:19:28 DEBUG (MainThread) [custom_components.mail_and_packages] Attempting to unload sensors from the mail_and_packages integration

2021-02-27 11:19:28 ERROR (MainThread) [homeassistant.helpers.condition] Error during template condition: UndefinedError: ‘None’ has no attribute 'last_changed’

2021-02-27 11:19:28 ERROR (MainThread) [homeassistant.helpers.condition] Error during template condition: UndefinedError: ‘None’ has no attribute 'last_changed’

2021-02-27 11:19:28 DEBUG (MainThread) [custom_components.mail_and_packages] Successfully removed sensors from the mail_and_packages integration

2021-02-27 11:19:28 INFO (MainThread) [custom_components.mail_and_packages] Version 0.3.1 is starting, if you have any issues please report them here: http://github.com/moralmunky/Home-Assistant-Mail-And-Packages

2021-02-27 11:19:29 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Created: 27-Feb-2021, Today: 27-Feb-2021

2021-02-27 11:19:29 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Image name: 1ddda679-6975-4bd8-a69d-bc7bdc3ae353.gif

2021-02-27 11:19:29 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Image path: images/mail_and_packages/

2021-02-27 11:19:29 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Sensor: mail_updated Count: Feb-27-2021 11:19 AM

2021-02-27 11:19:29 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Attempting to find mail from ([‘[email protected]’]) with subject (Item Delivered)

2021-02-27 11:19:29 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] DEBUG imap_search: (FROM “[email protected]” SUBJECT “Item Delivered” SINCE “27-Feb-2021”)

2021-02-27 11:19:30 DEBUG (MainThread) [custom_components.mail_and_packages] Finished fetching Mail and Packages (mail.twc.com) data in 2.109 seconds

2021-02-27 11:19:30 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Search for ([‘[email protected]’]) with subject (Item Delivered) results: b’’ count: 0

2021-02-27 11:19:30 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Sensor: usps_delivered Count: 0

2021-02-27 11:19:30 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Attempting to find mail from ([‘[email protected]’]) with subject (Expected Delivery on)

2021-02-27 11:19:30 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] DEBUG imap_search: (FROM “[email protected]” SUBJECT “Expected Delivery on” SINCE “27-Feb-2021”)

2021-02-27 11:19:32 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Searching for (Your item is out for delivery) in (0) emails

2021-02-27 11:19:32 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Search for (Your item is out for delivery) count results: 0

2021-02-27 11:19:32 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Search for ([‘[email protected]’]) with subject (Expected Delivery on) results: b’’ count: 0

2021-02-27 11:19:32 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Sensor: usps_delivering Count: 0

2021-02-27 11:19:32 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Attempting to find Informed Delivery mail

2021-02-27 11:19:32 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Informed delivery search date: 27-Feb-2021

2021-02-27 11:19:32 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] DEBUG imap_search: (OR FROM “[email protected]” FROM “[email protected]” SUBJECT “Your Daily Digest” SINCE “27-Feb-2021”)

2021-02-27 11:19:34 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Cleaning up image directory: /config/images/mail_and_packages/

2021-02-27 11:19:34 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Checking for overlay files in: /config/images/mail_and_packages/

2021-02-27 11:19:34 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Informed Delivery email found processing…

2021-02-27 11:19:34 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Extracting image from email

2021-02-27 11:19:34 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Extracting image from email

2021-02-27 11:19:34 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Removing duplicate images.

2021-02-27 11:19:34 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Placeholder image found using: image-no-mailpieces700.jpg.

2021-02-27 11:19:34 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Removing USPS announcement images.

2021-02-27 11:19:34 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Image Count: 3

2021-02-27 11:19:34 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Resizing images to 724x320…

2021-02-27 11:19:34 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Creating array of image files…

2021-02-27 11:19:34 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Generating animated GIF

2021-02-27 11:19:34 INFO (SyncWorker_13) [custom_components.mail_and_packages.helpers] Mail image generated.

2021-02-27 11:19:34 DEBUG (SyncWorker_13) [custom_components.mail_and_packages.helpers] Sensor: usps_mail Count: 3

No that’s been addressed and fixed, the list gets sorted when the integration is loaded now.

I’d need to see what the log looks like when you enable a sensor that causes it to stop working.

EDIT: Feel free to open an issue on Github for this.

Thank you for helping!

1 Like

I’m using version 0.3.1.

The last two days I have not had any mail. Delivery sensor for mail says no packages delivered but my gif is showing the mail being delivered from two days ago.

I have not received the “no mail” gif since updating to this version.

Using version 0.3.1 and i do not have the accumulative sensors ‘sensor.mail_packages_delivered’ and sensor.mail_packages_in_transit’. A restart and reinstall did not help.

Thanks in advance

They’re at the bottom of the list of sensors:

Try going into the Options and submit the configuration again.

I can’t submit because it gives an error, “user input malformed”

Input "" into the Amazon Forwards section.

1 Like

I was able to complete setup but still can’t get a new image. My gif file in my mail_and_packages folder is from 2-24.

I do not have mp4 selected, did you remove the gif option?

No the gif still gets generated.

Do you see an image in either images/mail_and_packes or www/mail_and_packages?

Yes I see the image from 2-24.

There is a new option in step 2, Allow external image use, that needs to be checked if you want the image to be saved /path/to/conig/www/mail_and_packages/.

1 Like

Well that changed the files and photos but my push notification photo shows a 404 error again.

In my folder, gif reflects the correct mail photos.

Are you using the Home Assistant Companion app for the push notification?

Yes I am. I’ve also reset the notifications in the app with no change

And you’ve checked the Allow external image use in the options right?

Yes when I checked that, I started getting the 404 message. When it was unchecked, I was getting an old gif from 2-24

Double check your automation/script to make sure the correct path is being sent or you can use the new sensor.mail_image_url

This is what my automation is showing /local/mail_and_packages/mail_today.gif.

I’m not sure how it would pull the old image out of that folder but not the new one just by selecting “allow external images”. It’s also weird that my Lovelace Card/camera entity shows the same correct gif. I posted about this 404 issue back in Jan 27 (#1243) but never found a solution.

What would the new sensor.mail_image_url replace in my automation?