This commit is contained in:
Erik 2025-07-21 21:15:09 +02:00
parent 3c22b3f676
commit 8842f7a421
4 changed files with 4 additions and 2 deletions

View File

@ -36,7 +36,7 @@ class AuthFlowContext(FlowContext, total=False):
class AuthFlowResult(FlowResult[AuthFlowContext, tuple[str, str]], total=False):
"""Typed result dict for auth flow."""
result: Credentials
result: Credentials # Only present if type is CREATE_ENTRY
@attr.s(slots=True)

View File

@ -281,6 +281,7 @@ class LoginFlowBaseView(HomeAssistantView):
)
process_success_login(request)
# We overwrite the Credentials object with the string code to retrieve it.
result["result"] = self._store_result(client_id, result_obj) # type: ignore[typeddict-item]
return self.json(result)

View File

@ -146,8 +146,8 @@ def _prepare_config_flow_result_json(
return prepare_result_json(result)
data = result.copy()
# FlowManagerIndexView should be a generic class
entry: config_entries.ConfigEntry = data["result"] # type: ignore[typeddict-item]
# We overwrite the ConfigEntry object with its json representation.
data["result"] = entry.as_json_fragment # type: ignore[typeddict-unknown-key]
data.pop("data")
data.pop("context")

View File

@ -298,6 +298,7 @@ class ConfigFlowContext(FlowContext, total=False):
class ConfigFlowResult(FlowResult[ConfigFlowContext, str], total=False):
"""Typed result dict for config flow."""
# Extra keys, only present if type is CREATE_ENTRY
minor_version: int
options: Mapping[str, Any]
result: ConfigEntry