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

Double check your email filters too.

Yeah, Iā€™ve removed all my filters and just have it checking the Inbox now. No filtering was taking place related to this though.

No reply from USPS yetā€¦

Nor here - Iā€™m not holding out much hope. Going to try turning it all off and on again :slightly_smiling_face:

I am sure they are just diligently looking into it and ensuring they resolve it before they reply to us :rofl:

1 Like

Anyone getting the string error message for Amazon forwarding when populating the field? Putting ā€œā€ lets the validation through, but it wonā€™t let me enter any real addresses.

This is on the latest release 0.3.6.

image

Thanks!

Try entering with quote around the emails ie: "[email protected]", "[email protected]"

Thanks for jumping in! Great suggestion, but sadly, still erroring out. Iā€™ve also tried variations of escaping the email addresses such as ā€œ[email protected], [email protected]ā€

For now, the only way I can get the M&P to work is to use ā€œā€

EDIT: OOPS! Pardon my carelessness. Found the bug when checking my own debug log. Itā€™s caused by this line here:

[custom_components.mail_and_packages.helpers] [Hub] Amazon email list: [ā€™ā€œ[email protected]ā€ā€™, ā€™ ā€œ[email protected]ā€ā€™, ā€˜[email protected]ā€™, ā€˜[email protected]ā€™]

Unchecked ā€œamazon hubā€ and it seems to be working. Thanks!

Hereā€™s a snippet of the debug log:

2023-01-18 15:38:35.008 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] Sensor: amazon_exception Count: 0
2023-01-18 15:38:35.008 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] [Hub] Amazon email list: ['"[email protected]"', ' "[email protected]"', '[email protected]', '[email protected]']
2023-01-18 15:38:35.008 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] DEBUG subject: ready for pickup from Amazon Hub Locker
2023-01-18 15:38:35.009 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] DEBUG imap_search: (FROM ""[email protected]"" SUBJECT "ready for pickup from Amazon Hub Locker" SINCE 18-Jan-2023)
2023-01-18 15:38:35.086 ERROR (SyncWorker_1) [custom_components.mail_and_packages.helpers] Error searching emails: SEARCH command error: BAD [b'Could not parse command']
2023-01-18 15:38:35.093 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] DEBUG email_search value: ('BAD', "SEARCH command error: BAD [b'Could not parse command']")
2023-01-18 15:38:35.369 ERROR (MainThread) [custom_components.mail_and_packages] Problem updating sensors: 'count'
2023-01-18 15:38:35.379 ERROR (MainThread) [custom_components.mail_and_packages] Error fetching Mail and Packages (imap.gmail.com) data: 'count'
2023-01-18 15:38:35.380 DEBUG (MainThread) [custom_components.mail_and_packages] Finished fetching Mail and Packages (imap.gmail.com) data in 7.763 seconds (success: False)
2023-01-18 15:38:35.380 ERROR (MainThread) [custom_components.mail_and_packages] Error updating sensor data: 'count'
2023-01-18 15:38:35.385 WARNING (MainThread) [homeassistant.config_entries] Config entry 'imap.gmail.com' for mail_and_packages integration not ready yet: None; Retrying in background
2023-01-18 15:38:42.181 WARNING (MainThread) [homeassistant.setup] Setup of automation is taking over 10 seconds.
2023-01-18 15:38:33.121 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] DEBUG email_search value: ('OK', [b''])
2023-01-18 15:38:33.121 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] Amazon delivered email(s) found: 0
2023-01-18 15:38:33.121 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] Searching for Amazon image in emails...
2023-01-18 15:38:33.121 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] HTML Amazon emails found: 0
2023-01-18 15:38:33.121 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] Amazon email search address: [email protected]
2023-01-18 15:38:33.121 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] DEBUG subject: LivrƩ
2023-01-18 15:38:33.122 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] DEBUG imap_search: SINCE 18-Jan-2023 SUBJECT
2023-01-18 15:38:33.122 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] UTF-8 not supported: Server does not support ENABLE
2023-01-18 15:38:33.122 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] DEBUG email_search value: ('BAD', 'Server does not support ENABLE')
2023-01-18 15:38:33.122 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] Sensor: amazon_delivered Count: 0
2023-01-18 15:38:33.122 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] Amazon email adding "[email protected]" to list
2023-01-18 15:38:33.122 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] Amazon email adding "[email protected]" to list
2023-01-18 15:38:33.122 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] Amazon domains to be checked: ['amazon.com', 'amazon.ca', 'amazon.co.uk', 'amazon.in', 'amazon.de', 'amazon.it', 'amazon.com.au', 'amazon.pl', 'amazon.es', 'amazon.fr', '"[email protected]"', ' "[email protected]"']
2023-01-18 15:38:33.123 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] Amazon email search address: ['[email protected]']
2023-01-18 15:38:33.123 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] DEBUG subject: Delivery update:
2023-01-18 15:38:33.123 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] DEBUG imap_search: (FROM "[email protected]" SUBJECT "Delivery update:" SINCE 18-Jan-2023)
2023-01-18 15:38:33.297 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] DEBUG email_search value: ('OK', [b''])
2023-01-18 15:38:33.297 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] Found 0 Amazon exceptions
2023-01-18 15:38:33.297 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] Searching for tracking numbers in 0 messages...
2023-01-18 15:38:33.298 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] No tracking numbers found
2023-01-18 15:38:33.298 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] Amazon email search address: ['[email protected]']
2023-01-18 15:38:33.298 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] DEBUG subject: Delivery update:
2023-01-18 15:38:33.298 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] DEBUG imap_search: (FROM "[email protected]" SUBJECT "Delivery update:" SINCE 18-Jan-2023)
2023-01-18 15:38:33.428 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] DEBUG email_search value: ('OK', [b''])
2023-01-18 15:38:33.428 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] Found 0 Amazon exceptions
2023-01-18 15:38:33.428 DEBUG (SyncWorker_1) [custom_components.mail_and_packages.helpers] Searching for tracking numbers in 0 messages...

