Prevent OverflowError in ESPHome integration (#21014)

This commit is contained in:
Otto Winter 2019-02-12 22:34:06 +01:00 committed by Anders Melchiorsen
parent d795410b27
commit fe9800e784

View file

@ -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
# notify HA of connectivity directly, but for new we'll use a
# 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 in %s seconds", wait_time)
await asyncio.sleep(wait_time)