From b8759b4ddc23b8832f578b64a4c4e9410ed2c30d Mon Sep 17 00:00:00 2001 From: "Bendik R. Brenne" Date: Mon, 9 Sep 2019 01:41:45 +0200 Subject: [PATCH] s/smtp/imap/gi --- README.md | 6 +++--- custom_components/email/const.py | 4 ++-- custom_components/email/sensor.py | 14 +++++++------- info.md | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 994a30e..13f335c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Home Assistant Email Sensor -Gets emails from SMTP and prases out any tracking numbers from FedEx, UPS, USPS, Rockauto, Newegg, B&H Photo, Paypal, eBay, DHL, Philips Hue, Google Express, and Ali Express. Goes well with the [tracking-number-card](https://github.com/ljmerza/tracking-number-card) for lovelace! +Gets emails from IMAP and prases out any tracking numbers from FedEx, UPS, USPS, Rockauto, Newegg, B&H Photo, Paypal, eBay, DHL, Philips Hue, Google Express, and Ali Express. Goes well with the [tracking-number-card](https://github.com/ljmerza/tracking-number-card) for lovelace! --- @@ -31,8 +31,8 @@ sensor: | ---- | ---- | ------- | ----------- | email | string | **Required** | email address | password | string | **Required** | email password -| smtp_server | string | **Optional** | `imap.gmail.com` SMTP server address> -| smtp_port | number | **Optional** | `993` SMTP port +| 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 | show_all | boolean | **Optional** | `false` Show only unseen emails (default) or all emails from `folder` diff --git a/custom_components/email/const.py b/custom_components/email/const.py index d7ea6a0..4c98931 100644 --- a/custom_components/email/const.py +++ b/custom_components/email/const.py @@ -4,8 +4,8 @@ CONF_EMAIL = 'email' CONF_PASSWORD = 'password' -CONF_SMTP_SERVER = 'smtp_server' -CONF_SMTP_PORT = 'smpt_port' +CONF_IMAP_SERVER = 'imap_server' +CONF_IMAP_PORT = 'imap_port' CONF_EMAIL_FOLDER = 'folder' CONF_SHOW_ALL = 'show_all' diff --git a/custom_components/email/sensor.py b/custom_components/email/sensor.py index 3630048..def5824 100644 --- a/custom_components/email/sensor.py +++ b/custom_components/email/sensor.py @@ -11,8 +11,8 @@ from homeassistant.helpers.entity import Entity from .const import ( - CONF_EMAIL, CONF_PASSWORD, CONF_SHOW_ALL, CONF_SMTP_SERVER, - CONF_SMTP_PORT, CONF_EMAIL_FOLDER, ATTR_EMAILS, ATTR_COUNT, + CONF_EMAIL, CONF_PASSWORD, CONF_SHOW_ALL, CONF_IMAP_SERVER, + CONF_IMAP_PORT, CONF_EMAIL_FOLDER, ATTR_EMAILS, ATTR_COUNT, ATTR_TRACKING_NUMBERS, EMAIL_ATTR_FROM, EMAIL_ATTR_SUBJECT, EMAIL_ATTR_BODY) @@ -50,8 +50,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_EMAIL): cv.string, vol.Required(CONF_PASSWORD): cv.string, - vol.Required(CONF_SMTP_SERVER, default='imap.gmail.com'): cv.string, - vol.Required(CONF_SMTP_PORT, default=993): cv.positive_int, + vol.Required(CONF_IMAP_SERVER, default='imap.gmail.com'): cv.string, + vol.Required(CONF_IMAP_PORT, default=993): cv.positive_int, vol.Required(CONF_EMAIL_FOLDER, default='INBOX'): cv.string, vol.Required(CONF_SHOW_ALL, default=False): cv.boolean, }) @@ -69,8 +69,8 @@ def __init__(self, config): """Init the Email Entity.""" self._attr = None - self.smtp_server = config[CONF_SMTP_SERVER] - self.smtp_port = config[CONF_SMTP_PORT] + self.imap_server = config[CONF_IMAP_SERVER] + self.imap_port = config[CONF_IMAP_PORT] self.email_address = config[CONF_EMAIL] self.password = config[CONF_PASSWORD] self.email_folder = config[CONF_EMAIL_FOLDER] @@ -84,7 +84,7 @@ def update(self): ATTR_TRACKING_NUMBERS: {} } emails = [] - server = IMAPClient(self.smtp_server, use_uid=True) + server = IMAPClient(self.imap_server, use_uid=True) try: server.login(self.email_address, self.password) diff --git a/info.md b/info.md index 994a30e..13f335c 100644 --- a/info.md +++ b/info.md @@ -1,6 +1,6 @@ # Home Assistant Email Sensor -Gets emails from SMTP and prases out any tracking numbers from FedEx, UPS, USPS, Rockauto, Newegg, B&H Photo, Paypal, eBay, DHL, Philips Hue, Google Express, and Ali Express. Goes well with the [tracking-number-card](https://github.com/ljmerza/tracking-number-card) for lovelace! +Gets emails from IMAP and prases out any tracking numbers from FedEx, UPS, USPS, Rockauto, Newegg, B&H Photo, Paypal, eBay, DHL, Philips Hue, Google Express, and Ali Express. Goes well with the [tracking-number-card](https://github.com/ljmerza/tracking-number-card) for lovelace! --- @@ -31,8 +31,8 @@ sensor: | ---- | ---- | ------- | ----------- | email | string | **Required** | email address | password | string | **Required** | email password -| smtp_server | string | **Optional** | `imap.gmail.com` SMTP server address> -| smtp_port | number | **Optional** | `993` SMTP port +| 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 | show_all | boolean | **Optional** | `false` Show only unseen emails (default) or all emails from `folder`