1
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:
J. Nick Koston 2021-01-31 23:15:20 -10:00 committed by GitHub
parent 91a54eecb3
commit e0bf18986b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -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()

View File

@ -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],
)