GithubHelp home page GithubHelp logo

ljmerza / ha-email-sensor Goto Github PK

View Code? Open in Web Editor NEW
86.0 8.0 22.0 167 KB

Email Sensor for collecting tracking numbers from over 40 providers.

License: MIT License

Python 97.59% Dockerfile 0.84% Shell 1.57%

ha-email-sensor's Introduction

Home Assistant Email Sensor

Gets emails from IMAP and parses out any tracking numbers. Goes well with the tracking-number-card for lovelace!

Supported Emails

  • Adafruit
  • Adam & Eve
  • Amazon
  • Ali Express
  • B&H Photo
  • Bespoke Post
  • Best Buy
  • Chewy
  • DHL
  • Dollar Shave Club
  • DSW
  • eBay
  • FedEx
  • Gamestop
  • Georgia Power
  • Google Express
  • Groupon
  • Guitar Center
  • Litter Robot
  • Lowes
  • Manta Sleep
  • Monoprice
  • NewEgg
  • Nintendo
  • Nuleaf
  • Paypal
  • Pledge Box
  • Philips Hue
  • Prusa
  • Reolink
  • Rockauto
  • Sylvane
  • Sony
  • Swiss Post
  • Target
  • Thriftbooks
  • Timeless
  • The Smartest House
  • Ubiquiti
  • UPS
  • USPS
  • Wyze
  • Zazzle

If you want support for tracking, forward me the email (ljmerza at gmail) and open an issue.


GitHub Release License

Project Maintenance GitHub Activity

Installation

  • Add the email folder in your custom_components folder
sensor:
  - platform: email
    email: !secret my_email
    password: !secret my_email_password
  • If the component doesn't load this might be due to Home Assistant not installing the requirements automatically through the manifests file. You can install them manaually by running pip install beautifulsoup4==4.7.1 imapclient==2.1.0 mail-parser==3.9.3
  • If you use 2 factor authentication for Google you'll need to create an app password. See more details here

Options

Name Type Requirement default Description
email string Required email address
password string Required email password
imap_server string Optional imap.gmail.com IMAP server address>
imap_port number Optional 993 IMAP port
folder string Optional INBOX Which folder to pull emails from
ssl boolean Optional true enable or disable SSL when using IMAP
days_old number Optional 30 how many days of emails to retrieve

Enjoy my card? Help me out for a couple of 🍻 or a ☕!

coffee

ha-email-sensor's People

Contributors

bendikrb avatar brendanm720 avatar framesfree avatar henri-j-norden avatar jdeath avatar ljmerza avatar neuhausf avatar selim042 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ha-email-sensor's Issues

Does not detect Amazon's "early shipping" email notification.

The parser is not currently searching for the special case "early shipping" email subject from Amazon.
I am including an example of the text as it appears in the email subject that I just received (with the actual order number redacted, of course).

Shipped: Now arriving early on Monday, November 28 (#000-0000000-0000000)

Service to mark package as received

Describe the solution you'd like
In substitute to adding API calls to tracking data for each platform, having a HA service that can be called with the carrier and tracking number to change the status of the package could be a nice way to keep track. Mostly a "delivered" or "received" status.

Describe alternatives you've considered
Ignoring the tracking numbers or implementing this myself a different way. Haven't really thought of any good alternatives yet.

Additional context
If done, a change to the tracking Lovelace card to show the statuses and call the service would be wonderful.

Extract Amazon OTP (One-Time-Password) for delivery

For the ones not knowing what i'm talking about:
Amazon has a new Policy for expensive items, requiring a One-Time-Password at the door.

Is your feature request related to a problem? Please describe.

Amazon sends OTPs only to the main Amazon-Account owner. Everyone else in the household does not have it.
Also is a pain in the ass to search for that OTP (mostly on email, because sometimes sms not even works) while the delivery-driver is waiting at the door.

Describe the solution you'd like
Extraction of the One-Time-Password with HA-email-sensor -> showing that one on a HA-Display near the door.

Additional context
Amazon: Secure Delivery with a One-Time Password

It literally drives people crazy (like me)
Reddit

UPS doesn't parse 'My Choice' emails

Version of the custom_component

2.0.1

Configuration

sensor:
  - platform: email
    email: !secret gmail_email
    password: !secret gmail_password

Describe the bug

When signed up for the 'My Choice' service from UPS, the tracking emails come from the address [email protected]
It doesn't look like this address is setup to be parsed.

Self signed certificates are not accepted

When I try to connect to my MS Exchange with self signed certificate it fails with

email: Error on device update!
[...]
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:997)

