Fix translation of unknown response in Teslemetry & Tesla Fleet (#160506)

This commit is contained in:
Brett Adams
2026-01-09 19:16:00 +10:00
committed by GitHub
parent fc468b56c8
commit d3161d8e92
4 changed files with 12 additions and 2 deletions

View File

@@ -59,7 +59,9 @@ async def handle_vehicle_command(command: Awaitable) -> bool:
translation_placeholders={"error": error},
)
# No response without error (unexpected)
raise HomeAssistantError(f"Unknown response: {response}")
raise HomeAssistantError(
translation_domain=DOMAIN, translation_key="command_no_response"
)
if (result := response.get("result")) is not True:
if reason := response.get("reason"):
if reason in ("already_set", "not_charging", "requested"):

View File

@@ -593,6 +593,9 @@
"command_no_reason": {
"message": "Command was unsuccessful but did not return a reason why."
},
"command_no_response": {
"message": "Command had no response"
},
"command_reason": {
"message": "Command was unsuccessful: {reason}"
},

View File

@@ -48,7 +48,9 @@ async def handle_vehicle_command(command) -> Any:
translation_placeholders={"error": error},
)
# No response without error (unexpected)
raise HomeAssistantError(f"Unknown response: {response}")
raise HomeAssistantError(
translation_domain=DOMAIN, translation_key="command_no_response"
)
if (result := response.get("result")) is not True:
if reason := response.get("reason"):
if reason in ("already_set", "not_charging", "requested"):

View File

@@ -1097,6 +1097,9 @@
"command_exception": {
"message": "Command returned exception: {message}"
},
"command_no_response": {
"message": "Command had no response"
},
"command_no_result": {
"message": "Command had no result"
},