diff --git a/homeassistant/components/voip/config_flow.py b/homeassistant/components/voip/config_flow.py index 3c370735a764f7..6c831aaa1bb785 100644 --- a/homeassistant/components/voip/config_flow.py +++ b/homeassistant/components/voip/config_flow.py @@ -16,7 +16,7 @@ from homeassistant.core import callback from homeassistant.helpers import config_validation as cv -from .const import CONF_SIP_PORT, CONF_SIP_USER, DEFAULT_SIP_USER, DOMAIN +from .const import CONF_SIP_PORT, CONF_SIP_USER, DOMAIN class VoIPConfigFlow(ConfigFlow, domain=DOMAIN): @@ -58,9 +58,6 @@ async def async_step_init( ) -> ConfigFlowResult: """Manage the options.""" if user_input is not None: - if "enable_advanced" in user_input: - return await self.async_step_advanced() - return self.async_create_entry(title="", data=user_input) return self.async_show_form( @@ -74,34 +71,12 @@ async def async_step_init( SIP_PORT, ), ): cv.port, - vol.Optional("enable_advanced"): bool, - } - ), - description_placeholders={ - "note": "Enable advanced options by checking the box.", - }, - ) - - async def async_step_advanced( - self, user_input: dict[str, Any] | None = None - ) -> ConfigFlowResult: - """Manage the advanced options.""" - if user_input is not None: - return self.async_create_entry( - title="", data={**self.config_entry.options, **user_input} - ) - - return self.async_show_form( - step_id="advanced", - data_schema=vol.Schema( - { vol.Optional( CONF_SIP_USER, default=self.config_entry.options.get( CONF_SIP_USER, - DEFAULT_SIP_USER, ), - ): str, + ): vol.Any(None, cv.string), } ), ) diff --git a/homeassistant/components/voip/const.py b/homeassistant/components/voip/const.py index 0dbee798a4599b..9a4403f9df2c58 100644 --- a/homeassistant/components/voip/const.py +++ b/homeassistant/components/voip/const.py @@ -12,7 +12,5 @@ "sleep_ratio": 0.99, } -DEFAULT_SIP_USER = "HA" - CONF_SIP_PORT = "sip_port" CONF_SIP_USER = "sip_user" diff --git a/homeassistant/components/voip/strings.json b/homeassistant/components/voip/strings.json index c25c22f3f80363..96c902bf39a159 100644 --- a/homeassistant/components/voip/strings.json +++ b/homeassistant/components/voip/strings.json @@ -53,7 +53,8 @@ "step": { "init": { "data": { - "sip_port": "SIP port" + "sip_port": "SIP port", + "sip_user": "SIP user" } } } diff --git a/tests/components/voip/test_config_flow.py b/tests/components/voip/test_config_flow.py index f6cfccb7dbd028..b343a9bbfc5bd9 100644 --- a/tests/components/voip/test_config_flow.py +++ b/tests/components/voip/test_config_flow.py @@ -68,7 +68,7 @@ async def test_options_flow(hass: HomeAssistant) -> None: user_input={}, ) assert result["type"] is FlowResultType.CREATE_ENTRY - assert config_entry.options == {"sip_port": 5060} + assert config_entry.options == {"sip_port": 5060, "sip_user": None} # Manual result = await hass.config_entries.options.async_init( @@ -79,36 +79,15 @@ async def test_options_flow(hass: HomeAssistant) -> None: user_input={"sip_port": 5061}, ) assert result["type"] is FlowResultType.CREATE_ENTRY - assert config_entry.options == {"sip_port": 5061} + assert config_entry.options == {"sip_port": 5061, "sip_user": None} - # Manual with advanced options default user + # Manual with user result = await hass.config_entries.options.async_init( config_entry.entry_id, ) result = await hass.config_entries.options.async_configure( result["flow_id"], - user_input={"sip_port": 5061, "enable_advanced": True}, - ) - assert result["type"] is FlowResultType.FORM - result = await hass.config_entries.options.async_configure( - result["flow_id"], - user_input={}, + user_input={"sip_port": 5061, "sip_user": "HA"}, ) assert result["type"] is FlowResultType.CREATE_ENTRY assert config_entry.options == {"sip_port": 5061, "sip_user": "HA"} - - # Manual with advanced options - result = await hass.config_entries.options.async_init( - config_entry.entry_id, - ) - result = await hass.config_entries.options.async_configure( - result["flow_id"], - user_input={"sip_port": 5061, "enable_advanced": True}, - ) - assert result["type"] is FlowResultType.FORM - result = await hass.config_entries.options.async_configure( - result["flow_id"], - user_input={"sip_user": "test"}, - ) - assert result["type"] is FlowResultType.CREATE_ENTRY - assert config_entry.options == {"sip_port": 5061, "sip_user": "test"}