Move imports in wink component (#27392)

This commit is contained in:
Quentame authored and Paulus Schoutsen committed 2019-10-10 09:51:28 -07:00
1 parent 7b13f0caf7
commit 91379b0ff7
11 files changed
+24 -18

No files matched your search

+5 -8
View File
@@ -5,6 +5,9 @@ import logging
import os
import time
from aiohttp.web import Response
import pywink
from pubnubsubhandler import PubNubSubscriptionHandler
import voluptuous as vol
from homeassistant.components.http import HomeAssistantView
@@ -279,8 +282,6 @@ def _request_oauth_completion(hass, config):
def setup(hass, config):
"""Set up the Wink component."""
import pywink
from pubnubsubhandler import PubNubSubscriptionHandler
if hass.data.get(DOMAIN) is None:
hass.data[DOMAIN] = {
@@ -689,8 +690,6 @@ class WinkAuthCallbackView(HomeAssistantView):
@callback
def get(self, request):
"""Finish OAuth callback request."""
from aiohttp import web
hass = request.app["hass"]
data = request.query
@@ -715,15 +714,13 @@ class WinkAuthCallbackView(HomeAssistantView):
hass.async_add_job(setup, hass, self.config)
return web.Response(
return Response(
text=html_response.format(response_message), content_type="text/html"
)
error_msg = "No code returned from Wink API"
_LOGGER.error(error_msg)
return web.Response(
text=html_response.format(error_msg), content_type="text/html"
)
return Response(text=html_response.format(error_msg), content_type="text/html")
class WinkDevice(Entity):