mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00: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
|
hostname=host, keyfile=keyfile, certfile=certfile, ca_certs=ca_certs
|
||||||
)
|
)
|
||||||
except ssl.SSLError:
|
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
|
return False
|
||||||
|
|
||||||
timed_out = True
|
timed_out = True
|
||||||
try:
|
try:
|
||||||
with async_timeout.timeout(BRIDGE_TIMEOUT):
|
async with async_timeout.timeout(BRIDGE_TIMEOUT):
|
||||||
await bridge.connect()
|
await bridge.connect()
|
||||||
timed_out = False
|
timed_out = False
|
||||||
except asyncio.TimeoutError:
|
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():
|
if timed_out or not bridge.is_connected():
|
||||||
await bridge.close()
|
await bridge.close()
|
||||||
|
@ -228,19 +228,19 @@ class LutronCasetaFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
except ssl.SSLError:
|
except ssl.SSLError:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Invalid certificate used to connect to bridge at %s.",
|
"Invalid certificate used to connect to bridge at %s",
|
||||||
self.data[CONF_HOST],
|
self.data[CONF_HOST],
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
connected_ok = False
|
connected_ok = False
|
||||||
try:
|
try:
|
||||||
with async_timeout.timeout(BRIDGE_TIMEOUT):
|
async with async_timeout.timeout(BRIDGE_TIMEOUT):
|
||||||
await bridge.connect()
|
await bridge.connect()
|
||||||
connected_ok = bridge.is_connected()
|
connected_ok = bridge.is_connected()
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Timeout while trying to connect to bridge at %s.",
|
"Timeout while trying to connect to bridge at %s",
|
||||||
self.data[CONF_HOST],
|
self.data[CONF_HOST],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user