Config:

- platform: email
  email: alex@<beep>.net
  password: <beep>
  imap_server: mail.<beep>.net
  imap_port: 993
  folder: ebay
  days_old: 5
  ssl: true

I tried without SSL, but then it seems TLS is epected. Is there an option to ignore a self signed certificate?

Request: GLS

Is your feature request related to a problem? Please describe.
https://gls-group.com/

Additional context
Operating in 41 countries - one of the biggest in the world

Constant errors - generic error: can only concatenate list (not "tuple") to list

Version of the custom_component

3.11.0

Configuration

sensor: 
  - platform: email
    email: !secret mailman_user
    password: !secret mailman_pass
    imap_server: !secret mailman_server
    days_old: "3"

Describe the bug

An error is logged every few seconds per below. Sensor still appears to be functional.

Debug log


2023-06-20 19:41:00.547 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:00.640 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:00.657 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:00.753 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:00.837 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:00.917 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:00.981 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:00.997 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:01.016 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:01.037 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:01.052 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:01.064 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:01.115 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:01.132 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:01.146 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:01.159 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:01.176 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:01.227 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:01.242 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:01.259 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list
2023-06-20 19:41:01.272 ERROR (SyncWorker_6) [custom_components.email.sensor] generic error: can only concatenate list (not "tuple") to list

Latest homeassistant needs imapclient==2.2.0

Was getting lots of errors due to IMAP client being passed the wrong number of arguments. Something changed in core-2021.7.X.
Changing entry in manifest to "imapclient==2.2.0" fixed the problem

Tracking daily Georgia Power usage summary

My utility company provides a daily usage summary via email (see screenshot attached). I was wondering if we can extract the energy usage and the cost from that email. While this is not a traditional "tracking" feature, I feel like it will be a great feature to add that can potentially be extended to other features.

image

Home Depot Issue

I updated the integration in HACS but upon reboot I get an error that it cannot find "Home Depot" component. I deleted it all and reinstalled it. I got the same thing. I tried pulling all the custom_components files down to override them and still same issue. The fix was to delete the two lines that contain "Home Depot" and the sensor works again.

I just figured I would give you heads up on that.

HA won't start when I add email sensor to my config

Would love some assistance. I am attempting to add this email sensor to my Home Assistant running in docker, current version 0.92.2

I have followed the instructions, unzipped the file to the correct location, performed the PIP install for the items listed in the instructions and created a google app password and added the required settings to the sensor section of the configuration.yaml

When I check the configuration I get Configuration is Valid however when I restart home assistant, it never loads the webgui. I checked logs and it stops right after logger is started (generally this is where the components load). If I comment out the email sensor and then restart the webgui loads.

Any suggestions on how to troubleshoot this?

Thanks,
Dan

Setup Issues

Version of the custom_component

3.6.0

Configuration

sensor:
  - platform: email
    email: !secret google_email
    password: !secret google_email_password

Describe the bug

After configuring the integration and restarting it doesn't create the entities and has this error in the logs. I tried setting this up in December and kept running into issues, and it went on the back burner for a while.

Debug log

023-01-27 11:19:26.775 ERROR (MainThread) [homeassistant.components.sensor] email: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 503, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 729, in async_device_update
await task
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/email/sensor.py", line 320, in update
self._attr[ATTR_TRACKING_NUMBERS][ATTR] = list(map(lambda x: find_carrier(x, EMAIL_DOMAIN), tracking_numbers))
File "/config/custom_components/email/sensor.py", line 320, in <lambda>
self._attr[ATTR_TRACKING_NUMBERS][ATTR] = list(map(lambda x: find_carrier(x, EMAIL_DOMAIN), tracking_numbers))
File "/config/custom_components/email/sensor.py", line 159, in find_carrier
'tracking_number': tracking_number['tracking_number'],
KeyError: 'tracking_number'

Georgia power daily updates

How do you get the Georgia Power portion to work, I have Alabama Power, assume it would be similar (I get the daily emails that say Paperless support - either daily usage summary or usage alert.

custom imap server

Installed Version via HACS: 2.2.0

When trying to create a new sensor with custom imap server and imap port, home assistant produces following error:

Configuration invalid
Invalid config for [sensor.email]: [imap_server] is an invalid option for [sensor.email]. Check: sensor.email->imap_server. (See ?, line ?).

maybe because of the constants in
ha-email-sensor/custom_components/email/const.py

CONF_IMAP_SERVER = 'smtp_server'
CONF_IMAP_PORT = 'smpt_port'

changing imap to smtp or smpt seems to help

UPS Tracking number not found

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.

Digikey Support

I don't see digikey support on your list, can you add it?

Large number of error message

Version of the custom_component

Configuration

describe issue

Large number of error messages in log

Debug log


mailparser.utils
Source: custom_components/email/sensor.py:106 
First occurred: 3:10:11 PM (92 occurrences) 
Last logged: 5:00:32 PM

More than one match found for (?:id\s+(?P<id>.+?)(?:\s*[(]?envelope-from|\s*[(]?envelope-sender|\s+from|\s+by|\s+with(?! cipher)|\s+for|\s+via|;)) in from pvma00011.prod.fedex.com pvma00011.prod.fedex.com 204.135.242.202 
 using TLS with cipher ECDHE-RSA-AES256-GCM-SHA384 256/256 bits 
 Client did not present a certificate 
 by mx29.infosec.fedex.com FedEx MX with SMTP id 79.93.08286.EF9D79E5; Wed, 15 Apr 2020 23:07:26 -0500 CDT



imapclient 2.1.0 pinned dependency doesn't work with python>=3.9

2022-09-18 20:43:40.528 ERROR (MainThread) [homeassistant.components.sensor] email: Error on device update!
Traceback (most recent call last):
File "/var/lib/hass/.local/lib/python3.10/site-packages/homeassistant/helpers/entity_platform.py", line 493, in _async_add_entity
 await entity.async_device_update(warning=False)
File "/var/lib/hass/.local/lib/python3.10/site-packages/homeassistant/helpers/entity.py", line 703, in async_device_update
 await task
File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
 result = self.fn(*self.args, **self.kwargs)
File "/var/lib/hass/custom_components/email/sensor.py", line 126, in update
 server = IMAPClient(self.imap_server, use_uid=True, ssl=self.ssl)
File "/var/lib/hass/deps/lib/python3.10/site-packages/imapclient/imapclient.py", line 254, in __init__
 self._imap = self._create_IMAP4()
File "/var/lib/hass/deps/lib/python3.10/site-packages/imapclient/imapclient.py", line 288, in _create_IMAP4
 return tls.IMAP4_TLS(self.host, self.port, self.ssl_context,
File "/var/lib/hass/deps/lib/python3.10/site-packages/imapclient/tls.py", line 44, in __init__
 imaplib.IMAP4.__init__(self, host, port)
File "/usr/lib/python3.10/imaplib.py", line 202, in __init__
 self.open(host, port, timeout)
TypeError: IMAP4_TLS.open() takes 3 positional arguments but 4 were given

I've debugged the issue a bit, and to my dismay it was already solved in imapclient >=2.2.0, but this project pins the version to 2.1.0 which doesn't have the fix.
I've personally tested bumping the package dep to 2.3.1 ( current release ) and it works.

Since the changelog doesn't list any api-breaking changes since version 1.0, I'd argue for removing the needless pinning entirely so that users can get a more up to date lib if they wish so; If you really want to be strict about api breakage, then setting an upper bound for a major release of <3 should suffice and only require manual intervention in a distant future.

Support for Amazon & Card Suggestions

I would love to see support added for Amazon added to this, I know there is one already that this is based off from, but it's very outdated and doesn't work half the time, plus setting it up is a royal pain.

I would love to see a update to the card, not sure how customizable it can be but maybe have a way to show est delivery dates and status of the package (out for delivery, on hold so forth).

Another request I would like to see is if there is multiple detections of the same tracking number, it should ignore extras. Currently I have USPS, UPS and FedEx email me whenever there is a package being sent my way and sometimes you can get multiple email updates from shipping making the card show about 3-5 of the same tracking number.

Option to ignore SSL checking

I have an old synology NAS and use its mailplus server. My pfsense firewall is responsible for renewing my domains wildcard LetsEncrypt certs.
The certs pass in SSL Checker with the warning
The certificate is not trusted in all web browsers. You may need to install an Intermediate/chain certificate to link it to a trusted root certificate. Learn more about this error. The fastest way to fix this problem is to contact your SSL provider.

Describe the solution you'd like
Would it be possible to have a flag to ignore SSL cert errors? As this is all in house I am not worried about SSL

Thanks

Error: Platform error sensor.email - No module named 'imapclient'

First time trying in install this ha-email-sensor.

Ran this from command line: pip install beautifulsoup4==4.7.1 imapclient==2.1.0 mail-parser==3.9.3

Craeted email folder:
config/custom_components/email

Checked configuration and got this error:
Platform error sensor.email - No module named 'imapclient'

Configuration

  • platform: email
    email: !secret my_email
    password: !secret my_email_password

Forwarded Emails

I forward all my delivery tracking emails to a shared mailbox. This means that the sender is of course no longer Amazon, DHL or anyone else.
Is this integration dependent on the sender? Because at the moment it is not possible for me to see the forwarded emails/tracking information in the entity.

It would be great if forwarded tracking information would also be displayed.

Many thanks in advance :-)

PostNL tracking

I want to have PostNL emails parsed so I can track packages via that channel. Is there an option to create it?

I want to help create the parser if you like, how did you test it? Because you normally do not sent emails in name of amazon I suppose. Please let me know, really want to help, I have 15 years of development experience.

Update of sensor.email_*****_*****.com is taking over 10 seconds

Version of the custom_component: 3.7.0

Running Hassio on Raspberry Pi4 (not docker, but Hass-OS)

YAML:

  • platform: email
    email: @.com
    password: *******
    imap_server: imap.
    ***.com
    folder: Unbekannt

Logs:

Update of sensor.email__.com is taking over 10 seconds

Describe the bug

I created two sensors for two different email addresses. But the sensor does not show anyything. The value is '0' and no more attribute infos. Also I get this strange error in my logs (see above).

Debug log

Can not even find the details in my log that the custom component gets started. But I definitely got the folder in my custom folder.

Component breaks all HA sensors

Tried to install and get this in the logs:

  File "/root/.homeassistant/custom_components/email/sensor.py", line 60
    _LOGGER.error(f'IMAPClient setup_platform error: {err}')
                                                          ^
SyntaxError: invalid syntax

Which not only broke itself but ALL my sensors in HA.

Running HA 0.91.4

Unable to install package butifulSoup4 error in HA log.

I also ran the pip commands to install the dependancies as mentioned in the readme.

this is the output from that:
pip install beautifulsoup4==4.7.1 imapclient==2.1.0 mail-parser==3.9.3
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: beautifulsoup4==4.7.1 in /usr/local/lib/python2.7/dist-packages (4.7.1)
Requirement already satisfied: imapclient==2.1.0 in /usr/local/lib/python2.7/dist-packages (2.1.0)
Requirement already satisfied: mail-parser==3.9.3 in /usr/local/lib/python2.7/dist-packages (3.9.3)
Requirement already satisfied: soupsieve>=1.2 in /usr/local/lib/python2.7/dist-packages (from beautifulsoup4==4.7.1) (1.9.6)
Collecting six
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting ipaddress
Downloading ipaddress-1.0.23-py2.py3-none-any.whl (18 kB)
Requirement already satisfied: simplejson in /usr/local/lib/python2.7/dist-packages (from mail-parser==3.9.3) (3.17.2)
Requirement already satisfied: backports.functools-lru-cache; python_version < "3" in /usr/local/lib/python2.7/dist-packages (from soupsieve>=1.2->beautifulsoup4==4.7.1) (1.6.4)
Installing collected packages: six, ipaddress
Successfully installed ipaddress-1.0.23 six-1.16.0

I also ran the pip command mentioned in the error log posted below (its output:)
python3 -m pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in /home/chris/.local/lib/python3.7/site-packages (21.1.1)

Version of the custom_component

2.15.0

Configuration

  • platform: email
    email: !secret my_email
    password: !secret my_email_password
    folder: INBOX
    ssl: true
    show_all: true

( I do have the secret file updated just used the default secret names )

Add your logs here.


## Describe the bug
A clear and concise description of what the bug is.
Logger: homeassistant.util.package
Source: util/package.py:96
First occurred: 2:40:39 PM (1 occurrences)
Last logged: 2:40:39 PM

Unable to install package beautifulsoup4==4.7.1: WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1125)'))': /simple/beautifulsoup4/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1125)'))': /simple/beautifulsoup4/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1125)'))': /simple/beautifulsoup4/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1125)'))': /simple/beautifulsoup4/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1125)'))': /simple/beautifulsoup4/ ERROR: Could not find a version that satisfies the requirement beautifulsoup4==4.7.1 (from versions: 4.9.0, 4.9.1, 4.9.2, 4.9.3) ERROR: No matching distribution found for beautifulsoup4==4.7.1 WARNING: You are using pip version 20.2.4; however, version 20.3 is available. You should consider upgrading via the '/usr/local/bin/python3 -m pip install --upgrade pip' command.



