From 6446df667b162ad3a4dee3a7746f7b7e9e9719cb Mon Sep 17 00:00:00 2001 From: Yordan Suarez Date: Sun, 28 Jun 2020 21:11:38 +0000 Subject: [PATCH] Adding retries to setup platform if failed --- custom_components/fpl/sensor.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/custom_components/fpl/sensor.py b/custom_components/fpl/sensor.py index 5064b33..3abd07f 100644 --- a/custom_components/fpl/sensor.py +++ b/custom_components/fpl/sensor.py @@ -6,6 +6,8 @@ import asyncio from homeassistant.helpers.entity import Entity from homeassistant import util +from homeassistant.helpers.event import async_call_later + from homeassistant.const import ( CONF_NAME, EVENT_CORE_CONFIG_UPDATE, @@ -47,6 +49,9 @@ async def async_setup_entry(hass, config_entry, async_add_entities): except Exception as e: # pylint: disable=broad-except _LOGGER.error(f"Adding fpl accounts: {e}") + async_call_later( + hass, 15, async_setup_entry(hass, config_entry, async_add_entities) + ) await session.close()