Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions homeassistant/components/tplink_lte/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

from homeassistant.components.notify import ATTR_TARGET
from homeassistant.const import (
CONF_HOST, CONF_NAME, CONF_PASSWORD, EVENT_HOMEASSISTANT_STOP)
CONF_HOST, CONF_NAME, CONF_PASSWORD, EVENT_HOMEASSISTANT_STOP,
CONF_RECIPIENT)
from homeassistant.core import callback
from homeassistant.helpers import config_validation as cv, discovery
from homeassistant.helpers.aiohttp_client import async_create_clientsession
Expand All @@ -27,10 +28,22 @@

CONF_NOTIFY = "notify"

_NOTIFY_SCHEMA = vol.All(vol.Schema({
vol.Optional(CONF_NAME): cv.string,
vol.Required(ATTR_TARGET): vol.All(cv.ensure_list, [cv.string]),
}))
# Deprecated in 0.88.0, invalidated in 0.91.0, remove in 0.92.0
ATTR_TARGET_INVALIDATION_VERSION = '0.91.0'

_NOTIFY_SCHEMA = vol.All(
vol.Schema({
vol.Optional(CONF_NAME): cv.string,
vol.Optional(ATTR_TARGET): vol.All(cv.ensure_list, [cv.string]),
vol.Optional(CONF_RECIPIENT): vol.All(cv.ensure_list, [cv.string])
}),
cv.deprecated(
ATTR_TARGET,
replacement_key=CONF_RECIPIENT,
invalidation_version=ATTR_TARGET_INVALIDATION_VERSION
),
cv.has_at_least_one_key(CONF_RECIPIENT),
)

CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.All(cv.ensure_list, [vol.Schema({
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/tplink_lte/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from homeassistant.components.notify import (
ATTR_TARGET, BaseNotificationService)
from homeassistant.const import CONF_RECIPIENT

from ..tplink_lte import DATA_KEY

Expand Down Expand Up @@ -40,7 +41,7 @@ async def async_send_message(self, message="", **kwargs):
_LOGGER.error("No modem available")
return

phone = self.config[ATTR_TARGET]
phone = self.config[CONF_RECIPIENT]
targets = kwargs.get(ATTR_TARGET, phone)
if targets and message:
for target in targets:
Expand Down