Move imports to top for roku (#29289)
parent
5c8a8a631c
commit
9f649ed345
|
@ -1,6 +1,7 @@
|
||||||
"""Support for Roku."""
|
"""Support for Roku."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from roku import Roku, RokuException
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.discovery import SERVICE_ROKU
|
from homeassistant.components.discovery import SERVICE_ROKU
|
||||||
|
@ -64,7 +65,6 @@ def setup(hass, config):
|
||||||
|
|
||||||
def scan_for_rokus(hass):
|
def scan_for_rokus(hass):
|
||||||
"""Scan for devices and present a notification of the ones found."""
|
"""Scan for devices and present a notification of the ones found."""
|
||||||
from roku import Roku, RokuException
|
|
||||||
|
|
||||||
rokus = Roku.discover()
|
rokus = Roku.discover()
|
||||||
|
|
||||||
|
@ -94,7 +94,6 @@ def scan_for_rokus(hass):
|
||||||
|
|
||||||
def _setup_roku(hass, hass_config, roku_config):
|
def _setup_roku(hass, hass_config, roku_config):
|
||||||
"""Set up a Roku."""
|
"""Set up a Roku."""
|
||||||
from roku import Roku
|
|
||||||
|
|
||||||
host = roku_config[CONF_HOST]
|
host = roku_config[CONF_HOST]
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
"""Support for the Roku media player."""
|
"""Support for the Roku media player."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import requests.exceptions
|
import requests.exceptions
|
||||||
|
from roku import Roku
|
||||||
|
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice
|
from homeassistant.components.media_player import MediaPlayerDevice
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
|
@ -10,10 +12,10 @@ from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_PLAY_MEDIA,
|
SUPPORT_PLAY_MEDIA,
|
||||||
SUPPORT_PREVIOUS_TRACK,
|
SUPPORT_PREVIOUS_TRACK,
|
||||||
SUPPORT_SELECT_SOURCE,
|
SUPPORT_SELECT_SOURCE,
|
||||||
|
SUPPORT_TURN_OFF,
|
||||||
|
SUPPORT_TURN_ON,
|
||||||
SUPPORT_VOLUME_MUTE,
|
SUPPORT_VOLUME_MUTE,
|
||||||
SUPPORT_VOLUME_SET,
|
SUPPORT_VOLUME_SET,
|
||||||
SUPPORT_TURN_ON,
|
|
||||||
SUPPORT_TURN_OFF,
|
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
|
@ -54,7 +56,6 @@ class RokuDevice(MediaPlayerDevice):
|
||||||
|
|
||||||
def __init__(self, host):
|
def __init__(self, host):
|
||||||
"""Initialize the Roku device."""
|
"""Initialize the Roku device."""
|
||||||
from roku import Roku
|
|
||||||
|
|
||||||
self.roku = Roku(host)
|
self.roku = Roku(host)
|
||||||
self.ip_address = host
|
self.ip_address = host
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
"""Support for the Roku remote."""
|
"""Support for the Roku remote."""
|
||||||
import requests.exceptions
|
import requests.exceptions
|
||||||
|
from roku import Roku
|
||||||
|
|
||||||
from homeassistant.components import remote
|
from homeassistant.components import remote
|
||||||
from homeassistant.const import CONF_HOST
|
from homeassistant.const import CONF_HOST
|
||||||
|
@ -19,7 +20,6 @@ class RokuRemote(remote.RemoteDevice):
|
||||||
|
|
||||||
def __init__(self, host):
|
def __init__(self, host):
|
||||||
"""Initialize the Roku device."""
|
"""Initialize the Roku device."""
|
||||||
from roku import Roku
|
|
||||||
|
|
||||||
self.roku = Roku(host)
|
self.roku = Roku(host)
|
||||||
self._device_info = {}
|
self._device_info = {}
|
||||||
|
|
Loading…
Reference in New Issue