Add translation to communication exceptions in MotionMount (#126043)
Add translation to communication exceptionspull/126050/head
parent
e85ab067bd
commit
3ba39d5158
|
@ -52,7 +52,10 @@ class MotionMountExtension(MotionMountEntity, NumberEntity):
|
|||
try:
|
||||
await self.mm.set_extension(int(value))
|
||||
except (TimeoutError, socket.gaierror) as ex:
|
||||
raise HomeAssistantError("Failed to communicate with MotionMount") from ex
|
||||
raise HomeAssistantError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="failed_communication",
|
||||
) from ex
|
||||
|
||||
|
||||
class MotionMountTurn(MotionMountEntity, NumberEntity):
|
||||
|
@ -78,4 +81,7 @@ class MotionMountTurn(MotionMountEntity, NumberEntity):
|
|||
try:
|
||||
await self.mm.set_turn(int(value * -1))
|
||||
except (TimeoutError, socket.gaierror) as ex:
|
||||
raise HomeAssistantError("Failed to communicate with MotionMount") from ex
|
||||
raise HomeAssistantError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="failed_communication",
|
||||
) from ex
|
||||
|
|
|
@ -91,6 +91,9 @@ class MotionMountPresets(MotionMountEntity, SelectEntity):
|
|||
try:
|
||||
await self.mm.go_to_preset(index)
|
||||
except (TimeoutError, socket.gaierror) as ex:
|
||||
raise HomeAssistantError("Failed to communicate with MotionMount") from ex
|
||||
raise HomeAssistantError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="failed_communication",
|
||||
) from ex
|
||||
else:
|
||||
self._attr_current_option = option
|
||||
|
|
|
@ -56,5 +56,10 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"exceptions": {
|
||||
"failed_communication": {
|
||||
"message": "Failed to communicate with MotionMount"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue