diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index 4830ec602a7..3442d613bc4 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -1620,7 +1620,7 @@ class ConfigFlow(data_entry_flow.FlowHandler): return await self._async_step_discovery_without_unique_id() @callback - def async_create_entry( + def async_create_entry( # type: ignore[override] self, *, title: str, diff --git a/homeassistant/data_entry_flow.py b/homeassistant/data_entry_flow.py index 866f1a5db2f..d4c8a0db4e3 100644 --- a/homeassistant/data_entry_flow.py +++ b/homeassistant/data_entry_flow.py @@ -84,27 +84,27 @@ class AbortFlow(FlowError): class FlowResult(TypedDict, total=False): """Typed result dict.""" - version: int - type: FlowResultType + context: dict[str, Any] + data_schema: vol.Schema | None + data: Mapping[str, Any] + description_placeholders: Mapping[str, str | None] | None + description: str | None + errors: dict[str, str] | None + extra: str flow_id: str handler: str - title: str - data: Mapping[str, Any] - step_id: str - data_schema: vol.Schema | None - extra: str - required: bool - errors: dict[str, str] | None - description: str | None - description_placeholders: Mapping[str, str | None] | None - progress_action: str - url: str - reason: str - context: dict[str, Any] - result: Any last_step: bool | None - options: Mapping[str, Any] menu_options: list[str] | dict[str, str] + options: Mapping[str, Any] + progress_action: str + reason: str + required: bool + result: Any + step_id: str + title: str + type: FlowResultType + url: str + version: int @callback @@ -498,23 +498,25 @@ class FlowHandler: def async_create_entry( self, *, - title: str, + title: str | None = None, data: Mapping[str, Any], description: str | None = None, description_placeholders: Mapping[str, str] | None = None, ) -> FlowResult: """Finish config flow and create a config entry.""" - return FlowResult( + flow_result = FlowResult( version=self.VERSION, type=FlowResultType.CREATE_ENTRY, flow_id=self.flow_id, handler=self.handler, - title=title, data=data, description=description, description_placeholders=description_placeholders, context=self.context, ) + if title is not None: + flow_result["title"] = title + return flow_result @callback def async_abort( diff --git a/homeassistant/helpers/schema_config_entry_flow.py b/homeassistant/helpers/schema_config_entry_flow.py index 9ea61c19c6c..4e319b20cb6 100644 --- a/homeassistant/helpers/schema_config_entry_flow.py +++ b/homeassistant/helpers/schema_config_entry_flow.py @@ -401,7 +401,7 @@ class SchemaOptionsFlowHandler(config_entries.OptionsFlowWithConfigEntry): """Finish config flow and create a config entry.""" if self._async_options_flow_finished: self._async_options_flow_finished(self.hass, data) - return super().async_create_entry(title="", data=data, **kwargs) + return super().async_create_entry(data=data, **kwargs) @callback diff --git a/tests/components/aurora/test_config_flow.py b/tests/components/aurora/test_config_flow.py index f106b19cea9..8d2c6054a21 100644 --- a/tests/components/aurora/test_config_flow.py +++ b/tests/components/aurora/test_config_flow.py @@ -110,5 +110,4 @@ async def test_option_flow(hass): ) assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY - assert result["title"] == "" assert result["data"]["forecast_threshold"] == 65 diff --git a/tests/components/ovo_energy/test_config_flow.py b/tests/components/ovo_energy/test_config_flow.py index 5fbd4586d12..1e9a0672473 100644 --- a/tests/components/ovo_energy/test_config_flow.py +++ b/tests/components/ovo_energy/test_config_flow.py @@ -84,6 +84,9 @@ async def test_full_flow_implementation(hass: HomeAssistant) -> None: with patch( "homeassistant.components.ovo_energy.config_flow.OVOEnergy.authenticate", return_value=True, + ), patch( + "homeassistant.components.ovo_energy.config_flow.OVOEnergy.username", + "some_name", ), patch( "homeassistant.components.ovo_energy.async_setup_entry", return_value=True, diff --git a/tests/components/venstar/__init__.py b/tests/components/venstar/__init__.py index c7b4815c5bb..fa35dd88379 100644 --- a/tests/components/venstar/__init__.py +++ b/tests/components/venstar/__init__.py @@ -43,6 +43,7 @@ class VenstarColorTouchMock: def update_info(self): """Mock update_info.""" + self.name = "username" return True def broken_update_info(self):