From 8842f7a421814aa8160e3c0ab1d67963f276666d Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 21 Jul 2025 21:15:09 +0200 Subject: [PATCH] Adjust --- homeassistant/auth/models.py | 2 +- homeassistant/components/auth/login_flow.py | 1 + homeassistant/components/config/config_entries.py | 2 +- homeassistant/config_entries.py | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/auth/models.py b/homeassistant/auth/models.py index 380e85a65b4..f92ed38ad85 100644 --- a/homeassistant/auth/models.py +++ b/homeassistant/auth/models.py @@ -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) diff --git a/homeassistant/components/auth/login_flow.py b/homeassistant/components/auth/login_flow.py index 9408d9ba5ec..fe7ccededf2 100644 --- a/homeassistant/components/auth/login_flow.py +++ b/homeassistant/components/auth/login_flow.py @@ -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) diff --git a/homeassistant/components/config/config_entries.py b/homeassistant/components/config/config_entries.py index 8c067ba7a56..a9aafcfaa5e 100644 --- a/homeassistant/components/config/config_entries.py +++ b/homeassistant/components/config/config_entries.py @@ -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") diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index eb288df8aac..3deeafb83b1 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -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