mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Add translation to communication exceptions in MotionMount (#126043)
Add translation to communication exceptions
This commit is contained in:
parent
e85ab067bd
commit
3ba39d5158
@ -52,7 +52,10 @@ class MotionMountExtension(MotionMountEntity, NumberEntity):
|
|||||||
try:
|
try:
|
||||||
await self.mm.set_extension(int(value))
|
await self.mm.set_extension(int(value))
|
||||||
except (TimeoutError, socket.gaierror) as ex:
|
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):
|
class MotionMountTurn(MotionMountEntity, NumberEntity):
|
||||||
@ -78,4 +81,7 @@ class MotionMountTurn(MotionMountEntity, NumberEntity):
|
|||||||
try:
|
try:
|
||||||
await self.mm.set_turn(int(value * -1))
|
await self.mm.set_turn(int(value * -1))
|
||||||
except (TimeoutError, socket.gaierror) as ex:
|
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:
|
try:
|
||||||
await self.mm.go_to_preset(index)
|
await self.mm.go_to_preset(index)
|
||||||
except (TimeoutError, socket.gaierror) as ex:
|
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:
|
else:
|
||||||
self._attr_current_option = option
|
self._attr_current_option = option
|
||||||
|
@ -56,5 +56,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"exceptions": {
|
||||||
|
"failed_communication": {
|
||||||
|
"message": "Failed to communicate with MotionMount"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user