mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Move imports to top for rocketchat (#29288)
This commit is contained in:
parent
84d6a5369f
commit
8fbfb6bf8c
@ -1,16 +1,20 @@
|
|||||||
"""Rocket.Chat notification service."""
|
"""Rocket.Chat notification service."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from rocketchat_API.APIExceptions.RocketExceptions import (
|
||||||
|
RocketAuthenticationException,
|
||||||
|
RocketConnectionException,
|
||||||
|
)
|
||||||
|
from rocketchat_API.rocketchat import RocketChat
|
||||||
import voluptuous as vol
|
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 (
|
from homeassistant.components.notify import (
|
||||||
ATTR_DATA,
|
ATTR_DATA,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
BaseNotificationService,
|
BaseNotificationService,
|
||||||
)
|
)
|
||||||
|
from homeassistant.const import CONF_PASSWORD, CONF_ROOM, CONF_URL, CONF_USERNAME
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -27,10 +31,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||||||
|
|
||||||
def get_service(hass, config, discovery_info=None):
|
def get_service(hass, config, discovery_info=None):
|
||||||
"""Return the notify service."""
|
"""Return the notify service."""
|
||||||
from rocketchat_API.APIExceptions.RocketExceptions import (
|
|
||||||
RocketConnectionException,
|
|
||||||
RocketAuthenticationException,
|
|
||||||
)
|
|
||||||
|
|
||||||
username = config.get(CONF_USERNAME)
|
username = config.get(CONF_USERNAME)
|
||||||
password = config.get(CONF_PASSWORD)
|
password = config.get(CONF_PASSWORD)
|
||||||
@ -54,7 +54,6 @@ class RocketChatNotificationService(BaseNotificationService):
|
|||||||
|
|
||||||
def __init__(self, url, username, password, room):
|
def __init__(self, url, username, password, room):
|
||||||
"""Initialize the service."""
|
"""Initialize the service."""
|
||||||
from rocketchat_API.rocketchat import RocketChat
|
|
||||||
|
|
||||||
self._room = room
|
self._room = room
|
||||||
self._server = RocketChat(username, password, server_url=url)
|
self._server = RocketChat(username, password, server_url=url)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user