Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sensors Not updating (Yahoo email) #64

Closed
DeadEnded opened this issue Mar 16, 2020 · 52 comments · Fixed by #86
Closed

Sensors Not updating (Yahoo email) #64

DeadEnded opened this issue Mar 16, 2020 · 52 comments · Fixed by #86
Assignees
Labels
bug Something isn't working feature New feature or request

Comments

@DeadEnded
Copy link

Trying to setup the Mail and Packages custom component via HACS.
So far everything looks good - but for some reason the sensors are not picking up anything (aka everything is 0). I have had this going for over a week, and received multiple packages from USPS and Fedex - and sensors never tick up from 0.

Today I have a package in route via Fedex and see the email for it. I updated to the BETA just to be sure and still not seeing anything.

Here is my setup (thanks to the beta branch):

image

Since I am not using the INBOX, but a custom Mail folder, do I need to put it in differently? The integration says it connects successfully, so I expect that means it can reach the account. Is there something I am missing?

I did check HA logs, and all it says is No mail found. So no errors there.
Here is my mailbox Mail showing the emails coming in:
image

Thanks!
DeadEnd

PS. Saw that Amazon is going to be added - but haven’t found where to turn on email notifications… only Alexa which I don’t use. Look forward to this addition once I get it working!!

@firstof9
Copy link
Collaborator

firstof9 commented Mar 16, 2020

Change the setting, for example if you filtered your emails for USPS etc into a "Mail" folder it would be Inbox/Mail if I recall.

@firstof9
Copy link
Collaborator

Or just use Inbox it should find it in a search anyways.

@DeadEnded
Copy link
Author

Tried changing it (on the beta release) and it keeps jumping back to Mail... looks like I might have to remove and re-add.

Okay, removed integration, restarted, and re-added using Inbox.
So far it hasn't picked anything up... going to give it a few minutes to see it if does... then try 'Inbox/Mail' next.

Should I submit a bug report for the dev branch on the configuration change not saving?

@firstof9
Copy link
Collaborator

Should I submit a bug report for the dev branch on the configuration change not saving?

Yes please create a separate issue report for that. Thanks.

@DeadEnded
Copy link
Author

DeadEnded commented Mar 16, 2020

Okay, tried Inbox/Mail and got the below error... so I don't think that worked...
i also tried Inbox\Mail just to try and be through.

image

I reinstalled the 0.1.2 release and re-added the integration using just Inbox.
back to normal, but still not getting any values other than 0.
I will leave it like this for now, until I can figure out what might be wrong...

@firstof9 firstof9 added the investigating Investigating the issue label Mar 16, 2020
@firstof9
Copy link
Collaborator

I've been working on a 2 step setup process to help with this kind of issue here's some screenshots of the new setup process for the next beta:

image

First you enter your server information, then it is validated.

image

Here you can select the folder now for what folder your emails go into for packages.
Note that it is a drop down list and will show all available folders.

I expect to be dropping this as beta 4 sometime tomorrow.

@firstof9 firstof9 self-assigned this Mar 17, 2020
@firstof9 firstof9 added this to In progress in Development Mar 17, 2020
@firstof9 firstof9 added the feature New feature or request label Mar 17, 2020
@firstof9 firstof9 moved this from In progress to Needs Testing in Development Mar 17, 2020
@firstof9
Copy link
Collaborator

@DeadEnded try the 0.1.3-b4 version, you should be able to select the folder where your mail resides now.

@DeadEnded
Copy link
Author

Okay, updated, restarted, and reconfigured.
The folder option works wonderfully - I was able to see and select my custom "Mail" folder.
I'll watch it for the next few days, but i have emails today for deliveries, and I'm still seeing zero's.
There must be something wrong with my setup...

@firstof9
Copy link
Collaborator

Can you post the email address they are coming from and the subject line?
Redact anything that seems personal like tracking numbers and order numbers.

@DeadEnded
Copy link
Author

there is one screen shot of the mail folder in the original post, here is some more detail:
format:

email address
subject

USPS Email notifications

uspsinformeddelivery@usps.gov
Informed Delivery Daily Digest
auto-reply@usps.com
USPS® Delivery Exception #################
auto-reply@usps.com
USPS® Expected Delivery on Monday, March 16, 2020 Between 12:00pm and 4:00pm

Fedex Email Notifications

trackingupdates@fedex.com
FedEx Shipment ###########: Your package has been delivered
trackingupdates@fedex.com
FedEx Shipment ###########: Your package is scheduled for delivery today
trackingupdates@fedex.com
FedEx Shipment ###########: Your package is on its way

Please let me know if this is the data you are looking for.
Thanks for all the help!
DeadEnd

@firstof9
Copy link
Collaborator

These emails and subjects look fine, we're not tracking the exception emails, but the rest, if email from today should show up. The sensor only looks for email for today and parses them into the sensors.

@DeadEnded
Copy link
Author

Hmm... well I guess I'm going to have to figure out a way to debug it... figure out what is causing it to fail, because the HA logs just so no mail found.

@firstof9
Copy link
Collaborator

"No mail found" is when it's looking for images in the informed delivery messages. Do you have debugging turned on for the component?

I have a post explaining how to do it here:
https://community.home-assistant.io/t/mail-and-packages-custom-component-for-ups-fedex-and-usps/118081/173?u=firstof9

@DeadEnded
Copy link
Author

DeadEnded commented Mar 18, 2020

ok, got debug log:

2020-03-18 09:50:36 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Attempting to find Informed Delivery mail
2020-03-18 09:50:37 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Informed Delivery email found processing...
2020-03-18 09:50:37 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Removing duplicate images.
2020-03-18 09:50:37 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Removing USPS announcement images.
2020-03-18 09:50:37 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Image Count: 0
2020-03-18 09:50:37 INFO (SyncWorker_39) [custom_components.mail_and_packages.sensor] No mail found.
2020-03-18 09:50:37 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Removing /config/www/mail_and_packages/mail_today.gif
2020-03-18 09:50:37 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Copying nomail gif
2020-03-18 09:50:37 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Attempting to find mail from auto-reply@usps.com with subject Item Delivered
2020-03-18 09:50:37 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Attempting to find mail from auto-reply@usps.com with subject Expected Delivery on
2020-03-18 09:50:37 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Attempting to find mail from mcinfo@ups.com with subject Your UPS Package was delivered
2020-03-18 09:50:38 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Attempting to find mail from mcinfo@ups.com with subject UPS Update: Package Scheduled for Delivery Today
2020-03-18 09:50:38 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Attempting to find mail from mcinfo@ups.com with subject UPS Update: Follow Your Delivery on a Live Map
2020-03-18 09:50:38 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Attempting to find mail from TrackingUpdates@fedex.com with subject Your package has been delivered
2020-03-18 09:50:39 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Attempting to find mail from TrackingUpdates@fedex.com with subject Delivery scheduled for today
2020-03-18 09:50:39 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Attempting to find mail from TrackingUpdates@fedex.com with subject Your package is scheduled for delivery today
2020-03-18 09:50:39 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Attempting to find Amazon email with item list ...
2020-03-18 09:50:40 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Amazon emails found: 0
2020-03-18 09:50:40 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Amazon Count: 0
2020-03-18 09:50:40 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Attempting to find Amazon email with item list ...
2020-03-18 09:50:40 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Amazon emails found: 0
2020-03-18 09:50:40 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Amazon json: []
2020-03-18 09:50:40 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Attempting to find Amazon email with item list ...
2020-03-18 09:50:41 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Amazon emails found: 0
2020-03-18 09:50:41 DEBUG (SyncWorker_39) [custom_components.mail_and_packages.sensor] Amazon order: []

So it found the informed delivery, but didn't get the image (there is 1 today) and also didn't update the sensor in HA.
image

@firstof9
Copy link
Collaborator

give it a few for the informed delivery email to come in, then check the log, lets see what it outputs then.

@DeadEnded
Copy link
Author

quick update, I've been watching the sensors a few days since the last change... still nothing. The logs when I get an informed delivery are the same as above. It sees the informed delivery, but nothing is found...

Not sure what is wrong... seems very odd...

@firstof9
Copy link
Collaborator

You have the debugging turned on for it still right?

@DeadEnded
Copy link
Author

yes - looks just like the above screen shot.

@firstof9
Copy link
Collaborator

I add more debug messages to a version and have you give it a go to see what's going on. Likely sometime tomorrow.

@firstof9
Copy link
Collaborator

@DeadEnded Give this version a go with the debug on:
https://raw.githubusercontent.com/firstof9/Home-Assistant-Mail-And-Packages/lots-of-debug/custom_components/mail_and_packages/sensor.py

Lots more debugging added should give us better insight into what's happening.

@DeadEnded
Copy link
Author

DeadEnded commented Mar 22, 2020

Okay I updated backed up the sensor.py of the custom component and replaced it with the version you shared above. Restarted HA and then used the service to set the logger to debug. After waiting 5 minutes for the next cycle, I see this in container logs:

2020-03-21 20:30:40 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Pulled email folder list
2020-03-21 20:30:40 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Folder selected: Mail
Message count: [b'32']
2020-03-21 20:30:40 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Attempting to find Informed Delivery mail
2020-03-21 20:30:40 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Found email count: [b'']
2020-03-21 20:30:40 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Informed Delivery email found processing...
2020-03-21 20:30:40 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Removing duplicate images.
2020-03-21 20:30:40 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Removing USPS announcement images.
2020-03-21 20:30:40 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Image Count: 0
2020-03-21 20:30:40 INFO (SyncWorker_15) [custom_components.mail_and_packages.sensor] No mail images found.
2020-03-21 20:30:40 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Removing /config/www/mail_and_packages/mail_today.gif
2020-03-21 20:30:40 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Copying nomail gif
2020-03-21 20:30:40 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Attempting to find mail from auto-reply@usps.com with subject Item Delivered
2020-03-21 20:30:40 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Other Messages list: [b'']
2020-03-21 20:30:40 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Attempting to find mail from auto-reply@usps.com with subject Expected Delivery on
2020-03-21 20:30:41 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Other Messages list: [b'']
2020-03-21 20:30:41 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Attempting to find mail from mcinfo@ups.com with subject Your UPS Package was delivered
2020-03-21 20:30:41 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Other Messages list: [b'']
2020-03-21 20:30:41 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Attempting to find mail from mcinfo@ups.com with subject UPS Update: Package Scheduled for Delivery Today
2020-03-21 20:30:41 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Other Messages list: [b'']
2020-03-21 20:30:41 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Attempting to find mail from mcinfo@ups.com with subject UPS Update: Follow Your Delivery on a Live Map
2020-03-21 20:30:41 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Other Messages list: [b'']
2020-03-21 20:30:41 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Attempting to find mail from TrackingUpdates@fedex.com with subject Your package has been delivered
2020-03-21 20:30:42 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Other Messages list: [b'']
2020-03-21 20:30:42 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Attempting to find mail from TrackingUpdates@fedex.com with subject Delivery scheduled for today
2020-03-21 20:30:42 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Other Messages list: [b'']
2020-03-21 20:30:42 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Attempting to find mail from TrackingUpdates@fedex.com with subject Your package is scheduled for delivery today
2020-03-21 20:30:42 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Other Messages list: [b'']
2020-03-21 20:30:42 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Attempting to find Amazon email with item list ...
2020-03-21 20:30:42 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Amazon emails found: 0
2020-03-21 20:30:42 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Amazon Count: 0
2020-03-21 20:30:42 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Attempting to find Amazon email with item list ...
2020-03-21 20:30:43 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Amazon emails found: 0
2020-03-21 20:30:43 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Amazon json: []
2020-03-21 20:30:43 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Attempting to find Amazon email with item list ...
2020-03-21 20:30:43 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Amazon emails found: 0
2020-03-21 20:30:43 DEBUG (SyncWorker_15) [custom_components.mail_and_packages.sensor] Amazon order: []