Ok looks like the " are not needed. So [email protected], [email protected] should technically work.

I was also looking for a sensor to use the .mp4 file that is generated but it seems this is not added.

You can link to the images via the camera entity if youā€™re using the Home Assistant companion app.

I recently set this up (using Gmail, have the relevant emails being moved to a folder I setup for this purpose).

All seems to be working, EXCEPT it doesnā€™t seem to be properly picking up the Amazon ā€˜Deliveredā€™ emails. US Mail, UPS and FedEx all seem to be working (happened to have things shipped from everything except USPS packages). All of the relevant emails are in the folder itā€™s checking, but itā€™s only seeming to ā€˜seeā€™ the shipped emails for Amazon. Currently Iā€™m sitting at 8 Amazon packages shipped in HA with none of them delivered, even though all but one has been delivered (and Iā€™ve received the corresponding delivery emails in the folder itā€™s checking). Iā€™ve let it sit for a few days, havenā€™t deleted any of the emails and have restarted the integration (as well as all of HA), checked and reset the options, etc. with no change. Any ideas? Thanks in advance!

Yes enable debugging.

So just tried that and restarted the integration and obviously got a crazy-long set of logs. Parsing through it manually, I donā€™t see any kind of obvious errors/issues but I also noticed 2 things that could maybe be it?

It looks to me like itā€™s only looking for ā€˜deliveredā€™ emails from Amazon for today but pulling ā€˜shippedā€™ emails from the number of days back specified in the setup (I assume, I didnā€™t specifically verify this). This kind of makes sense. Am I correct in thinking that it wonā€™t pickup deliveries unless the integration was running on the day of the delivery? This would explain part of it

The other issue is that several of my Amazon packages were delivered via USPS. Those occurred on days the integration was indeed running, but never seemed to get picked up by either the Amazon or USPS parts of the integration. They DO show up on my daily ā€˜informed deliveryā€™ email, but those are the only emails I got.

Just had a thought while typing this and logged into my USPS account. I enabled all notifications, including specifically package delivery emails. Iā€™m guessing this is the other half to my issue?

Review the wiki, it tells you how it all works.

Thanks for the help!

I read through everything on the main page of the github site when I set things up, but missed the link to that page. I already received emails from all shipping partners, so also just assumed I was good. Hopefully everythingā€™s good to go now.

Ya Amazon is special because they donā€™t always use their own delivery drivers.

How do I get the icons to show with the badge?

Can someone post a config example plz? :pray:t5:

Update: I suddenly started getting the individual package emails in addition to my digest email. Now the integration works as expected.

Thatā€™s the custom card