Prevent OverflowError in ESPHome integration (#21014)
This commit is contained in:
parent
d795410b27
commit
fe9800e784
1 changed files with 1 additions and 0 deletions
|
@ -325,6 +325,7 @@ async def _setup_auto_reconnect_logic(hass: HomeAssistantType,
|
||||||
# In the future another API will be set up so that the ESP can
|
# In the future another API will be set up so that the ESP can
|
||||||
# notify HA of connectivity directly, but for new we'll use a
|
# notify HA of connectivity directly, but for new we'll use a
|
||||||
# really short reconnect interval.
|
# really short reconnect interval.
|
||||||
|
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 in %s seconds", wait_time)
|
_LOGGER.info("Trying to reconnect in %s seconds", wait_time)
|
||||||
await asyncio.sleep(wait_time)
|
await asyncio.sleep(wait_time)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue