Move imports in lg_soundbar component (#28011)

This commit is contained in:
Diefferson Koderer Môro 2019-10-21 05:09:38 -03:00 committed by Fabian Affolter
parent 9a9cd1d0b2
commit 09acbc211c

View File

@ -1,14 +1,15 @@
"""Support for LG soundbars.""" """Support for LG soundbars."""
import logging import logging
import temescal
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 (
SUPPORT_SELECT_SOUND_MODE,
SUPPORT_SELECT_SOURCE, SUPPORT_SELECT_SOURCE,
SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_MUTE,
SUPPORT_VOLUME_SET, SUPPORT_VOLUME_SET,
SUPPORT_SELECT_SOUND_MODE,
) )
from homeassistant.const import STATE_ON from homeassistant.const import STATE_ON
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -32,8 +33,6 @@ class LGDevice(MediaPlayerDevice):
def __init__(self, discovery_info): def __init__(self, discovery_info):
"""Initialize the LG speakers.""" """Initialize the LG speakers."""
import temescal
host = discovery_info.get("host") host = discovery_info.get("host")
port = discovery_info.get("port") port = discovery_info.get("port")
@ -140,7 +139,6 @@ class LGDevice(MediaPlayerDevice):
@property @property
def sound_mode(self): def sound_mode(self):
"""Return the current sound mode.""" """Return the current sound mode."""
import temescal
if self._equaliser == -1: if self._equaliser == -1:
return "" return ""
@ -149,8 +147,6 @@ class LGDevice(MediaPlayerDevice):
@property @property
def sound_mode_list(self): def sound_mode_list(self):
"""Return the available sound modes.""" """Return the available sound modes."""
import temescal
modes = [] modes = []
for equaliser in self._equalisers: for equaliser in self._equalisers:
modes.append(temescal.equalisers[equaliser]) modes.append(temescal.equalisers[equaliser])
@ -159,8 +155,6 @@ class LGDevice(MediaPlayerDevice):
@property @property
def source(self): def source(self):
"""Return the current input source.""" """Return the current input source."""
import temescal
if self._function == -1: if self._function == -1:
return "" return ""
return temescal.functions[self._function] return temescal.functions[self._function]
@ -168,8 +162,6 @@ class LGDevice(MediaPlayerDevice):
@property @property
def source_list(self): def source_list(self):
"""List of available input sources.""" """List of available input sources."""
import temescal
sources = [] sources = []
for function in self._functions: for function in self._functions:
sources.append(temescal.functions[function]) sources.append(temescal.functions[function])
@ -191,12 +183,8 @@ class LGDevice(MediaPlayerDevice):
def select_source(self, source): def select_source(self, source):
"""Select input source.""" """Select input source."""
import temescal
self._device.set_func(temescal.functions.index(source)) self._device.set_func(temescal.functions.index(source))
def select_sound_mode(self, sound_mode): def select_sound_mode(self, sound_mode):
"""Set Sound Mode for Receiver..""" """Set Sound Mode for Receiver.."""
import temescal
self._device.set_eq(temescal.equalisers.index(sound_mode)) self._device.set_eq(temescal.equalisers.index(sound_mode))