Add parallel updates & exception translations to tedee (#131146)

This commit is contained in:
Josef Zweck 2024-11-22 09:48:42 +01:00 committed by GitHub
parent e2183a81aa
commit 60e19967b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 3 deletions

View File

@ -99,14 +99,19 @@ class TedeeApiCoordinator(DataUpdateCoordinator[dict[int, TedeeLock]]):
await update_fn()
except TedeeLocalAuthException as ex:
raise ConfigEntryAuthFailed(
"Authentication failed. Local access token is invalid"
translation_domain=DOMAIN,
translation_key="authentification_failed",
) from ex
except TedeeDataUpdateException as ex:
_LOGGER.debug("Error while updating data: %s", str(ex))
raise UpdateFailed(f"Error while updating data: {ex!s}") from ex
raise UpdateFailed(
translation_domain=DOMAIN, translation_key="update_failed"
) from ex
except (TedeeClientException, TimeoutError) as ex:
raise UpdateFailed(f"Querying API failed. Error: {ex!s}") from ex
raise UpdateFailed(
translation_domain=DOMAIN, translation_key="api_error"
) from ex
def webhook_received(self, message: dict[str, Any]) -> None:
"""Handle webhook message."""

View File

@ -13,6 +13,8 @@ from .const import DOMAIN
from .coordinator import TedeeApiCoordinator, TedeeConfigEntry
from .entity import TedeeEntity
PARALLEL_UPDATES = 1
async def async_setup_entry(
hass: HomeAssistant,

View File

@ -66,12 +66,21 @@
}
},
"exceptions": {
"api_error": {
"message": "Error while communicating with the API"
},
"authentication_failed": {
"message": "Authentication failed. Local access token is invalid"
},
"lock_failed": {
"message": "Failed to lock the door. Lock {lock_id}"
},
"unlock_failed": {
"message": "Failed to unlock the door. Lock {lock_id}"
},
"update_failed": {
"message": "Error while updating data"
},
"open_failed": {
"message": "Failed to unlatch the door. Lock {lock_id}"
}