I believe I had 1 informed delivery of today for a packaging arriving monday... so I'll watch it for the next few days... I'll keep this thread updated.

Thanks again for all the help!!
DeadEnd

@moralmunky
Copy link
Owner

Find the following function in the sensor.py that you just added, around line 908 or so.

def get_formatted_date():
    return datetime.datetime.today().strftime('%d-%b-%Y')

Replace it with the following, you can now set the date for checking mail. Find a day you know you have informed delivery with mail images. Restart, then post the debug messages for the informed delivery with mail images.

def get_formatted_date():
    #today = datetime.datetime.today().strftime('%d-%b-%Y')
    #for testing
    today = '18-Mar-2020'
    return today

@DeadEnded
Copy link
Author

Looks like the same....

I set the sensor for March 16th:

def get_formatted_date():
    #return datetime.datetime.today().strftime('%d-%b-%Y')
    # testing
    today = '16-Mar-2020'
    return today

Here are the emails on that day... The informed delivery has 5 images in it.
image

Here are the debug logs from Portainer:

2020-03-21 23:59:57 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Pulled email folder list
2020-03-21 23:59:57 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Folder selected: Mail
Message count: [b'32']
2020-03-21 23:59:57 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to find Informed Delivery mail
2020-03-21 23:59:58 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Found email count: [b'']
2020-03-21 23:59:58 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Informed Delivery email found processing...
2020-03-21 23:59:58 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Removing duplicate images.
2020-03-21 23:59:58 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Removing USPS announcement images.
2020-03-21 23:59:58 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Image Count: 0
2020-03-21 23:59:58 INFO (MainThread) [custom_components.mail_and_packages.sensor] No mail images found.
2020-03-21 23:59:58 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Removing /config/images/mail_and_packages/mail_today.gif
2020-03-21 23:59:58 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Copying nomail gif
2020-03-21 23:59:58 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to find mail from auto-reply@usps.com with subject Item Delivered
2020-03-21 23:59:58 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Other Messages list: [b'']
2020-03-21 23:59:58 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to find mail from auto-reply@usps.com with subject Expected Delivery on
2020-03-21 23:59:58 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Other Messages list: [b'']
2020-03-21 23:59:58 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to find mail from mcinfo@ups.com with subject Your UPS Package was delivered
2020-03-21 23:59:59 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Other Messages list: [b'']
2020-03-21 23:59:59 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to find mail from mcinfo@ups.com with subject UPS Update: Package Scheduled for Delivery Today
2020-03-21 23:59:59 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Other Messages list: [b'']
2020-03-21 23:59:59 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to find mail from mcinfo@ups.com with subject UPS Update: Follow Your Delivery on a Live Map
2020-03-21 23:59:59 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Other Messages list: [b'']
2020-03-21 23:59:59 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to find mail from TrackingUpdates@fedex.com with subject Your package has been delivered
2020-03-22 00:00:00 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Other Messages list: [b'']
2020-03-22 00:00:00 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to find mail from TrackingUpdates@fedex.com with subject Delivery scheduled for today
2020-03-22 00:00:00 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Other Messages list: [b'']
2020-03-22 00:00:00 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to find mail from TrackingUpdates@fedex.com with subject Your package is scheduled for delivery today
2020-03-22 00:00:00 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Other Messages list: [b'']
2020-03-22 00:00:00 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to find Amazon email with item list ...
2020-03-22 00:00:01 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Amazon emails found: 0
2020-03-22 00:00:01 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Amazon Count: 0
2020-03-22 00:00:01 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to find Amazon email with item list ...
2020-03-22 00:00:01 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Amazon emails found: 0
2020-03-22 00:00:01 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Amazon json: []
2020-03-22 00:00:01 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to find Amazon email with item list ...
2020-03-22 00:00:02 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Amazon emails found: 0
2020-03-22 00:00:02 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Amazon order: []

Looks the exact same... doesn't seem to be finding anything... even the FedEx messages...
Since I know this component works for others, I just don't know what I did wrong :-(.
I'm usually pretty good at figuring things out.

