diff --git a/homeassistant/components/otp/config_flow.py b/homeassistant/components/otp/config_flow.py index 7777b9b733a271..5b1551b1d04410 100644 --- a/homeassistant/components/otp/config_flow.py +++ b/homeassistant/components/otp/config_flow.py @@ -41,7 +41,7 @@ async def async_step_user( pyotp.TOTP(user_input[CONF_TOKEN]).now ) except binascii.Error: - errors["base"] = "invalid_code" + errors["base"] = "invalid_token" except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/tests/components/otp/test_config_flow.py b/tests/components/otp/test_config_flow.py index b0bd3e915bd866..c9fdcdb0fefcd8 100644 --- a/tests/components/otp/test_config_flow.py +++ b/tests/components/otp/test_config_flow.py @@ -42,7 +42,7 @@ async def test_form(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: @pytest.mark.parametrize( ("exception", "error"), [ - (binascii.Error, "invalid_code"), + (binascii.Error, "invalid_token"), (IndexError, "unknown"), ], )