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

Could change the output to an animated PNG file, might work better.

Happy to test. Just FYI this is what the image looks like when I open on TG mobile.

Itā€™s really not the biggest deal but I liked it for convenience. Oh, and I donā€™t think the hass app supports gifs yet, just tried and no luck.

Ok so I triedā€¦

How do I get the image? I tired adding a path to the mail_today.gif and I couldnā€™t find where to put the camera.mail_usps.

Thanks

Get the image where? Lovelace? Notification?

With the UPS Update: Follow Your Delivery on a Live Map email did it still come from [email protected] email address?

It did yes.

Iā€™ll add this to the next version I have cooking :smiley:

Lovelace image. Just shows this

Did you add this bit of code to your configuration.yaml under the camera: section? And verify that the path is accurate?

I just saw the documentation was updated. Iā€™m getting a config error now that Iā€™m working through after putting the sensors: template in

FINALLY!!!

Holy crap that was an adventure. Thanks for all the help!

Iā€™m getting a weird error regarding the image in the Home Assistant logs:
2020-02-14 15:40:12 ERROR (MainThread) [homeassistant.components.hangouts.hangouts_bot] Failed to fetch image, <class 'aiohttp.client_exceptions.ClientConnectorError'>

Going to see if itā€™s a permissions thing.

EDIT: Not a permissions thing, but the notification via the mobile app works perfectly fine.

With the gif? Hmmā€¦must not have mine right.

Hereā€™s my log erroring out in TG:

2020-02-14 08:09:40 ERROR (SyncWorker_1) [homeassistant.components.telegram_bot] Error sending message: Timed out. Args: (XXXXXXXXXX, "*Today's Mail and Packages*\n3 pieces of mail will be delivered. No packages are in transit."), kwargs: {'parse_mode': 'Markdown', 'disable_notification': False, 'disable_web_page_preview': None, 'reply_to_message_id': None, 'reply_markup': None, 'timeout': None}
2020-02-14 08:09:40 ERROR (SyncWorker_8) [homeassistant.components.telegram_bot] Error sending file: Timed out. Args: (XXXXXXXX, <_io.BufferedReader name='/config/www/mail_and_packages/mail_today.gif'>), kwargs: {'caption': None, 'parse_mode': 'Markdown', 'disable_notification': False, 'disable_web_page_preview': None, 'reply_to_message_id': None, 'reply_markup': None, 'timeout': None}

Also had this later when I tried manually:

2020-02-14 10:26:57 WARNING (updater) [telegram.vendor.ptb_urllib3.urllib3.connectionpool] Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<telegram.vendor.ptb_urllib3.urllib3.connection.VerifiedHTTPSConnection object at 0x7f47d71c3a10>, 'Connection to api.telegram.org timed out. (connect timeout=5.0)')': /botXXXXXXXXXXXXXXX/getUpdates
2020-02-14 10:27:02 WARNING (updater) [telegram.vendor.ptb_urllib3.urllib3.connectionpool] Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<telegram.vendor.ptb_urllib3.urllib3.connection.VerifiedHTTPSConnection object at 0x7f47d5430950>, 'Connection to api.telegram.org timed out. (connect timeout=5.0)')': /botXXXXXXXXXXXXXXXXXXXXX/getUpdates

Via the Home Assistant companion app notifications with the image work fine, Iā€™m not sure whatā€™s going on as the image seems fine when I hit it from external sources.

Taking a look through the Imageio docs I see that gifsicle also has a python port. This can dramatically reduce the size of animated gifs.

I use it to reduce the size of the animated weather maps I pull in from the National Weather Service in a shell script. Iā€™m going to look into this so I donā€™t have to load the binary for my weather card.

1 Like

I have image scaling to 700x315 on my branch for testing if anyone wants to give it a go for testing as well. @moralmunky :smiley:

Iā€™ve installed the efficiency branch. No mail today. Commenting out the image deleting so I can check out the images.

1 Like

Once the efficiency branch is merged Iā€™ll create a development branch.

1 Like

Version 0.1.1 up on github and HACS

Changes:

  • Only login to email once and pull all the emails needed in one swoop
  • Changed GIF rotation time to 5 seconds
  • Subtract delivered packages from ā€˜in transitā€™ packages, should no longer result in negative counts
  • No more slow start warnings since we check the email in one call now
  • Added aspect ratio calculations to keep image looking correctly
  • Added additional subject searches for FedEx emails
  • Bump version to 0.1.0 since weā€™re no longer using Imagemagick and fixed the speed issues

If you find bugs fire up an issue on github.

First thanks for all the work everyone has done on this it is an awesome component that I am really excited to get working. Unfortunately I am having some trouble.

Before I updated to 0.1.1 I go to the point that it created all the sensors but I couldnā€™t get it to detect the emails. Now that I have updated the sensors are gone and I am getting an error in the logs saying ā€œunable to install package scipyā€ and it is suggesting that I upgrade the pip. Truth is I am not at all savy when it comes to command line so I am hoping someone could point me in the right direction.

I am running the homeassistant docker in Unraid if it matters.