From ca1d79f848a84c33d03eca89ef9499764ed15e89 Mon Sep 17 00:00:00 2001 From: SMKRV Date: Sun, 24 Nov 2024 00:29:45 +0300 Subject: [PATCH] Release v2.0.0 --- custom_components/ha_text_ai/coordinator.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/custom_components/ha_text_ai/coordinator.py b/custom_components/ha_text_ai/coordinator.py index f941e21..8096a47 100644 --- a/custom_components/ha_text_ai/coordinator.py +++ b/custom_components/ha_text_ai/coordinator.py @@ -24,7 +24,7 @@ from .const import ( RETRY_DELAY, ) -_LOGGER = logging.getLogger(__name__) +_LOGGER = logging.getLogger(__name__) class HATextAICoordinator(DataUpdateCoordinator): """Class to manage fetching data from the API.""" @@ -494,6 +494,20 @@ class HATextAICoordinator(DataUpdateCoordinator): """Return endpoint connection status.""" return self._endpoint_status + @property + def api_version(self) -> str: + """Return the API version.""" + return self._api_version + + async def __aenter__(self): + """Async enter.""" + await self.async_start() + return self + + async def __aexit__(self, exc_type, exc_val, exc_tb): + """Async exit.""" + await self.async_stop() + async def async_start(self) -> None: """Start coordinator operations.""" if not self._is_ready: