From 701bb666c4977a0949273b5de6ec442ae3ea47c6 Mon Sep 17 00:00:00 2001 From: Quentame Date: Sat, 12 Oct 2019 22:01:35 +0200 Subject: [PATCH] Move imports in watson_iot component (#27448) --- homeassistant/components/watson_iot/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/watson_iot/__init__.py b/homeassistant/components/watson_iot/__init__.py index aef2cc8ccce..adc05893fde 100644 --- a/homeassistant/components/watson_iot/__init__.py +++ b/homeassistant/components/watson_iot/__init__.py @@ -4,6 +4,8 @@ import queue import threading import time +from ibmiotf import MissingMessageEncoderException +from ibmiotf.gateway import Client import voluptuous as vol from homeassistant.const import ( @@ -67,7 +69,6 @@ CONFIG_SCHEMA = vol.Schema( def setup(hass, config): """Set up the Watson IoT Platform component.""" - from ibmiotf import gateway conf = config[DOMAIN] @@ -85,7 +86,7 @@ def setup(hass, config): "auth-method": "token", "auth-token": conf[CONF_TOKEN], } - watson_gateway = gateway.Client(client_args) + watson_gateway = Client(client_args) def event_to_json(event): """Add an event to the outgoing list.""" @@ -190,7 +191,6 @@ class WatsonIOTThread(threading.Thread): def write_to_watson(self, events): """Write preprocessed events to watson.""" - import ibmiotf for event in events: for retry in range(MAX_TRIES + 1): @@ -208,7 +208,7 @@ class WatsonIOTThread(threading.Thread): _LOGGER.error("Failed to publish message to Watson IoT") continue break - except (ibmiotf.MissingMessageEncoderException, IOError): + except (MissingMessageEncoderException, IOError): if retry < MAX_TRIES: time.sleep(RETRY_DELAY) else: