1
mirror of https://github.com/home-assistant/core synced 2024-09-03 08:14:07 +02:00

Move imports to top for horizon (#29419)

* Move imports to top for horizon

* Fix Pylint redefining name keys
This commit is contained in:
springstan 2019-12-04 14:15:17 +01:00 committed by Pascal Vizeli
parent 46c306685d
commit c880f09714

View File

@ -2,10 +2,12 @@
from datetime import timedelta
import logging
from horimote import Client, keys
from horimote.exceptions import AuthenticationError
import voluptuous as vol
from homeassistant import util
from homeassistant.components.media_player import MediaPlayerDevice, PLATFORM_SCHEMA
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
from homeassistant.components.media_player.const import (
MEDIA_TYPE_CHANNEL,
SUPPORT_NEXT_TRACK,
@ -56,8 +58,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Horizon platform."""
from horimote import Client, keys
from horimote.exceptions import AuthenticationError
host = config[CONF_HOST]
name = config[CONF_NAME]
@ -81,12 +81,12 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
class HorizonDevice(MediaPlayerDevice):
"""Representation of a Horizon HD Recorder."""
def __init__(self, client, name, keys):
def __init__(self, client, name, remote_keys):
"""Initialize the remote."""
self._client = client
self._name = name
self._state = None
self._keys = keys
self._keys = remote_keys
@property
def name(self):
@ -177,7 +177,6 @@ class HorizonDevice(MediaPlayerDevice):
def _send(self, key=None, channel=None):
"""Send a key to the Horizon device."""
from horimote.exceptions import AuthenticationError
try:
if key: