@@ -3220,7 +3220,7 @@ async def test_subentry_configflow(
32203220 "url" : learn_more_url (component ["platform" ]),
32213221 }
32223222
3223- # Process entity details setep
3223+ # Process entity details step
32243224 assert result ["step_id" ] == "entity_platform_config"
32253225
32263226 # First test validators if set of test
@@ -4212,3 +4212,52 @@ async def test_subentry_reconfigure_availablity(
42124212 "payload_available" : "1" ,
42134213 "payload_not_available" : "0" ,
42144214 }
4215+
4216+
4217+ async def test_subentry_configflow_section_feature (
4218+ hass : HomeAssistant ,
4219+ mqtt_mock_entry : MqttMockHAClientGenerator ,
4220+ ) -> None :
4221+ """Test the subentry ConfigFlow sections are hidden when they have no configurable options."""
4222+ await mqtt_mock_entry ()
4223+ config_entry = hass .config_entries .async_entries (mqtt .DOMAIN )[0 ]
4224+
4225+ result = await hass .config_entries .subentries .async_init (
4226+ (config_entry .entry_id , "device" ),
4227+ context = {"source" : config_entries .SOURCE_USER },
4228+ )
4229+ assert result ["type" ] is FlowResultType .FORM
4230+ assert result ["step_id" ] == "device"
4231+ result = await hass .config_entries .subentries .async_configure (
4232+ result ["flow_id" ],
4233+ user_input = {"name" : "Bla" , "mqtt_settings" : {"qos" : 1 }},
4234+ )
4235+ assert result ["type" ] is FlowResultType .FORM
4236+
4237+ result = await hass .config_entries .subentries .async_configure (
4238+ result ["flow_id" ],
4239+ user_input = {"platform" : "fan" },
4240+ )
4241+ assert result ["type" ] is FlowResultType .FORM
4242+ assert result ["description_placeholders" ] == {
4243+ "mqtt_device" : "Bla" ,
4244+ "platform" : "fan" ,
4245+ "entity" : "Bla" ,
4246+ "url" : learn_more_url ("fan" ),
4247+ }
4248+
4249+ # Process entity details step
4250+ assert result ["step_id" ] == "entity_platform_config"
4251+
4252+ result = await hass .config_entries .subentries .async_configure (
4253+ result ["flow_id" ],
4254+ user_input = {"fan_feature_speed" : True },
4255+ )
4256+ assert result ["type" ] is FlowResultType .FORM
4257+ assert result ["errors" ] == {}
4258+ assert result ["step_id" ] == "mqtt_platform_config"
4259+
4260+ # Check mqtt platform config flow sections from data schema
4261+ data_schema = result ["data_schema" ].schema
4262+ assert "fan_speed_settings" in data_schema
4263+ assert "fan_preset_mode_settings" not in data_schema
0 commit comments