mirror of
https://github.com/home-assistant/core.git
synced 2025-05-05 14:39:16 +00:00
Remove timeout from Russound RIO initialization (#134070)
This commit is contained in:
parent
b6afbe4b29
commit
ad89004189
@ -1,6 +1,5 @@
|
||||
"""The russound_rio component."""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from aiorussound import RussoundClient, RussoundTcpConnectionHandler
|
||||
@ -11,7 +10,7 @@ from homeassistant.const import CONF_HOST, CONF_PORT, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
|
||||
from .const import CONNECT_TIMEOUT, DOMAIN, RUSSOUND_RIO_EXCEPTIONS
|
||||
from .const import DOMAIN, RUSSOUND_RIO_EXCEPTIONS
|
||||
|
||||
PLATFORMS = [Platform.MEDIA_PLAYER]
|
||||
|
||||
@ -40,8 +39,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: RussoundConfigEntry) ->
|
||||
await client.register_state_update_callbacks(_connection_update_callback)
|
||||
|
||||
try:
|
||||
async with asyncio.timeout(CONNECT_TIMEOUT):
|
||||
await client.connect()
|
||||
await client.connect()
|
||||
except RUSSOUND_RIO_EXCEPTIONS as err:
|
||||
raise ConfigEntryNotReady(
|
||||
translation_domain=DOMAIN,
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
@ -17,7 +16,7 @@ from homeassistant.config_entries import (
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
|
||||
from .const import CONNECT_TIMEOUT, DOMAIN, RUSSOUND_RIO_EXCEPTIONS
|
||||
from .const import DOMAIN, RUSSOUND_RIO_EXCEPTIONS
|
||||
|
||||
DATA_SCHEMA = vol.Schema(
|
||||
{
|
||||
@ -45,10 +44,9 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
client = RussoundClient(RussoundTcpConnectionHandler(host, port))
|
||||
try:
|
||||
async with asyncio.timeout(CONNECT_TIMEOUT):
|
||||
await client.connect()
|
||||
controller = client.controllers[1]
|
||||
await client.disconnect()
|
||||
await client.connect()
|
||||
controller = client.controllers[1]
|
||||
await client.disconnect()
|
||||
except RUSSOUND_RIO_EXCEPTIONS:
|
||||
_LOGGER.exception("Could not connect to Russound RIO")
|
||||
errors["base"] = "cannot_connect"
|
||||
@ -90,10 +88,9 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
# Connection logic is repeated here since this method will be removed in future releases
|
||||
client = RussoundClient(RussoundTcpConnectionHandler(host, port))
|
||||
try:
|
||||
async with asyncio.timeout(CONNECT_TIMEOUT):
|
||||
await client.connect()
|
||||
controller = client.controllers[1]
|
||||
await client.disconnect()
|
||||
await client.connect()
|
||||
controller = client.controllers[1]
|
||||
await client.disconnect()
|
||||
except RUSSOUND_RIO_EXCEPTIONS:
|
||||
_LOGGER.exception("Could not connect to Russound RIO")
|
||||
return self.async_abort(
|
||||
|
@ -16,9 +16,6 @@ RUSSOUND_RIO_EXCEPTIONS = (
|
||||
asyncio.CancelledError,
|
||||
)
|
||||
|
||||
|
||||
CONNECT_TIMEOUT = 15
|
||||
|
||||
MP_FEATURES_BY_FLAG = {
|
||||
FeatureFlag.COMMANDS_ZONE_MUTE_OFF_ON: MediaPlayerEntityFeature.VOLUME_MUTE
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user