Remove timeout from Russound RIO initialization (#134070)

This commit is contained in:
Noah Husby 2024-12-27 05:01:10 -05:00 committed by Paulus Schoutsen
parent 1a909d3a8a
commit f6a9cd38c0
3 changed files with 9 additions and 17 deletions

View File

@ -1,6 +1,5 @@
"""The russound_rio component.""" """The russound_rio component."""
import asyncio
import logging import logging
from aiorussound import RussoundClient, RussoundTcpConnectionHandler 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.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady 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] PLATFORMS = [Platform.MEDIA_PLAYER]
@ -40,7 +39,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: RussoundConfigEntry) ->
await client.register_state_update_callbacks(_connection_update_callback) await client.register_state_update_callbacks(_connection_update_callback)
try: try:
async with asyncio.timeout(CONNECT_TIMEOUT):
await client.connect() await client.connect()
except RUSSOUND_RIO_EXCEPTIONS as err: except RUSSOUND_RIO_EXCEPTIONS as err:
raise ConfigEntryNotReady( raise ConfigEntryNotReady(

View File

@ -2,7 +2,6 @@
from __future__ import annotations from __future__ import annotations
import asyncio
import logging import logging
from typing import Any from typing import Any
@ -17,7 +16,7 @@ from homeassistant.config_entries import (
from homeassistant.const import CONF_HOST, CONF_PORT from homeassistant.const import CONF_HOST, CONF_PORT
from homeassistant.helpers import config_validation as cv 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( DATA_SCHEMA = vol.Schema(
{ {
@ -45,7 +44,6 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
client = RussoundClient(RussoundTcpConnectionHandler(host, port)) client = RussoundClient(RussoundTcpConnectionHandler(host, port))
try: try:
async with asyncio.timeout(CONNECT_TIMEOUT):
await client.connect() await client.connect()
controller = client.controllers[1] controller = client.controllers[1]
await client.disconnect() await client.disconnect()
@ -90,7 +88,6 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
# Connection logic is repeated here since this method will be removed in future releases # Connection logic is repeated here since this method will be removed in future releases
client = RussoundClient(RussoundTcpConnectionHandler(host, port)) client = RussoundClient(RussoundTcpConnectionHandler(host, port))
try: try:
async with asyncio.timeout(CONNECT_TIMEOUT):
await client.connect() await client.connect()
controller = client.controllers[1] controller = client.controllers[1]
await client.disconnect() await client.disconnect()

View File

@ -16,9 +16,6 @@ RUSSOUND_RIO_EXCEPTIONS = (
asyncio.CancelledError, asyncio.CancelledError,
) )
CONNECT_TIMEOUT = 15
MP_FEATURES_BY_FLAG = { MP_FEATURES_BY_FLAG = {
FeatureFlag.COMMANDS_ZONE_MUTE_OFF_ON: MediaPlayerEntityFeature.VOLUME_MUTE FeatureFlag.COMMANDS_ZONE_MUTE_OFF_ON: MediaPlayerEntityFeature.VOLUME_MUTE
} }