From 73e25296ca59b1891f8cb689a579f48da66bd2c6 Mon Sep 17 00:00:00 2001 From: springstan <46536646+springstan@users.noreply.github.com> Date: Wed, 4 Dec 2019 11:18:05 +0100 Subject: [PATCH] Move imports to top for joaoapps_join (#29402) --- .../components/joaoapps_join/__init__.py | 20 +++++++++---------- .../components/joaoapps_join/notify.py | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/homeassistant/components/joaoapps_join/__init__.py b/homeassistant/components/joaoapps_join/__init__.py index b988411762e..10cbcf6b5c0 100644 --- a/homeassistant/components/joaoapps_join/__init__.py +++ b/homeassistant/components/joaoapps_join/__init__.py @@ -1,10 +1,19 @@ """Support for Joaoapps Join services.""" import logging +from pyjoin import ( + get_devices, + ring_device, + send_file, + send_notification, + send_sms, + send_url, + set_wallpaper, +) import voluptuous as vol +from homeassistant.const import CONF_API_KEY, CONF_NAME import homeassistant.helpers.config_validation as cv -from homeassistant.const import CONF_NAME, CONF_API_KEY _LOGGER = logging.getLogger(__name__) @@ -35,14 +44,6 @@ CONFIG_SCHEMA = vol.Schema( def register_device(hass, api_key, name, device_id, device_ids, device_names): """Register services for each join device listed.""" - from pyjoin import ( - ring_device, - set_wallpaper, - send_sms, - send_file, - send_url, - send_notification, - ) def ring_service(service): """Service to ring devices.""" @@ -114,7 +115,6 @@ def register_device(hass, api_key, name, device_id, device_ids, device_names): def setup(hass, config): """Set up the Join services.""" - from pyjoin import get_devices for device in config[DOMAIN]: api_key = device.get(CONF_API_KEY) diff --git a/homeassistant/components/joaoapps_join/notify.py b/homeassistant/components/joaoapps_join/notify.py index 2e6b3d1c67a..14b8fe1a814 100644 --- a/homeassistant/components/joaoapps_join/notify.py +++ b/homeassistant/components/joaoapps_join/notify.py @@ -1,6 +1,9 @@ """Support for Join notifications.""" import logging + +from pyjoin import get_devices, send_notification import voluptuous as vol + from homeassistant.components.notify import ( ATTR_DATA, ATTR_TITLE, @@ -34,8 +37,6 @@ def get_service(hass, config, discovery_info=None): device_ids = config.get(CONF_DEVICE_IDS) device_names = config.get(CONF_DEVICE_NAMES) if api_key: - from pyjoin import get_devices - if not get_devices(api_key): _LOGGER.error("Error connecting to Join. Check the API key") return False @@ -60,7 +61,6 @@ class JoinNotificationService(BaseNotificationService): def send_message(self, message="", **kwargs): """Send a message to a user.""" - from pyjoin import send_notification title = kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT) data = kwargs.get(ATTR_DATA) or {}