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

That’s not a valid forwarding address.
Amazon isn’t forwarding you emails, you can enter "" or leave it blank (that was fixed last I checked).

Thanks. Looks like a valid format but I didn’t enter it or don’t think so, so was confused.

Hi! Love this integration! I am having some issues with the USPS camera image. It works and updates when I load it via the web, but Fully Kiosk doesn’t seem to update when there is a new image. To solve that, I have an automation that restarts fully when the USPS mail images come in for the day.

Later throughout the day it seems to go back to the No Mail image.

Any thoughts?

This issue would be a Home Assistant frontend caching issue.

I’ve noticed lately and figured when one of the family complained to bring it up here. When on the iPhone the usual rotating picture of the USPS mail now just says “Preview of the Mail USPS camera camera”. All the sensors are now Unavailable. Earlier today when i got the mail alert for the day, they were fine and showed the picture. I have done no updating. On the PC I have the below:

Check your logs for errors.

Some more info. I’ve noticed it updates in the morning from the USPS email and shows things. Then later it blanks the rotating image and all the sensors go unavailable. Then later in the day I get another alert of the mail again, and it populates again.

Here’s what I see in the logs:

2021-05-12 13:06:09 ERROR (MainThread) [custom_components.mail_and_packages] Error fetching Mail and Packages (imap.comcast.net) data: 'int' object has no attribute 'decode'
2021-05-12 13:06:09 WARNING (MainThread) [homeassistant.components.automation] Error evaluating condition in 'Mail Notif - Mail Delieveries':
In 'condition':
  In 'or' (item 1 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 2 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 3 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 4 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 5 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
2021-05-12 13:06:09 WARNING (MainThread) [homeassistant.components.automation] Error evaluating condition in 'Mail Notif - Mail Delieveries':
In 'condition':
  In 'or' (item 1 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 2 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 3 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 4 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 5 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
2021-05-12 13:06:09 WARNING (MainThread) [homeassistant.components.automation] Error evaluating condition in 'Mail Notif - Mail Delieveries':
In 'condition':
  In 'or' (item 1 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 2 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 3 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 4 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 5 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
2021-05-12 13:06:09 WARNING (MainThread) [homeassistant.components.automation] Error evaluating condition in 'Mail Notif - Mail Delieveries':
In 'condition':
  In 'or' (item 1 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 2 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 3 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 4 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 5 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
2021-05-12 13:06:09 WARNING (MainThread) [homeassistant.components.automation] Error evaluating condition in 'Mail Notif - Mail Delieveries':
In 'condition':
  In 'or' (item 1 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 2 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 3 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 4 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
  In 'or' (item 5 of 5):
    In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
2021-05-12 13:06:33 WARNING (MainThread) [custom_components.mail_and_packages.camera] Could not read camera Mail USPS Camera image from file: /config/custom_components/mail_and_packages/images/c5e5e73c-a257-4e10-ad0c-6e01bb233c11.gif
2021-05-12 13:07:03 WARNING (MainThread) [custom_components.mail_and_packages.camera] Could not read camera Mail USPS Camera image from file: /config/custom_components/mail_and_packages/images/c5e5e73c-a257-4e10-ad0c-6e01bb233c11.gif
2021-05-12 13:07:33 WARNING (MainThread) [custom_components.mail_and_packages.camera] Could not read camera Mail USPS Camera image from file: /config/custom_components/mail_and_packages/images/c5e5e73c-a257-4e10-ad0c-6e01bb233c11.gif
2021-05-12 13:08:03 WARNING (MainThread) [custom_components.mail_and_packages.camera] Could not read camera Mail USPS Camera image from file: /config/custom_components/mail_and_packages/images/c5e5e73c-a257-4e10-ad0c-6e01bb233c11.gif
2021-05-12 13:08:33 WARNING (MainThread) [custom_components.mail_and_packages.camera] Could not read camera Mail USPS Camera image from file: /config/custom_components/mail_and_packages/images/c5e5e73c-a257-4e10-ad0c-6e01bb233c11.gif
2021-05-12 13:09:03 WARNING (MainThread) [custom_components.mail_and_packages.camera] Could not read camera Mail USPS Camera image from file: /config/custom_components/mail_and_packages/images/c5e5e73c-a257-4e10-ad0c-6e01bb233c11.gif
2021-05-12 13:09:33 WARNING (MainThread) [custom_components.mail_and_packages.camera] Could not read camera Mail USPS Camera image from file: /config/custom_components/mail_and_packages/images/c5e5e73c-a257-4e10-ad0c-6e01bb233c11.gif
2021-05-12 13:10:03 WARNING (MainThread) [custom_components.mail_and_packages.camera] Could not read camera Mail USPS Camera image from file: /config/custom_components/mail_and_packages/images/c5e5e73c-a257-4e10-ad0c-6e01bb233c11.gif
2021-05-12 13:10:33 WARNING (MainThread) [custom_components.mail_and_packages.camera] Could not read camera Mail USPS Camera image from file: /config/custom_components/mail_and_packages/images/c5e5e73c-a257-4e10-ad0c-6e01bb233c11.gif

Sounds like it’s timing out while checking your mail, up the timeout to 60 seconds.

Thanks. I can try that but still can’t get past the “Invalid forwarding email address.” message but not sure what “forwarded” refers to with Amazon, but do have emails when orders come thru from [email protected]

Enter ""

The amazon forwarding is if your spouse or other people in the house have amazon emails forwarded to a household emailbox that you have the integration checking.

Maybe the wrong place for this but noticed that ring (I do not use ring) has a mailbox sensor. Is there anything similar that can be used when my brick mounted mailbox lid is opened to trigger a notice? Preferably something that uses Z-Wave if it would pick up outside my door. The Z-Wave dongle isn’t that far away.

You’d need an outdoor rated contact sensor.

I know this isn’t really a “Mail and Packages” issue, but I’m hoping someone ran into this already… Does anyone happen to be using the iOS Beta Companion App 2021.5? I know there were some changes to notifications, but it seems that the .gif image no longer cycles and it just stuck on the first piece of mail. I used to be able to press and hold on the notification to open it and it would show the animated gif I wasn’t sure if this was a change in iOS or a change in the notification settings. Also I was going to try to use the MP4 image but it seems there is no sensor for that path, or did I miss something?

1 Like

I have been using this component for a while and I enjoy it very much. Thank you for developing this great tool. After everything working fine for a long time, now I have this issue and I cannot resolve it.

Everything works fine (card, automations, notifications, etc.) for USPS mail. But I cannot make it work for USPS packages. Any ideas on how to resolve this issue would be greatly appreciated.

This is a screen shot of an example of the email I receive. It goes to the correct folder as the other emails I get from USPS

The card shows correctly the number of pieces of regular mail but it doesn’t include any packages. I also get the video/capture of each piece of mail correctly.

image

This is the yaml for the card

type: vertical-stack
cards:
  - type: picture-entity
    entity: camera.mail_usps
    aspect_ratio: 50%
    name: Mail
    camera_view: live
    show_name: false
    show_state: false
  - type: entity-filter
    state_filter:
      - operator: '>'
        value: '0'
    entities:
      - entity: sensor.mail_usps_mail
        name: USPS Mail
      - entity: sensor.mail_usps_packages
        name: USPS Packages
      - entity: sensor.fedex_packages
        name: FedEx Packages
      - entity: sensor.mail_packages_in_transit
      - entity: sensor.mail_packages_delivered
      - entity: sensor.mail_updated

This is the info I get for the mail_usps_packages sensor:

You’ll need to enable debugging to see what’s going on.

I already had debugging on. I don’t see any errors/warnings:

The only ‘problem’ I see is that the subject of the email I get is:

USPS® Expected Delivery on 

And the code is looking for:

2021-06-09 11:34:40 DEBUG (SyncWorker_0) [custom_components.mail_and_packages.helpers] Search for (['[email protected]']) with subject (Expected Delivery on) results: b'' count: 0

No USPS® on the subject

Complete logs:

2021-06-10 10:10:21 DEBUG (MainThread) [custom_components.mail_and_packages.camera] Camera Update: usps_camera
2021-06-10 10:10:21 DEBUG (MainThread) [custom_components.mail_and_packages.camera] Camera Update: amazon_camera
2021-06-10 10:10:51 DEBUG (MainThread) [custom_components.mail_and_packages.camera] Camera Update: usps_camera
2021-06-10 10:10:51 DEBUG (MainThread) [custom_components.mail_and_packages.camera] Camera Update: amazon_camera
2021-06-10 10:11:21 DEBUG (MainThread) [custom_components.mail_and_packages.camera] Camera Update: usps_camera
2021-06-10 10:11:21 DEBUG (MainThread) [custom_components.mail_and_packages.camera] Camera Update: amazon_camera
2021-06-10 10:11:51 DEBUG (MainThread) [custom_components.mail_and_packages.camera] Camera Update: usps_camera
2021-06-10 10:11:51 DEBUG (MainThread) [custom_components.mail_and_packages.camera] Camera Update: amazon_camera
2021-06-10 10:12:21 DEBUG (MainThread) [custom_components.mail_and_packages.camera] Camera Update: usps_camera
2021-06-10 10:12:21 DEBUG (MainThread) [custom_components.mail_and_packages.camera] Camera Update: amazon_camera
2021-06-10 10:12:51 DEBUG (MainThread) [custom_components.mail_and_packages.camera] Camera Update: usps_camera
2021-06-10 10:12:51 DEBUG (MainThread) [custom_components.mail_and_packages.camera] Camera Update: amazon_camera
2021-06-10 10:13:21 DEBUG (MainThread) [custom_components.mail_and_packages.camera] Camera Update: usps_camera
2021-06-10 10:13:21 DEBUG (MainThread) [custom_components.mail_and_packages.camera] Camera Update: amazon_camera
2021-06-10 10:13:51 DEBUG (MainThread) [custom_components.mail_and_packages.camera] Camera Update: usps_camera
2021-06-10 10:13:51 DEBUG (MainThread) [custom_components.mail_and_packages.camera] Camera Update: amazon_camera
2021-06-10 10:14:16 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] Created: 10-Jun-2021, Today: 10-Jun-2021
2021-06-10 10:14:16 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] Image name: c2bdd05b-01fb-4336-a702-8a573ca1658a.gif
2021-06-10 10:14:16 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] Created: 10-Jun-2021, Today: 10-Jun-2021
2021-06-10 10:14:16 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] Amazon Image Name: 02d0bf5b-7525-4a38-98f5-0da292597cbf.jpg
2021-06-10 10:14:16 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] Image path: custom_components/mail_and_packages/images/
2021-06-10 10:14:16 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] Sensor: mail_updated Count: Jun-10-2021 10:14 AM
2021-06-10 10:14:16 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] Attempting to find mail from (['[email protected]']) with subject (Item Delivered)
2021-06-10 10:14:16 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] DEBUG imap_search: (FROM "[email protected]" SUBJECT "Item Delivered" SINCE "10-Jun-2021")
2021-06-10 10:14:16 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] Search for (['[email protected]']) with subject (Item Delivered) results: b'' count: 0
2021-06-10 10:14:16 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] Sensor: usps_delivered Count: 0
2021-06-10 10:14:16 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] Attempting to find mail from (['[email protected]']) with subject (Expected Delivery on)
2021-06-10 10:14:16 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] DEBUG imap_search: (FROM "[email protected]" SUBJECT "Expected Delivery on" SINCE "10-Jun-2021")
2021-06-10 10:14:16 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] Searching for (Your item is out for delivery) in (0) emails
2021-06-10 10:14:16 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] Search for (Your item is out for delivery) count results: 0
2021-06-10 10:14:16 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] Search for (['[email protected]']) with subject (Expected Delivery on) results: b'' count: 0
2021-06-10 10:14:16 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] Sensor: usps_delivering Count: 0
2021-06-10 10:14:16 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] Attempting to find mail from (['[email protected]']) with subject (Delivery Exception)
2021-06-10 10:14:16 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] DEBUG imap_search: (FROM "[email protected]" SUBJECT "Delivery Exception" SINCE "10-Jun-2021")
2021-06-10 10:14:17 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] Search for (['[email protected]']) with subject (Delivery Exception) results: b'' count: 0
2021-06-10 10:14:17 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] Sensor: usps_exception Count: 0
2021-06-10 10:14:17 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] Attempting to find Informed Delivery mail
2021-06-10 10:14:17 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] Informed delivery search date: 10-Jun-2021
2021-06-10 10:14:17 DEBUG (SyncWorker_49) [custom_components.mail_and_packages.helpers] DEBUG imap_search: (OR FROM "[email protected]" FROM "[email protected]" SUBJECT "Your Daily Digest"

I fixed this problem. Gmail for some reason was applying the label ‘UPDATE’ to the emails with the ‘Expected Delivery on…’ subject. I removed the label and they it worked. Hopefully this will help some else too.

Thanks,

1 Like

Ah yes, in Gmail labels = IMAP folders, so that could cause an issue.
Alternatively you could try the ‘[Gmail]/ All Mail’ folder that should work as well.

1 Like

Been awhile. Finally had time to evolve the custom card design. Pre-release v0.8.0.0 available through HACS.

I add the card twice to my dashboard because I prefer to have Amazon separate since it is not part of the overall totals. There is a gap that needs to be resolved when the card is only showing Amazon items.

4 Likes

I updated to the new pre-release v0.8 and it is working fine on my PC & phone. Not working on my laptop, Chromebook and tablet. All use the latest Chrome and I have clear cache and cookies on the non working devices. I also tried an incognito window and no difference. The symptom is the red custom element does not exist. What information can I capture to help figure out the issue?