mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Use async with in Acmeda config flow (#48291)
This commit is contained in:
parent
b90c620c5e
commit
24dee01599
@ -38,12 +38,13 @@ class AcmedaFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
}
|
}
|
||||||
|
|
||||||
hubs = []
|
hubs = []
|
||||||
with suppress(asyncio.TimeoutError), async_timeout.timeout(5):
|
with suppress(asyncio.TimeoutError):
|
||||||
async for hub in aiopulse.Hub.discover():
|
async with async_timeout.timeout(5):
|
||||||
if hub.id not in already_configured:
|
async for hub in aiopulse.Hub.discover():
|
||||||
hubs.append(hub)
|
if hub.id not in already_configured:
|
||||||
|
hubs.append(hub)
|
||||||
|
|
||||||
if len(hubs) == 0:
|
if not hubs:
|
||||||
return self.async_abort(reason="no_devices_found")
|
return self.async_abort(reason="no_devices_found")
|
||||||
|
|
||||||
if len(hubs) == 1:
|
if len(hubs) == 1:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user