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

ISSUE: email FROM amazon.com includes more than order messages #106

Closed
stogs opened this issue Apr 26, 2020 · 3 comments · Fixed by #131
Closed

ISSUE: email FROM amazon.com includes more than order messages #106

stogs opened this issue Apr 26, 2020 · 3 comments · Fixed by #131
Assignees
Labels
bug Something isn't working

Comments

@stogs
Copy link

stogs commented Apr 26, 2020

Amazon sensor fails to update if it finds non-order emails. Currently the process only looks for emails from amazon.com, which can include different types of emails other than orders such as ads or alexa tips. Looking for auto-confirm@amazon.com seems to narrow it down to just orders.

Screen Shot 2020-04-26 at 12 07 49 PM

2020-04-26 10:48:44 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Config scan interval: 0:05:00
2020-04-26 10:48:45 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to find Informed Delivery mail
2020-04-26 10:48:45 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Cleaning up image directory: /home/homeassistant/.homeassistant/images/mail_and_packages/
2020-04-26 10:48:45 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Informed Delivery email found processing...
2020-04-26 10:48:45 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Removing duplicate images.
2020-04-26 10:48:45 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Removing USPS announcement images.
2020-04-26 10:48:45 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Image Count: 0
2020-04-26 10:48:45 INFO (MainThread) [custom_components.mail_and_packages.sensor] No mail found.
2020-04-26 10:48:45 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Copying nomail gif
2020-04-26 10:48:45 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to find mail from auto-reply@usps.com with subject Item Delivered
2020-04-26 10:48:45 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to find mail from auto-reply@usps.com with subject Expected Delivery on
2020-04-26 10:48:45 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to find mail from mcinfo@ups.com with subject Your UPS Package was delivered
2020-04-26 10:48:46 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-04-26 10:48:46 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-04-26 10:48:46 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to find mail from TrackingUpdates@fedex.com with subject Your package has been delivered
2020-04-26 10:48:46 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to find mail from TrackingUpdates@fedex.com with subject Delivery scheduled for today
2020-04-26 10:48:46 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-04-26 10:48:46 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to find Amazon email with item list ...
2020-04-26 10:48:46 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Amazon emails found: 5
2020-04-26 10:48:47 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up mail_and_packages platform for sensor
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/home/homeassistant/.homeassistant/custom_components/mail_and_packages/sensor.py", line 69, in async_setup_entry
    async_add_entities([MailCheck(data), USPS_Mail(hass, data),
  File "/home/homeassistant/.homeassistant/custom_components/mail_and_packages/sensor.py", line 185, in __init__
    self.update()
  File "/home/homeassistant/.homeassistant/custom_components/mail_and_packages/sensor.py", line 225, in update
    self.data.update()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/util/__init__.py", line 240, in wrapper
    result = method(*args, **kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/mail_and_packages/sensor.py", line 161, in update
    self._amazon_packages = get_items(account, "count")
  File "/home/homeassistant/.homeassistant/custom_components/mail_and_packages/sensor.py", line 1248, in get_items
    email_msg = str(msg.get_payload(0))
  File "/usr/lib/python3.7/email/message.py", line 257, in get_payload
    raise TypeError('Expected list, got %s' % type(self._payload))
TypeError: Expected list, got <class 'str'>
@firstof9 firstof9 added bug Something isn't working investigating Investigating the issue labels Apr 26, 2020
@firstof9
Copy link
Collaborator

As a work around you could try deleting the other amazon emails for now until we can get a fix in place.

@firstof9 firstof9 mentioned this issue May 2, 2020
5 tasks
@firstof9
Copy link
Collaborator

firstof9 commented May 2, 2020

Give the latest beta a whirl should fix those errors right up now.

@firstof9 firstof9 self-assigned this May 2, 2020
@firstof9 firstof9 removed the investigating Investigating the issue label May 2, 2020
@stogs
Copy link
Author

stogs commented May 3, 2020

Looks good, thanks for the quick turnaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants