mirror of
https://github.com/home-assistant/core
synced 2024-10-04 07:58:43 +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."""
|
||||
import logging
|
||||
|
||||
import messagebird
|
||||
from messagebird.client import ErrorException
|
||||
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 (
|
||||
ATTR_TARGET,
|
||||
PLATFORM_SCHEMA,
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.const import CONF_API_KEY, CONF_SENDER
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -26,8 +27,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
"""Get the MessageBird notification service."""
|
||||
import messagebird
|
||||
|
||||
client = messagebird.Client(config[CONF_API_KEY])
|
||||
try:
|
||||
# validates the api key
|
||||
@ -49,8 +48,6 @@ class MessageBirdNotificationService(BaseNotificationService):
|
||||
|
||||
def send_message(self, message=None, **kwargs):
|
||||
"""Send a message to a specified target."""
|
||||
from messagebird.client import ErrorException
|
||||
|
||||
targets = kwargs.get(ATTR_TARGET)
|
||||
if not targets:
|
||||
_LOGGER.error("No target specified")
|
||||
|
Loading…
Reference in New Issue
Block a user