mirror of
https://github.com/home-assistant/core
synced 2024-07-21 14:24:50 +02:00
Move imports in message_bird component (#28022)
This commit is contained in:
parent
ff3c0e5697
commit
4bb82fa8ad
@ -1,16 +1,17 @@
|
|||||||
"""MessageBird platform for notify component."""
|
"""MessageBird platform for notify component."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import messagebird
|
||||||
|
from messagebird.client import ErrorException
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_SENDER
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
|
|
||||||
from homeassistant.components.notify import (
|
from homeassistant.components.notify import (
|
||||||
ATTR_TARGET,
|
ATTR_TARGET,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
BaseNotificationService,
|
BaseNotificationService,
|
||||||
)
|
)
|
||||||
|
from homeassistant.const import CONF_API_KEY, CONF_SENDER
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -26,8 +27,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||||||
|
|
||||||
def get_service(hass, config, discovery_info=None):
|
def get_service(hass, config, discovery_info=None):
|
||||||
"""Get the MessageBird notification service."""
|
"""Get the MessageBird notification service."""
|
||||||
import messagebird
|
|
||||||
|
|
||||||
client = messagebird.Client(config[CONF_API_KEY])
|
client = messagebird.Client(config[CONF_API_KEY])
|
||||||
try:
|
try:
|
||||||
# validates the api key
|
# validates the api key
|
||||||
@ -49,8 +48,6 @@ class MessageBirdNotificationService(BaseNotificationService):
|
|||||||
|
|
||||||
def send_message(self, message=None, **kwargs):
|
def send_message(self, message=None, **kwargs):
|
||||||
"""Send a message to a specified target."""
|
"""Send a message to a specified target."""
|
||||||
from messagebird.client import ErrorException
|
|
||||||
|
|
||||||
targets = kwargs.get(ATTR_TARGET)
|
targets = kwargs.get(ATTR_TARGET)
|
||||||
if not targets:
|
if not targets:
|
||||||
_LOGGER.error("No target specified")
|
_LOGGER.error("No target specified")
|
||||||
|
Loading…
Reference in New Issue
Block a user