## Debug log

Same as above debug was already on.  

Outlook not working

I can't get outlook to work. It seems that it doesn't recognize "inbox" as an inbox. Nor "junkemail". I don't know which name to use for the main inbox, nor a custom folder (which would be my preferred option)
My email ends in hotmail.com.

- Logger: homeassistant.components.sensor
Source: custom_components/email/sensor.py:254
Integration: Sensor (documentation, issues)
First occurred: 00:15:45 (1 occurrences)
Last logged: 00:15:45

email: Error on device update!
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/imaplib.py", line 1006, in _command
    self.send(data + CRLF)
  File "/usr/local/lib/python3.10/site-packages/imapclient/tls.py", line 62, in send
    self.sock.sendall(data)
  File "/usr/local/lib/python3.10/ssl.py", line 1237, in sendall
    v = self.send(byte_view[count:])
  File "/usr/local/lib/python3.10/ssl.py", line 1206, in send
    return self._sslobj.write(data)
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2396)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 493, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 715, in async_device_update
    await task
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/email/sensor.py", line 254, in update
    server.logout()
  File "/usr/local/lib/python3.10/site-packages/imapclient/imapclient.py", line 513, in logout
    typ, data = self._imap.logout()
  File "/usr/local/lib/python3.10/imaplib.py", line 642, in logout
    typ, dat = self._simple_command('LOGOUT')
  File "/usr/local/lib/python3.10/imaplib.py", line 1230, in _simple_command
    return self._command_complete(name, self._command(name, *args))
  File "/usr/local/lib/python3.10/imaplib.py", line 1008, in _command
    raise self.abort('socket error: %s' % val)
imaplib.IMAP4.abort: socket error: EOF occurred in violation of protocol (_ssl.c:2396)

but before that this also poppes up:

This error originated from a custom integration.

Logger: custom_components.email.sensor
Source: custom_components/email/sensor.py:220
Integration: email (documentation)
First occurred: 00:29:28 (1 occurrences)
Last logged: 00:29:28

IMAPClient update error: FETCH command error: BAD [b'Command Error. 10']

Version of the custom_component: 3.0.0
Configuration of sensors.yaml

  - platform: email
    email: **************@hotmail.com
    password: *******************
    imap_server: "imap-mail.outlook.com"
    folder: INBOX

Platform error sensor.email

I've not used this in awhile and saw there was a update so I wanted to give it a try again and I put this in my configuration.yaml file

sensor:

  • platform: email
    email: (email)
    password: (password)

When attempting to check the results come back as
Platform error sensor.email - Exception importing custom_components.email.sensor

I'm not sure if I set something up or there is an issue. Appreciate any help! Thanks!

support swiss post

Swiss Post english consigment mail would be great to support.

forwarded mail to ljmerza@gmail

multiple email addresses

Is your feature request related to a problem? Please describe.
I can not get two entities generated.

Describe the solution you'd like
Be able to define multiple emails to monitor.

