mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +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.
|
# really short reconnect interval.
|
||||||
tries = min(tries, 10) # prevent OverflowError
|
tries = min(tries, 10) # prevent OverflowError
|
||||||
wait_time = int(round(min(1.8 ** tries, 60.0)))
|
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)
|
await asyncio.sleep(wait_time)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await cli.connect(on_stop=try_connect, login=True)
|
await cli.connect(on_stop=try_connect, login=True)
|
||||||
except APIConnectionError as error:
|
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",
|
"Can't connect to ESPHome API for %s (%s): %s",
|
||||||
entry.unique_id,
|
entry.unique_id,
|
||||||
host,
|
host,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user