mirror of
https://github.com/home-assistant/core
synced 2024-09-06 10:29:55 +02:00
Fix missing async for lutron_caseta timeout (#45812)
This commit is contained in:
parent
91a54eecb3
commit
e0bf18986b
@ -104,16 +104,16 @@ async def async_setup_entry(hass, config_entry):
|
||||
hostname=host, keyfile=keyfile, certfile=certfile, ca_certs=ca_certs
|
||||
)
|
||||
except ssl.SSLError:
|
||||
_LOGGER.error("Invalid certificate used to connect to bridge at %s.", host)
|
||||
_LOGGER.error("Invalid certificate used to connect to bridge at %s", host)
|
||||
return False
|
||||
|
||||
timed_out = True
|
||||
try:
|
||||
with async_timeout.timeout(BRIDGE_TIMEOUT):
|
||||
async with async_timeout.timeout(BRIDGE_TIMEOUT):
|
||||
await bridge.connect()
|
||||
timed_out = False
|
||||
except asyncio.TimeoutError:
|
||||
_LOGGER.error("Timeout while trying to connect to bridge at %s.", host)
|
||||
_LOGGER.error("Timeout while trying to connect to bridge at %s", host)
|
||||
|
||||
if timed_out or not bridge.is_connected():
|
||||
await bridge.close()
|
||||
|
@ -228,19 +228,19 @@ class LutronCasetaFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
)
|
||||
except ssl.SSLError:
|
||||
_LOGGER.error(
|
||||
"Invalid certificate used to connect to bridge at %s.",
|
||||
"Invalid certificate used to connect to bridge at %s",
|
||||
self.data[CONF_HOST],
|
||||
)
|
||||
return False
|
||||
|
||||
connected_ok = False
|
||||
try:
|
||||
with async_timeout.timeout(BRIDGE_TIMEOUT):
|
||||
async with async_timeout.timeout(BRIDGE_TIMEOUT):
|
||||
await bridge.connect()
|
||||
connected_ok = bridge.is_connected()
|
||||
except asyncio.TimeoutError:
|
||||
_LOGGER.error(
|
||||
"Timeout while trying to connect to bridge at %s.",
|
||||
"Timeout while trying to connect to bridge at %s",
|
||||
self.data[CONF_HOST],
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user