diff --git a/homeassistant/components/mqtt/config_flow.py b/homeassistant/components/mqtt/config_flow.py index 5e5b8c54cf2..11f9a397823 100644 --- a/homeassistant/components/mqtt/config_flow.py +++ b/homeassistant/components/mqtt/config_flow.py @@ -158,7 +158,7 @@ class MQTTOptionsFlowHandler(config_entries.OptionsFlow): return await self.async_step_broker() async def async_step_broker(self, user_input=None): - """Manage the MQTT options.""" + """Manage the MQTT broker configuration.""" errors = {} current_config = self.config_entry.data yaml_config = self.hass.data.get(DATA_MQTT_CONFIG, {}) @@ -201,6 +201,7 @@ class MQTTOptionsFlowHandler(config_entries.OptionsFlow): step_id="broker", data_schema=vol.Schema(fields), errors=errors, + last_step=False, ) async def async_step_options(self, user_input=None): @@ -321,6 +322,7 @@ class MQTTOptionsFlowHandler(config_entries.OptionsFlow): step_id="options", data_schema=vol.Schema(fields), errors=errors, + last_step=True, ) diff --git a/homeassistant/data_entry_flow.py b/homeassistant/data_entry_flow.py index b75d956c527..a43f3035426 100644 --- a/homeassistant/data_entry_flow.py +++ b/homeassistant/data_entry_flow.py @@ -72,6 +72,7 @@ class FlowResultDict(TypedDict, total=False): reason: str context: dict[str, Any] result: Any + last_step: bool | None class FlowManager(abc.ABC): @@ -345,6 +346,7 @@ class FlowHandler: data_schema: vol.Schema = None, errors: dict[str, str] | None = None, description_placeholders: dict[str, Any] | None = None, + last_step: bool | None = None, ) -> FlowResultDict: """Return the definition of a form to gather user input.""" return { @@ -355,6 +357,7 @@ class FlowHandler: "data_schema": data_schema, "errors": errors, "description_placeholders": description_placeholders, + "last_step": last_step, # Display next or submit button in frontend } @callback diff --git a/tests/components/config/test_config_entries.py b/tests/components/config/test_config_entries.py index 4b8155b6513..abad057b64c 100644 --- a/tests/components/config/test_config_entries.py +++ b/tests/components/config/test_config_entries.py @@ -239,6 +239,7 @@ async def test_initialize_flow(hass, client): "show_advanced_options": True, }, "errors": {"username": "Should be unique."}, + "last_step": None, } @@ -375,6 +376,7 @@ async def test_two_step_flow(hass, client): "data_schema": [{"name": "user_title", "type": "string"}], "description_placeholders": None, "errors": None, + "last_step": None, } with patch.dict(HANDLERS, {"test": TestFlow}): @@ -445,6 +447,7 @@ async def test_continue_flow_unauth(hass, client, hass_admin_user): "data_schema": [{"name": "user_title", "type": "string"}], "description_placeholders": None, "errors": None, + "last_step": None, } hass_admin_user.groups = [] @@ -612,6 +615,7 @@ async def test_options_flow(hass, client): "data_schema": [{"name": "enabled", "required": True, "type": "boolean"}], "description_placeholders": {"enabled": "Set to true to be true"}, "errors": None, + "last_step": None, } @@ -660,6 +664,7 @@ async def test_two_step_options_flow(hass, client): "data_schema": [{"name": "enabled", "type": "boolean"}], "description_placeholders": None, "errors": None, + "last_step": None, } with patch.dict(HANDLERS, {"test": TestFlow}): diff --git a/tests/components/subaru/test_config_flow.py b/tests/components/subaru/test_config_flow.py index 35e254fe302..031b9c29d09 100644 --- a/tests/components/subaru/test_config_flow.py +++ b/tests/components/subaru/test_config_flow.py @@ -131,6 +131,7 @@ async def test_pin_form_init(pin_form): "handler": DOMAIN, "step_id": "pin", "type": "form", + "last_step": None, } assert pin_form == expected