mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +00:00
Patch Discovery timeout in govee light local (#113692)
This commit is contained in:
parent
eaf86ee1ea
commit
aba5dcb63e
@ -20,6 +20,8 @@ from .const import (
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DISCOVERY_TIMEOUT = 5
|
||||
|
||||
|
||||
async def _async_has_devices(hass: HomeAssistant) -> bool:
|
||||
"""Return if there are devices that can be discovered."""
|
||||
@ -41,7 +43,7 @@ async def _async_has_devices(hass: HomeAssistant) -> bool:
|
||||
await controller.start()
|
||||
|
||||
try:
|
||||
async with asyncio.timeout(delay=5):
|
||||
async with asyncio.timeout(delay=DISCOVERY_TIMEOUT):
|
||||
while not controller.devices:
|
||||
await asyncio.sleep(delay=1)
|
||||
except TimeoutError:
|
||||
|
@ -1,5 +1,4 @@
|
||||
"""Test Govee light local config flow."""
|
||||
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from govee_local_api import GoveeDevice
|
||||
@ -21,6 +20,9 @@ async def test_creating_entry_has_no_devices(
|
||||
with patch(
|
||||
"homeassistant.components.govee_light_local.config_flow.GoveeController",
|
||||
return_value=mock_govee_api,
|
||||
), patch(
|
||||
"homeassistant.components.govee_light_local.config_flow.DISCOVERY_TIMEOUT",
|
||||
0,
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
|
Loading…
x
Reference in New Issue
Block a user