diff --git a/homeassistant/components/tesla_fleet/helpers.py b/homeassistant/components/tesla_fleet/helpers.py index 28f388fd83d..4c67929e93c 100644 --- a/homeassistant/components/tesla_fleet/helpers.py +++ b/homeassistant/components/tesla_fleet/helpers.py @@ -24,12 +24,18 @@ async def wake_up_vehicle(vehicle: TeslaFleetVehicleData) -> None: cmd = await vehicle.api.vehicle() state = cmd["response"]["state"] except TeslaFleetError as e: - raise HomeAssistantError(str(e)) from e + raise HomeAssistantError( + translation_domain=DOMAIN, + translation_key="wake_up_failed", + ) from e vehicle.coordinator.data["state"] = state if state != TeslaFleetState.ONLINE: times += 1 if times >= 4: # Give up after 30 seconds total - raise HomeAssistantError("Could not wake up vehicle") + raise HomeAssistantError( + translation_domain=DOMAIN, + translation_key="wake_up_timeout", + ) await asyncio.sleep(times * 5) diff --git a/homeassistant/components/tesla_fleet/strings.json b/homeassistant/components/tesla_fleet/strings.json index ed14294b3ea..5b4399d13f7 100644 --- a/homeassistant/components/tesla_fleet/strings.json +++ b/homeassistant/components/tesla_fleet/strings.json @@ -30,6 +30,9 @@ "data": { "domain": "Domain" }, + "data_description": { + "domain": "The domain that hosts your public key for Tesla Fleet API authentication." + }, "description": "Enter the domain that will host your public key. This is typically the domain of the origin you specified during registration at {dashboard}.", "title": "Tesla Fleet domain registration" }, @@ -51,6 +54,12 @@ "title": "[%key:common::config_flow::title::reauth%]" }, "registration_complete": { + "data": { + "qr_code": "QR code" + }, + "data_description": { + "qr_code": "Scan this QR code with your phone to set up the virtual key." + }, "description": "To enable command signing, you must open the Tesla app, select your vehicle, and then visit the following URL to set up a virtual key. You must repeat this process for each vehicle.\n\n{virtual_key_url}", "title": "Command signing" } @@ -623,6 +632,12 @@ }, "update_failed": { "message": "{endpoint} data request failed: {message}" + }, + "wake_up_failed": { + "message": "Failed to wake up vehicle" + }, + "wake_up_timeout": { + "message": "Could not wake up vehicle" } } } diff --git a/tests/components/tesla_fleet/test_climate.py b/tests/components/tesla_fleet/test_climate.py index 49d9f48a841..2746169f5cb 100644 --- a/tests/components/tesla_fleet/test_climate.py +++ b/tests/components/tesla_fleet/test_climate.py @@ -348,7 +348,8 @@ async def test_asleep_or_offline( # Run a command but fail trying to wake up the vehicle mock_wake_up.side_effect = InvalidCommand with pytest.raises( - HomeAssistantError, match="The data request or command is unknown." + HomeAssistantError, + match="Failed to wake up vehicle", ): await hass.services.async_call( CLIMATE_DOMAIN,