From 79ebe930e31a91967928a5642c98e58b522109b0 Mon Sep 17 00:00:00 2001 From: Anders Melchiorsen Date: Fri, 5 Mar 2021 16:16:07 +0100 Subject: [PATCH] Limit log spam by ESPHome (#47456) --- homeassistant/components/esphome/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/esphome/__init__.py b/homeassistant/components/esphome/__init__.py index 6ce411b5169..b9720dcdf80 100644 --- a/homeassistant/components/esphome/__init__.py +++ b/homeassistant/components/esphome/__init__.py @@ -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,