Thanks!
DeadEnd

@firstof9
Copy link
Collaborator

Seems like it's not processing the emails, find the line
_LOGGER.debug("Found email count: %s", str(data))
change it to
_LOGGER.debug("Found email count: %s", str(len(data)))
This should put in the log "Found email count: 1" or something similar.

You can do the same for the line:
_LOGGER.debug("Other Messages list: %s", str(data))
change to:
_LOGGER.debug("Other Messages list: %s", str(len(data)))

We'll get this figured out.

@DeadEnded
Copy link
Author

DeadEnded commented Mar 24, 2020

Updated to latest beta release.
Still not finding any e-mails I guess:

2020-03-23 21:01:14 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Pulled email folder list
2020-03-23 21:01:14 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Folder selected: Mail
Message count: [b'39']
2020-03-23 21:01:14 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Attempting to find Informed Delivery mail
2020-03-23 21:01:15 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Found email count: 0
2020-03-23 21:01:15 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Informed Delivery email found processing...
2020-03-23 21:01:15 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Removing duplicate images.
2020-03-23 21:01:15 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Message contents: 
2020-03-23 21:01:15 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Removing USPS announcement images.
2020-03-23 21:01:15 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Image Count: 0
2020-03-23 21:01:15 INFO (SyncWorker_22) [custom_components.mail_and_packages.sensor] No mail images found.
2020-03-23 21:01:15 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Removing /config/www/mail_and_packages/mail_today.gif
2020-03-23 21:01:15 INFO (SyncWorker_22) [custom_components.mail_and_packages.sensor] No mail found.
2020-03-23 21:01:15 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Copying nomail gif
2020-03-23 21:01:15 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Attempting to find mail from auto-reply@usps.com with subject Item Delivered
2020-03-23 21:01:15 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Other Messages list: 0
2020-03-23 21:01:15 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Attempting to find mail from auto-reply@usps.com with subject Expected Delivery on
2020-03-23 21:01:15 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Other Messages list: 0
2020-03-23 21:01:15 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Attempting to find mail from mcinfo@ups.com with subject Your UPS Package was delivered
2020-03-23 21:01:16 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Other Messages list: 0
2020-03-23 21:01:16 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Attempting to find mail from mcinfo@ups.com with subject UPS Update: Package Scheduled for Delivery Today
2020-03-23 21:01:16 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Other Messages list: 0
2020-03-23 21:01:16 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Attempting to find mail from mcinfo@ups.com with subject UPS Update: Follow Your Delivery on a Live Map
2020-03-23 21:01:16 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Other Messages list: 0
2020-03-23 21:01:16 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Attempting to find mail from TrackingUpdates@fedex.com with subject Your package has been delivered
2020-03-23 21:01:17 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Other Messages list: 0
2020-03-23 21:01:17 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Attempting to find mail from TrackingUpdates@fedex.com with subject Delivery scheduled for today
2020-03-23 21:01:17 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Other Messages list: 0
2020-03-23 21:01:17 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Attempting to find mail from TrackingUpdates@fedex.com with subject Your package is scheduled for delivery today
2020-03-23 21:01:17 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Other Messages list: 0
2020-03-23 21:01:17 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Attempting to find Amazon email with item list ...
2020-03-23 21:01:17 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Amazon emails found: 0
2020-03-23 21:01:17 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Amazon Count: 0
2020-03-23 21:01:17 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Attempting to find Amazon email with item list ...
2020-03-23 21:01:18 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Amazon emails found: 0
2020-03-23 21:01:18 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Amazon json: []
2020-03-23 21:01:18 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Attempting to find Amazon email with item list ...
2020-03-23 21:01:18 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Amazon emails found: 0
2020-03-23 21:01:18 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Amazon order: []
2020-03-23 21:01:18 DEBUG (SyncWorker_22) [custom_components.mail_and_packages.sensor] Updated scan time: Mar-23-2020 09:01 PM

I even tried a few different days that have different sets of e-mails that should work.
None of them seem to be working.

