From afbd966ba6714fdebbe8745e2877f9938af4a104 Mon Sep 17 00:00:00 2001 From: bouni <bouni@owee.de> Date: Sat, 16 Nov 2019 10:25:25 +0100 Subject: [PATCH] Move imports in braviatv component (#27855) * Move imports in braviatv component * import braviarc directly * fixed import * directly import BraviaRC --- homeassistant/components/braviatv/media_player.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/braviatv/media_player.py b/homeassistant/components/braviatv/media_player.py index 5072cb7b74c..d0458541f7b 100644 --- a/homeassistant/components/braviatv/media_player.py +++ b/homeassistant/components/braviatv/media_player.py @@ -2,10 +2,11 @@ import ipaddress import logging +from braviarc.braviarc import BraviaRC from getmac import get_mac_address import voluptuous as vol -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 ( SUPPORT_NEXT_TRACK, SUPPORT_PAUSE, @@ -128,12 +129,11 @@ def request_configuration(config, hass, add_entities): def bravia_configuration_callback(data): """Handle the entry of user PIN.""" - from braviarc import braviarc pin = data.get("pin") - braviarc = braviarc.BraviaRC(host) - braviarc.connect(pin, CLIENTID_PREFIX, NICKNAME) - if braviarc.is_connected(): + _braviarc = BraviaRC(host) + _braviarc.connect(pin, CLIENTID_PREFIX, NICKNAME) + if _braviarc.is_connected(): setup_bravia(config, pin, hass, add_entities) else: request_configuration(config, hass, add_entities) @@ -154,10 +154,9 @@ class BraviaTVDevice(MediaPlayerDevice): def __init__(self, host, mac, name, pin): """Initialize the Sony Bravia device.""" - from braviarc import braviarc self._pin = pin - self._braviarc = braviarc.BraviaRC(host, mac) + self._braviarc = BraviaRC(host, mac) self._name = name self._state = STATE_OFF self._muted = False -- GitLab