Describe alternatives you've considered
I can not get two entities generated. I tried adding to entries for "email" and "password" as well as creating two sensors.

imap_server not work!

Error in log: Invalid config for [sensor.email]: [imap_server] is an invalid option for [sensor.email]. Check: sensor.email->imap_server. (See ?, line ?).

Sensor:

- platform: email
   email: [email protected]
   password: my_password
   imap_server: imap.yandex.ru
   imap_port: 993

everything works but the tracking numbers do not go up

Version of the custom_component

2.15.0

Configuration

sensor:

Add your logs here.
Everything is ok, but as a result on the attribute of the sensor I have:


## Describe the bug



emails: 
- from:
    - - AliExpress
      - [email protected]
  subject: Confirmation d’expédition de votre commande 301xxxxxxxxxxxxx6
- from:
    - - AliExpress
      - [email protected]
  subject: Confirmation d’expédition de votre commande 301xxxxxxxxxxxx

tracking_numbers: 
ups: []
fedex: []
paypal: []
usps: []
ali_express: []
newegg: []
rockauto: []
bh_photo: []
ebay: []
dhl: []
hue: []
google_express: []
western_digital: []
monoprice: []
georgia_power: []
best_buy: []
dollar_shave_club: []
nuleaf: []
timeless: []
BESPOKE_POST: []
wyze: []
reolink: []
chewy: []
groupon: []
zazzle: []
home_depot: []
swiss_post: []
manta_sleep: []

count: 2
icon: mdi:email
friendly_name: [email protected]

---> suddenly no tracking number is filled on the appropriate map card on lovelace :

type: custom:tracking-number-card
entities:

  • sensor.email_xxxxxx_gmail_com
    hideWhenEmpty: false

I do not understand why the parser does not find the tracking number, could you help me?

Allow name in config

I share my config on Github for others to follow and would not like to publicize my email. It would be nice to be able to use name in the config with the default being how it is currently handled.

Is a sensor only created when an applicable email is found?

Just installed this and trying to see if it is working. I don't get any errors but I also don't see a sensor created.

Does the sensor get created only when a qualifying email is found and parsed or should I see a sensor once the component initializes whether or not a qualifying email is found?

multiple extraction attributes

Is your feature request related to a problem? Please describe.
Sometimes, especially with small shops, there is not always send out a official DHL/UPS/FedEX etc. Email, but instead a shop-mail with the tracking number.

Describe the solution you'd like
Would be great to have this sensor work with multiple attributes and styles of emails, with something like "custom_attribute"

User being able to put a regexp in configuration.yml to extract all sorts of special types from emails.

Additional context
This way, if one knows the style of an email from a small shop, one could regex that style and search for the tracking-number.

companion request for my One-Time-Password request, because probably OTP needs changes on sensors.py anyways in a way of accepting different types of numbers e.g. tracking_numbers and otp_numbers (or needs a more open/global approach; using "numbers" instead of "tracking_numbers") ; if this gets implemented, a more flexible option like "custom_attribute" would be appreciated (this request).

Config Check Email Sensor error

Hello, I installed this using HACS but I can’t set the sensors because HA says it can’t find platform email. I did install the extras via terminal as suggested in the repo. Is there Anything anybody knows what I could try?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.