mirror of
https://github.com/Electric-Special/ha-core.git
synced 2026-03-21 06:05:26 +01:00
Fix translation of unknown response in Teslemetry & Tesla Fleet (#160506)
This commit is contained in:
@@ -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"):
|
||||
|
||||
@@ -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}"
|
||||
},
|
||||
|
||||
@@ -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"):
|
||||
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user