Add exception translation for entity action not supported (#131956)

This commit is contained in:
Jan Bouwhuis
2024-12-01 16:53:06 +01:00
committed by GitHub
parent c55a4e9584
commit 3aae9b629f
13 changed files with 98 additions and 31 deletions

View File

@@ -270,6 +270,25 @@ class ServiceNotFound(ServiceValidationError):
self.generate_message = True
class ServiceNotSupported(ServiceValidationError):
"""Raised when an entity action is not supported."""
def __init__(self, domain: str, service: str, entity_id: str) -> None:
"""Initialize ServiceNotSupported exception."""
super().__init__(
translation_domain="homeassistant",
translation_key="service_not_supported",
translation_placeholders={
"domain": domain,
"service": service,
"entity_id": entity_id,
},
)
self.domain = domain
self.service = service
self.generate_message = True
class MaxLengthExceeded(HomeAssistantError):
"""Raised when a property value has exceeded the max character length."""