diff --git a/homeassistant/components/sisyphus/__init__.py b/homeassistant/components/sisyphus/__init__.py index 5ad59da5dee..841fbb68178 100644 --- a/homeassistant/components/sisyphus/__init__.py +++ b/homeassistant/components/sisyphus/__init__.py @@ -99,18 +99,23 @@ class TableHolder: async def get_table(self): """Return the Table held by this holder, connecting to it if needed.""" + if self._table: + return self._table + if not self._table_task: self._table_task = self._hass.async_create_task(self._connect_table()) return await self._table_task async def _connect_table(self): - - self._table = await Table.connect(self._host, self._session) - if self._name is None: - self._name = self._table.name - _LOGGER.debug("Connected to %s at %s", self._name, self._host) - return self._table + try: + self._table = await Table.connect(self._host, self._session) + if self._name is None: + self._name = self._table.name + _LOGGER.debug("Connected to %s at %s", self._name, self._host) + return self._table + finally: + self._table_task = None async def close(self): """Close the table held by this holder, if any."""