Move imports to top for rocketchat (#29288)
This commit is contained in:
parent
84d6a5369f
commit
8fbfb6bf8c
1 changed files with 7 additions and 8 deletions
|
@ -1,16 +1,20 @@
|
|||
"""Rocket.Chat notification service."""
|
||||
import logging
|
||||
|
||||
from rocketchat_API.APIExceptions.RocketExceptions import (
|
||||
RocketAuthenticationException,
|
||||
RocketConnectionException,
|
||||
)
|
||||
from rocketchat_API.rocketchat import RocketChat
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_ROOM, CONF_URL, CONF_USERNAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from homeassistant.components.notify import (
|
||||
ATTR_DATA,
|
||||
PLATFORM_SCHEMA,
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_ROOM, CONF_URL, CONF_USERNAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -27,10 +31,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
"""Return the notify service."""
|
||||
from rocketchat_API.APIExceptions.RocketExceptions import (
|
||||
RocketConnectionException,
|
||||
RocketAuthenticationException,
|
||||
)
|
||||
|
||||
username = config.get(CONF_USERNAME)
|
||||
password = config.get(CONF_PASSWORD)
|
||||
|
@ -54,7 +54,6 @@ class RocketChatNotificationService(BaseNotificationService):
|
|||
|
||||
def __init__(self, url, username, password, room):
|
||||
"""Initialize the service."""
|
||||
from rocketchat_API.rocketchat import RocketChat
|
||||
|
||||
self._room = room
|
||||
self._server = RocketChat(username, password, server_url=url)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue