ljmerza / ha-email-sensor

Email Sensor for collecting tracking numbers from over 40 providers.
MIT License
87 stars 22 forks source link

UPS Tracking number not found #12

Closed razzam21 closed 5 years ago

razzam21 commented 5 years ago

The email and package tracking is working great. I put a rule in my Gmail account that moves all of the emails that container tracking number into a folder and then point the email component at that folder.

I have a UPS email that the script doesn't seem to find the tracking number. The code where you check for the tracking number on line 28. match = re.search('tracknum=(.*?)&AgreeToTermsAndConditions', link) I looked at the source code to the email in my folder that isn't matching I discovered that there are two additional patterns that you could match on.

Sample 1: tracknum=ABCDEFGHIJKLMNOPQRST&type=

Sample 2: tracknum=ABCDEFGHIJKLMNOPQRST&AgreeToTermsAndConditions

I hope this helps. Let me know if there is anything else I can do to help.

ljmerza commented 5 years ago

The sample 2 is the same as the current regex but you said there are 2 additional patterns? I just changed it to tracknum=(.*?)& in v1.6.1 if that covers all the bases let me know!

razzam21 commented 5 years ago

The second sample is the "&" is displayed as "&" instead which is why I think the script shows the email but didn't find the package number.

On Wed, Aug 21, 2019, 18:47 Leonardo Merza notifications@github.com wrote:

The sample 2 is the same as the current regex but you said there are 2 additional patterns?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ljmerza/ha-email-sensor/issues/12?email_source=notifications&email_token=AALGBUM3PZ6M5JGGIBG2QATQFXO2RA5CNFSM4IOO7MZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD43Q7MA#issuecomment-523702192, or mute the thread https://github.com/notifications/unsubscribe-auth/AALGBUNPZWPSLNN67MZQOWLQFXO2RANCNFSM4IOO7MZQ .

ljmerza commented 5 years ago

Ah ok, well the new pattern should work for all three

razzam21 commented 5 years ago

Thank you

On Wed, Aug 21, 2019, 19:35 Leonardo Merza notifications@github.com wrote:

Ah ok, well the new pattern should work for all three

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ljmerza/ha-email-sensor/issues/12?email_source=notifications&email_token=AALGBUP4TYCK6KMBJBFHFNLQFXUNXA5CNFSM4IOO7MZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD43TBNQ#issuecomment-523710646, or mute the thread https://github.com/notifications/unsubscribe-auth/AALGBUOOVGC2FY56GKUL4P3QFXUNXANCNFSM4IOO7MZQ .