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

New update has broke the integration. Anyone has it working?

Working fine here, whatā€™s the error?

I am trying to set up the Custom Card but since I am in YAML mode I do not have access to the visual editor and recent YAML examples seem sparse. Could someone check my code please? I would just like all the major US carriers tracked and a rotating USPS gif.

Lovelace.yaml

       - type: 'custom:mail-and-packages-card'
         name: Mail Summary
         updated: sensor.mail_updated
         details: true
         image: false
         amazon_packages: sensor.mail_amazon_packages
         camera_entity: camera.mail_amazon_delivery_camera
         gif_sensor: sensor.mail_image_url
         gif: /config/custom_components/mail_and_packages/mail_today.gif
         packages_in_transit: sensor.mail_packages_in_transit
         packages_delivered: sensor.mail_packages_delivered
         deliveries_message: camera.mail_amazon_delivery_camera
         usps_mail: camera.mail_usps_camera
         ups_packages: sensor.mail_ups_packages
         fedex_packages: sensor.mail_fedex_packages
         fedex_delivering: sensor.mail_fedex_delivering
         usps_mail: sensor.mail_usps_mail
         uspsMail: sensor.mail_usps_mail
         usps_packages: sensor.mail_usps_packages
         camera: true       
         camera_entity: camera.mail_usps_camera			

Configuration.yaml

camera:
  - platform: local_file
    file_path: /config/custom_components/mail_and_packages/mail_none.gif
    name: mail_usps

Automation.yaml

- alias: "Update USPS Mail Camera Path on Hass Restart"
  trigger:
    - platform: state
      entity_id: sensor.mail_updated
    - platform: homeassistant
      event: start
  action:
    - service: local_file.update_file_path
      data_template:
        entity_id: camera.mail_usps
        file_path: "{{ states('sensor.mail_image_system_path') }}"
1 Like

The link here to the oauth_2 version is broken? Referring to: OAuth_2

Was this Oauth_2 branch deleted? Which branch to use for Oauth with either gmail or outlook.office365.com? Thanksā€¦

Nope, mine is broken too. Itā€™s been broke at least as much as itā€™s worked since Iā€™ve had it, I think Iā€™m just going to scrap it and give up.

Ok so like someone up in the chat suggested, I removed ā€˜Mail Amazon Expceptionā€™, and it started working. Very weird.

Oh really?? I never had any issue actually, it was rock solid until the last major update. Now it is very random. It works one day and wonā€™t the other day.

Still a WIP

Yeah, I donā€™t know. Not sure if it was my installation, or the integration, or what the issue was. But I couldnā€™t articulate my issues well enough to get any assistance here, so I would just deal with it. Usually it would sort itself our after a few hours, maybe a day. This time? Just broken. No matter what I did or tried, broken. I gave up. It was cool, but honestly, it was more of a novelty. Itā€™s not like it was my garage door opener or location tracking or something like that. An easy write-off.

I have the image showing up in a notification using the URL provided by the integration for the gif but I am not sure how to use the mp4 image as that URL is not provided as a diagnostic sensor.

Androids donā€™t support gifs in notifications so I only get a still image but if we had an easy way to use the mp4 like the gif then we could get images of all the mail in the android notifications

Use the sensor.mail_image_url sensor and replace the .gif to .mp4 should do the trick.

1 Like

Iā€™m not sure I can do that with the provided automation example

service: notify.notify_all_apps
data:
  title: Mail and Packages
  message: "{{ states('sensor.mail_deliveries_summary')}}"
  data:
    image: "{{ states('sensor.mail_image_url') }}"
    clickAction: entityId:camera.mail_usps_camera
    channel: Mail
    notification_icon: mdi:mailbox-open
    vibrationPattern: 100, 100, 100, 500
    actions:
      - action: URI
        title: Check Mail
        uri: entityId:camera.mail_usps_camera
      - action: URI
        title: Check Amazon
        uri: entityId:camera.mail_amazon_delivery_camera

Try:

    image: "{{ states('sensor.mail_image_url')|replace(".gif",".mp4") }}"

It works in the Dev tools but doesnt work in the actual automation.


It was the double quotes in the ".gif",".mp4"

image: "{{ states('sensor.mail_image_url')|replace('.gif','.mp4') }}"
1 Like

My log is full of stuff like:

2023-05-16 00:04:01.436 ERROR (SyncWorker_10) [custom_components.mail_and_packages.helpers] Error searching emails: 'ascii' codec can't encode character '\u201c' in position 20: ordinal not in range(128)

2023-05-16 00:04:01.440 ERROR (SyncWorker_10) [custom_components.mail_and_packages.helpers] Error searching emails: 'ascii' codec can't encode character '\u201c' in position 20: ordinal not in range(128)

2023-05-16 00:04:01.441 ERROR (SyncWorker_10) [custom_components.mail_and_packages.helpers] Error searching emails: 'ascii' codec can't encode character '\u201c' in position 20: ordinal not in range(128)

2023-05-16 00:04:01.444 ERROR (SyncWorker_10) [custom_components.mail_and_packages.helpers] Error searching emails: 'ascii' codec can't encode character '\u201c' in position 20: ordinal not in range(128)

2023-05-16 00:04:02.031 ERROR (SyncWorker_10) [custom_components.mail_and_packages.helpers] Error searching emails: 'ascii' codec can't encode characters in position 20-21: ordinal not in range(128)

2023-05-16 00:04:02.034 ERROR (SyncWorker_10) [custom_components.mail_and_packages.helpers] Error searching emails: 'ascii' codec can't encode characters in position 20-21: ordinal not in range(128)

2023-05-16 00:04:02.037 ERROR (SyncWorker_10) [custom_components.mail_and_packages.helpers] Error searching emails: 'ascii' codec can't encode characters in position 20-21: ordinal not in range(128)

2023-05-16 00:04:02.039 ERROR (SyncWorker_10) [custom_components.mail_and_packages.helpers] Error searching emails: 'ascii' codec can't encode characters in position 20-21: ordinal not in range(128)

2023-05-16 00:04:04.789 ERROR (SyncWorker_10) [custom_components.mail_and_packages.helpers] Error searching emails: 'ascii' codec can't encode character '\u201c' in position 7: ordinal not in range(128)

2023-05-16 00:04:04.792 ERROR (SyncWorker_10) [custom_components.mail_and_packages.helpers] Error searching emails: 'ascii' codec can't encode characters in position 20-21: ordinal not in range(128)

2023-05-16 00:04:04.794 ERROR (SyncWorker_10) [custom_components.mail_and_packages.helpers] Error searching emails: 'ascii' codec can't encode character '\u201c' in position 7: ordinal not in range(128)

2023-05-16 00:04:04.795 ERROR (SyncWorker_10) [custom_components.mail_and_packages.helpers] Error searching emails: 'ascii' codec can't encode characters in position 37-38: ordinal not in range(128)

I had something similar a long time ago and I believe it was weird subjects in the mails, because I deleted all messages and these log entries were gone.
But I did the same now, emptied my whole inbox but these messages still show up.

Iā€™m using 0.3.14 from HACS.

post the full traceback from the log.

After this update fix: gif to mp4 conversion by firstof9 Ā· Pull Request #820 Ā· moralmunky/Home-Assistant-Mail-And-Packages Ā· GitHub I am no longer receiving mp4s in notifications. If I open the file itā€™s just a black video.

Please open an issue on github for tracking.

If you need testers for the Microsoft365/Oauth features, Iā€™d be happy to help.