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

Likely you updated to 0.2.1-3 (stable branch), reinstall the 0.2.2-b36 (beta branch).

Yeah that was a bit of a head scratcher when I saw it. Removed all the standard ones and renamed the _2 ones and went back to the beta and now apparently have to do it all over again as they are all back again.

I plan to merge the 0.2.2 code as ‘stable’ soon since it’s looking very stable and the features are in.

Thanks all good again. :slight_smile:

1 Like

Can anyone highlight their settings (pics are great!) of this installed with HACS in a docker instance? The component does detect incoming mail (despite this image not having any to show), and I do see images in my daily USPS Informed Delivery. This is my card that’s not working:

The integration component and lovelace card are set to use

/local/mail_and_packages/

The path is correct, /local/mail_and_packages/
The integration should be using /config/www/mail_and_packages/

Got it - tried that, restarted Home Assistant, and Ctrl+F5’d my browser. Something is still off.

2020-11-24 13:33:14 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Attempting to find Informed Delivery mail
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Cleaning up image directory: /config/www/mail_and_packages/
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Informed Delivery email found processing...
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Extracting image from email
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Extracting image from email
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Extracting image from email
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Removing duplicate images.
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Removing USPS announcement images.
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Image Count: 3
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Resizing images to 724x320...
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Creating array of image files...
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Generating animated GIF
2020-11-24 13:33:15 INFO (SyncWorker_56) [custom_components.mail_and_packages.sensor] Mail image generated.
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Attempting to find mail from [email protected] with subject 1 Item Delivered
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Search for [email protected] with subject 1 Item Delivered results: b''
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Attempting to find mail from [email protected] with subject 1 Expected Delivery on
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Searching for out for delivery in emails
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Search for [email protected] with subject 1 Expected Delivery on results: b''
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Attempting to find mail from [email protected] with subject 1 Your UPS Package was delivered
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Search for [email protected] with subject 1 Your UPS Package was delivered results: b''
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Attempting to find mail from [email protected] with subject 1 UPS Update: Package Scheduled for Delivery Today
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Search for [email protected] with subject 1 UPS Update: Package Scheduled for Delivery Today results: b''
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Attempting to find mail from [email protected] with subject 2 UPS Update: Follow Your Delivery on a Live Map
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Search for [email protected] with subject 2 UPS Update: Follow Your Delivery on a Live Map results: b''
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Attempting to find mail from [email protected] with subject 1 Your package has been delivered
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Search for [email protected] with subject 1 Your package has been delivered results: b''
2020-11-24 13:33:15 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Attempting to find mail from [email protected] with subject 1 Delivery scheduled for today
2020-11-24 13:33:16 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Search for [email protected] with subject 1 Delivery scheduled for today results: b''
2020-11-24 13:33:16 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Attempting to find mail from [email protected] with subject 2 Your package is scheduled for delivery today
2020-11-24 13:33:16 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Search for [email protected] with subject 2 Your package is scheduled for delivery today results: b''
2020-11-24 13:33:16 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Attempting to find Amazon email with item list ...
2020-11-24 13:33:16 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Amazon emails found: 6
2020-11-24 13:33:16 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Error while attempting to parse Amazon email: 'utf-8' codec can't decode byte 0xdb in position 406: invalid continuation byte
2020-11-24 13:33:16 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Error while attempting to parse Amazon email: 'utf-8' codec can't decode byte 0xd4 in position 407: invalid continuation byte
2020-11-24 13:33:16 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Amazon emails found: 0
2020-11-24 13:33:16 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Amazon emails found: 0
2020-11-24 13:33:16 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Amazon emails found: 0
2020-11-24 13:33:16 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Amazon Count: 1
2020-11-24 13:33:16 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Attempting to find Amazon email with item list ...
2020-11-24 13:33:17 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Amazon emails found: 6
2020-11-24 13:33:17 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Error while attempting to parse Amazon email: 'utf-8' codec can't decode byte 0xdb in position 406: invalid continuation byte
2020-11-24 13:33:17 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Error while attempting to parse Amazon email: 'utf-8' codec can't decode byte 0xd4 in position 407: invalid continuation byte
2020-11-24 13:33:17 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Amazon emails found: 0
2020-11-24 13:33:17 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Amazon emails found: 0
2020-11-24 13:33:17 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Amazon emails found: 0
2020-11-24 13:33:17 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Amazon order: ['#112-3299407-6593015', '#112-5402787-6481816', '#112-4622478-3762642', '#112-6495239-1773007', '#112-8246189-5098626']
2020-11-24 13:33:17 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Attempting to find mail from [email protected] with subject 1 Delivery Notification
2020-11-24 13:33:17 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Search for [email protected] with subject 1 Delivery Notification results: b''
2020-11-24 13:33:17 DEBUG (SyncWorker_56) [custom_components.mail_and_packages.sensor] Updated scan time: Nov-24-2020 01:33 PM

