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

Post your automation.

I believe it’s the same from your GitHub, unless it’s been changed.

  alias: Mail Notif - Mail Delieveries
  trigger:
  - platform: state
    entity_id: sensor.mail_usps_mail
  - platform: state
    entity_id: sensor.mail_usps_delivering
  condition:
  - condition: or
    conditions:
    - condition: template
      value_template: '{{ ((as_timestamp(now()) - as_timestamp(states.sensor.mail_usps_mail.last_changed))
        < 15 and sensor.mail_usps_mail > 0) }}'
    - condition: template
      value_template: '{{ ((as_timestamp(now()) - as_timestamp(states.sensor.mail_packages_in_transit.last_changed))
        < 15 and sensor.mail_packages_in_transit > 0) }}'
  action:
  - service: notify.family_ios_devices
    data_template:
      title: '*Today''s Mail and Packages*'
      message: '{{ states(''sensor.mail_deliveries_message'')}}'
  - service: notify.family_ios_devices
    data:
      message: Today's mail
      data:
        attachment:
          content_type: gif
          url: /local/mail_and_packages/mail_today.gif
  initial_state: 'on'
  mode: single
1 Like

Yes it’s been updated, but this should fix you up:

  alias: Mail Notif - Mail Delieveries
  trigger:
  - platform: state
    entity_id: sensor.mail_usps_mail
  - platform: state
    entity_id: sensor.mail_usps_delivering
  condition:
  - condition: or
    conditions:
    - condition: template
      value_template: '{{ ((as_timestamp(now()) - as_timestamp(states.sensor.mail_usps_mail.last_changed))
        < 15 and sensor.mail_usps_mail > 0) }}'
    - condition: template
      value_template: '{{ ((as_timestamp(now()) - as_timestamp(states.sensor.mail_packages_in_transit.last_changed))
        < 15 and sensor.mail_packages_in_transit > 0) }}'
  action:
  - service: notify.family_ios_devices
    data_template:
      title: '*Today''s Mail and Packages*'
      message: '{{ states("sensor.mail_deliveries_message")}}'
  - service: notify.family_ios_devices
    data:
      message: Today's mail
      data:
        attachment:
          content_type: gif
          url: "{{ states('sensor.mail_image_url') }}"
  initial_state: 'on'
  mode: single

That worked, thanks.

1 Like

The integration was recently updated to and official 0.3.1 and the documentation on the WIKI has been updated to reflect the changes that were added from all the pre-releases.

There are breaking changes if you have not been following the beta releases and adapting as they were being built. Check out the WIKI for updated settings information and examples for summary messages, notifications, and automations.

1 Like

I think I am missing something. Trying to get the image to display in the Mail and Packages card by moralmonkey. If I am reading the wiki correctly there is no longer the ability to turn off the random file name. Does that mean you can no longer display the image using the gif location?

I see the image of the card on the wilki has “gif sensor” now and I do have that entity created but my card is still looking for the gif file path and not showing the gif sensor. Anyone have any suggestions.

For those that want to see the tracking numbers by carrier, I use this custom card:

type: ‘custom:entity-attributes-card’
title: Package Tracking
heading_name: Carrier
heading_state: Tracking Number
filter:
include:
- key: sensor.mail_amazon_packages.order
name: Amazon
- key: ‘sensor.mail_usps_delivering.tracking_#’
name: USPS
- key: ‘sensor.mail_ups_delivering.tracking_#’
name: UPS
- key: ‘sensor.mail_fedex_delivering.tracking_#’
name: FedEx

2 Likes

Try the pre-release card v 0.06. It replaces the text field with a sensor selection to go with the new url sensor in the integration.

Discussions have been enabled on Github for the repo.

Thanks @moralmunky!

Thats what I did, HACs shows that I am on 0.06 but for some reason I am getting the text field and not the entity selector. I just tried deleting the file in the www/community folder and reinstalling and still no luck. That’s why I posted asking, I assumed I just needed to bump to the newer card but something is still off.

If the card on the front end isn’t showing it is v 0.06 in the bottom left, I don’t think the front end isn’t refreshing the resources. Caching seems to be a pain.

Can confirm card is showing the correct version. I have cleared cache a few times for good measure but still the same issue

Maybe try going into the card editor, showing the yaml code, and then removing the path from where ever it is entered?

The weirdness continues, I gave up on the url and figured I would try setting up the camera. The card still wont show the image but if I click the empty space on the card where the image should be a box with the gif rolling pops up.

I to am having issues where sometimes the image shows in the card and sometimes it doesn’t. It looks like the code is coping the image to the correct folder as the image is in

/www/mail_and_packages/

folder
I am using yaml code as follows to display the card and image:

-
    type: 'custom:mail-and-packages-card'
    name: Mail Summary
    updated: sensor.mail_updated
    details: true
    image: true
    deliveries_message: sensor.mail_deliveries_message
    packages_delivered: sensor.mail_packages_delivered
    packages_in_transit: sensor.mail_packages_in_transit
    fedex_packages: sensor.mail_fedex_delivering
    ups_packages: sensor.mail_ups_packages
    usps_packages: sensor.mail_usps_packages
    amazon_packages: sensor.mail_amazon_packages
    gif_sensor: sensor.mail_image_url

What is even weirder is sometimes it works on one computer and not on another. Sometimes clearing the cache via F12, right click clear cache and hard reload works other times it does not.

User feedback would be great on this idea guys:

Poll time!

How are you displaying the sensor data mail and packages creates?

  • I use the Mail and Packages custom card
  • I set up my own standard Lovelace cards provided by Home Assistant
  • I use other custom Lovelace cards or a mixture of custom and standard cards

0 voters

Are you using the USPS Mail images?

  • I display the USPS Mail images in the front end
  • I send the USPS Mail images in a Notification
  • I display the USPS Mail image in the front end and send it in a Notification
  • I do not use the USPS Mail image anywhere

0 voters

Are you using the sensor.mail_image_url and/or sensor.mail_image_system_path

  • I am using the sensor.mail_image_url
  • I am using the sensor.mail_image_system_path
  • I am using both

0 voters

Are you using the gif directly or a camera entity for the USPS Mail images?

  • I use the GIF directly to display the USPS Mail image
  • I use a camera entity to display the USPS Mail image

0 voters

1 Like

I like the idea of making it simpler and more automatic so to speak. I have always struggled figuring out the file paths to make this integration work. That is 100% because my computer skills are limited and I have changed HA install types a number of times. That said making it a simple toggle would be awesome. I really enjoy having the images display as well as bring able to send them in a IOS notification. I have been unable to get the image part working since the most recent change.

1 Like

I finally got the mail image working reliably using a markdown card. I was having caching issues with both the image and the camera entity (even since early versions of the integration) on my phone browser. The trick that worked was to put a ? with the timestamp the image changed after mail image url. This apparently forces (or urges) the browser to refresh the image. You do need all your paths setup correctly. You need to use the mail_updated last changed, because (in my limited testing) the URL updates once a day, just the image changes once the mail comes.

type: markdown
content: |-
  <img src="{{ states('sensor.mail_image_url')
        }}?{{as_timestamp(states.sensor.mail_updated.last_changed)}}" >

On the latest update v0.7.2.2, I am getting a HACS error, image
I have tried reinstall a couple of times, restart and still broken.

1 Like