mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
Limit log spam by ESPHome (#47456)
This commit is contained in:
parent
864380e77c
commit
79ebe930e3
@ -256,13 +256,16 @@ async def _setup_auto_reconnect_logic(
|
||||
# really short reconnect interval.
|
||||
tries = min(tries, 10) # prevent OverflowError
|
||||
wait_time = int(round(min(1.8 ** tries, 60.0)))
|
||||
_LOGGER.info("Trying to reconnect to %s in %s seconds", host, wait_time)
|
||||
if tries == 1:
|
||||
_LOGGER.info("Trying to reconnect to %s in the background", host)
|
||||
_LOGGER.debug("Retrying %s in %d seconds", host, wait_time)
|
||||
await asyncio.sleep(wait_time)
|
||||
|
||||
try:
|
||||
await cli.connect(on_stop=try_connect, login=True)
|
||||
except APIConnectionError as error:
|
||||
_LOGGER.info(
|
||||
logger = _LOGGER.info if tries == 0 else _LOGGER.debug
|
||||
logger(
|
||||
"Can't connect to ESPHome API for %s (%s): %s",
|
||||
entry.unique_id,
|
||||
host,
|
||||
|
Loading…
x
Reference in New Issue
Block a user