Please do not post images of logs, post the actual text.

Also I think you have to setup a camera entity for the card to work, I’m not 100% sure.

See this section on the wiki, for how to setup a file camera.

I use HACS with a Docker install. I use the integration but I don’t use the mail card. I like my setup, which I copied from someone else. I was never able to get the mail card to work to pull up the picture; so I made a camera entry to pull the mail picture into HA.


I don’t have any mail today so hence the no mail; but when there is mail it does update with the pictures.

type: vertical-stack
cards:
  - type: horizontal-stack
    cards:
      - entities:
          - entity: sensor.mail_usps_mail
            name: USPS Mail
          - entity: sensor.mail_packages_in_transit
            name: Packages in Transit
          - entity: sensor.mail_packages_delivered
            name: Packages Delivered
          - entity: sensor.mail_updated
        show_header_toggle: false
        type: entities
  - type: glance
    entities:
      - entity: sensor.mail_ups_packages
        image: /local/icons/ups.png
      - entity: sensor.mail_fedex_packages
        image: /local/icons/fedex.jpeg
      - entity: sensor.mail_usps_packages
        image: /local/icons/usps.png
      - entity: sensor.mail_amazon_packages
        image: /local/icons/amazon-wh.png
    show_name: false
  - type: picture-entity
    entity: sensor.mail_usps_mail
    camera_image: camera.mail_usps
    show_name: false
    show_state: false

I can not pull exactly what I am using for a camera sensor at this time since I am not at home currently but this is the important info for the camera:

file_path: /config/www/mail_and_packages/mail_today.gif
friendly_name: mail_usps
3 Likes

I have a separate card for a summary of everything that I use on my ‘overview’ page. This card will only display if there is any mail or packages and will only show info that is not zero.
mail2

type: 'custom:auto-entities'
sort:
  method: state
  numeric: false
card:
  type: entities
  show_header_toggle: false
  title: ''
  state_color: true
show_empty: false
unique: entity
filter:
  include:
    - entity_id: '*mail*'
    - entity_id: '*packag*'
  exclude:
    - state: '*0*'
    - entity_id: '*mail_usps'

You’re missing an icon :stuck_out_tongue:
image

hum…
I have never received a DHL package at my house; but I might some day. Is DHL notification based on delivery address and sent via email?

I do get packages from other services that do not have any notification service based on delivery address (such as OnTrac); if I got tracking numbers I could get tracking but alas I do not receive any tracking numbers until the package is at my door.

I haven’t looked into OnTrac they don’t deliver in my area frequently. On super rare occasions I’ll get a DHL delivery, but that’s extremely rare.

It is.

OnTrac is primarily for medical supplies; and of course, this is where the majority of my packages come from.

So, if anyone has figured out how to get OnTrac information, I am all ears.

Thank you! Got this working - if you don’t mind me asking, in your docker instance, where does /local refer to?

In other words, I’m trying to emulate a place to store .png’s of these carriers like in your card stack, but not sure where to put them!

/local/ get’s translated from /config/www/

1 Like

Thanks - what an amazing integration/card. Thanks for all your help!

Camera entity isn’t needed for the custom card, but I see you had random image enabled. When that is enabled the file name is random and not mail_today.gif. Your mail GIF location /local/mail_and_packages/mail_today.gif should be and random image filename should not be checked.

This integration is one of my favorites! I had an odd issue where all of my entity Ids were duplicated (easy fix there), except that now the Amazon Packages delivered is gone entirely. I know Amazon is a bit different than the other entities, is it expected that there is no longer a delivered entity for Amazon or did i do something that may have messed this up? :slight_smile:
Thank you for the integration and any assistance in advance

Sounds like you accidentally downgraded from 0.2.2 beta version to 0.2.1-3 release version.

Shouldn’t be an issue much longer, 0.2.2 is looking release ready.

1 Like