@firstof9
Copy link
Collaborator

Ok one more thing I can think to try.
Change line 961 (should be 961):
from
msg = email.message_from_string(data[0][1].decode('utf-8'))
to
msg = email.message_from_bytes(data[0][1])

You will get a wall of text if it's reading your email message properly. You don't have to paste that here.

@DeadEnded
Copy link
Author

Nope, no big wall-o-text.

@firstof9
Copy link
Collaborator

So "Message contents: " stays blank?

@firstof9
Copy link
Collaborator

@DeadEnded Can you post a shot of your "System Health" from Home Assistant?
Example:

image

@DeadEnded
Copy link
Author

Yes, message contents is still blank.
image

@firstof9
Copy link
Collaborator

Starting to wonder if we shouldn't strip the quotes on the folders. Let me check something.

@firstof9
Copy link
Collaborator

@DeadEnded
Copy link
Author

No change.
Both before and after do get Message count: [b'40'] so they seem to both be doing the same thing.

@firstof9
Copy link
Collaborator

So the folder now shows up as "Mail" right?

@DeadEnded
Copy link
Author

Yes, it does.

@firstof9
Copy link
Collaborator

firstof9 commented Mar 24, 2020

I added a debug to this file to see what is being populated into data[0]:

https://raw.githubusercontent.com/firstof9/Home-Assistant-Mail-And-Packages/lots-of-debug/custom_components/mail_and_packages/sensor.py

See what that pumps out into the log.

@DeadEnded
Copy link
Author

Ran it with both config flow (normal and with quotes).
Both returned the same.
I believe this is the line you are looking for, but if not, let me know:
Found data: b''

@firstof9
Copy link
Collaborator

That's the line. Did you get an informed delivery email today?

@DeadEnded
Copy link
Author

I am modifying the date in the sensor.py to March 16th for all this testing. That day had an informed delivery with 5 images.

@firstof9
Copy link
Collaborator

@DeadEnded quick question, your mail folder isn't a sub folder of another folder is it? ie: Inbox > Something > Mail

@DeadEnded
Copy link
Author

Nope, just scrolled down the side pane and created a new folder - not a sub-folder.
Not sure how to "see" the hierarchy to know - but I would expect it is within Inbox or on level with it.
image

@firstof9
Copy link
Collaborator

I've done some testing on my own Yahoo Mail account, it seems that it doesn't like the "ON" part of the email search for some reason. I'm attempting to debug this.

@firstof9
Copy link
Collaborator

Here we are, @DeadEnded find the part that says:

    (rv, data) = account.search(None,
                                '(FROM "' + USPS_Mail_Email + '" SUBJECT "' +
                                USPS_Mail_Subject + '" ON "' + today + '")')

and change to:

    (rv, data) = account.search(None,
                                '(FROM "' + USPS_Mail_Email + '" SUBJECT "' +
                                USPS_Mail_Subject + '" SENTON "' + today + '")')

See if that hits on your email from the 16th.

@DeadEnded
Copy link
Author

DeadEnded commented Mar 30, 2020

Success!
It looks like the images and USPS total are working.
I'll do more checking - It didn't look like packages worked - and also I had a Fed-Ex delivery that didn't appear... but progress!

I don't have time to look closely at the logs right now, but will post findings tomorrow.

Thanks!

@firstof9
Copy link
Collaborator

Well now that I know it works, I'll fix the rest after I test tomorrow and release a beta update for some wider testing.

@firstof9 firstof9 added bug Something isn't working and removed investigating Investigating the issue labels Mar 30, 2020
@firstof9 firstof9 mentioned this issue Mar 30, 2020
5 tasks
@firstof9 firstof9 added this to In progress in 0.1.3 Release Apr 10, 2020
@firstof9 firstof9 mentioned this issue Apr 14, 2020
5 tasks
Development automation moved this from Needs Testing to Done Apr 14, 2020
0.1.3 Release automation moved this from In progress to Done Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature New feature or request
Projects
Development
  
Done
0.1.3 Release
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants