move imports in sonos component (#27938)
This commit is contained in:
parent
eeb1bfc6f5
commit
bfba46d64a
6 changed files with 16 additions and 16 deletions
|
@ -1,16 +1,16 @@
|
|||
"""Support to embed Sonos."""
|
||||
import asyncio
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.media_player import DOMAIN as MP_DOMAIN
|
||||
from homeassistant.const import CONF_HOSTS, ATTR_ENTITY_ID, ATTR_TIME
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_TIME, CONF_HOSTS
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
|
||||
CONF_ADVERTISE_ADDR = "advertise_addr"
|
||||
CONF_INTERFACE_ADDR = "interface_addr"
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
"""Config flow for SONOS."""
|
||||
from homeassistant.helpers import config_entry_flow
|
||||
import pysonos
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.helpers import config_entry_flow
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
|
||||
async def _async_has_devices(hass):
|
||||
"""Return if there are devices that can be discovered."""
|
||||
import pysonos
|
||||
|
||||
return await hass.async_add_executor_job(pysonos.discover)
|
||||
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ import urllib
|
|||
|
||||
import async_timeout
|
||||
import pysonos
|
||||
from pysonos.exceptions import SoCoException, SoCoUPnPException
|
||||
import pysonos.snapshot
|
||||
from pysonos.exceptions import SoCoUPnPException, SoCoException
|
||||
|
||||
from homeassistant.components.media_player import MediaPlayerDevice
|
||||
from homeassistant.components.media_player.const import (
|
||||
|
@ -40,11 +40,6 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
|||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from . import (
|
||||
CONF_ADVERTISE_ADDR,
|
||||
CONF_HOSTS,
|
||||
CONF_INTERFACE_ADDR,
|
||||
DATA_SERVICE_EVENT,
|
||||
DOMAIN as SONOS_DOMAIN,
|
||||
ATTR_ALARM_ID,
|
||||
ATTR_ENABLED,
|
||||
ATTR_INCLUDE_LINKED_ZONES,
|
||||
|
@ -56,6 +51,11 @@ from . import (
|
|||
ATTR_TIME,
|
||||
ATTR_VOLUME,
|
||||
ATTR_WITH_GROUP,
|
||||
CONF_ADVERTISE_ADDR,
|
||||
CONF_HOSTS,
|
||||
CONF_INTERFACE_ADDR,
|
||||
DATA_SERVICE_EVENT,
|
||||
DOMAIN as SONOS_DOMAIN,
|
||||
SERVICE_CLEAR_TIMER,
|
||||
SERVICE_JOIN,
|
||||
SERVICE_PLAY_QUEUE,
|
||||
|
@ -1161,10 +1161,9 @@ class SonosEntity(MediaPlayerDevice):
|
|||
@soco_coordinator
|
||||
def set_alarm(self, data):
|
||||
"""Set the alarm clock on the player."""
|
||||
from pysonos import alarms
|
||||
|
||||
alarm = None
|
||||
for one_alarm in alarms.get_alarms(self.soco):
|
||||
for one_alarm in pysonos.alarms.get_alarms(self.soco):
|
||||
# pylint: disable=protected-access
|
||||
if one_alarm._alarm_id == str(data[ATTR_ALARM_ID]):
|
||||
alarm = one_alarm
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
from asynctest.mock import Mock, patch as patch
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.sonos import DOMAIN
|
||||
from homeassistant.components.media_player import DOMAIN as MP_DOMAIN
|
||||
from homeassistant.components.sonos import DOMAIN
|
||||
from homeassistant.const import CONF_HOSTS
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
from unittest.mock import patch
|
||||
|
||||
from homeassistant import config_entries, data_entry_flow
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.components import sonos
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import mock_coro
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""Tests for the Sonos Media Player platform."""
|
||||
from homeassistant.components.sonos import media_player, DOMAIN
|
||||
from homeassistant.components.sonos import DOMAIN, media_player
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue