Skip to content

Commit

Permalink
Add parallel updates & exception translations to tedee (#131146)
Browse files Browse the repository at this point in the history
  • Loading branch information
zweckj authored Nov 22, 2024
1 parent e2183a8 commit 60e1996
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
11 changes: 8 additions & 3 deletions homeassistant/components/tedee/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,19 @@ async def _async_update(self, update_fn: Callable[[], Awaitable[None]]) -> None:
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."""
Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/tedee/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from .coordinator import TedeeApiCoordinator, TedeeConfigEntry
from .entity import TedeeEntity

PARALLEL_UPDATES = 1


async def async_setup_entry(
hass: HomeAssistant,
Expand Down
9 changes: 9 additions & 0 deletions homeassistant/components/tedee/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
Expand Down

0 comments on commit 60e1996

Please sign in to comment.