[DEV] Section in Schema funktioniert nicht

Einen Development Bereich habe ich hier nicht gefunden, hoffe es passt in diese Kategorie.

Es geht darum, dass ich die Konfiguration über die config_flow.py meiner Integration etwas übersichtlich er gestalten möchte. Dazu wollte ich “Section” verwenden.

    async def async_step_init(self, user_input=None):
        """Manage the options."""
        if user_input is not None:
            
            # Ensure that empty fields are stored as empty strings
            for key in [CONF_ONLYLINE, CONF_HIDEDESTINATION, CONF_ONLYDESTINATION, CONF_DOUBLESTATIONNUMBER, 
                        CONF_TIMEZONE_FROM, CONF_TIMEZONE_TO, CONF_ALERT_FOR, CONF_GLOBALID2]:
                if key not in user_input:
                    user_input[key] = ""  # Explicitly set the field to an empty string if it's not in the user_input
            
            # Convert selected transport types to a comma-separated string
            if CONF_TRANSPORTTYPES in user_input:
                user_input[CONF_TRANSPORTTYPES] = ','.join(user_input[CONF_TRANSPORTTYPES])
            
            # Save the updated data self.config_entry, data={**self.config_entry.data, **user_input}
            self.hass.config_entries.async_update_entry(
                self.config_entry, data=user_input
            )
            
            # Reload the integration to apply changes
            await self.hass.config_entries.async_reload(self.config_entry.entry_id)

            return self.async_create_entry(title="", data={})

        # Prepare the default values based on current configuration data
        current_data = self.config_entry.data
        transport_types = DEFAULT_CONF_TRANSPORTTYPES.split(',')
        selected_transport_types = current_data.get(CONF_TRANSPORTTYPES, '').split(',')

        self.options_schema = vol.Schema({
            vol.Required(CONF_NAME, default=current_data.get(CONF_NAME)): str,
            vol.Required(CONF_GLOBALID, default=current_data.get(CONF_GLOBALID)): str,
            vol.Optional(CONF_TRANSPORTTYPES, default=selected_transport_types): selector({
                "select": {
                    "options": transport_types,
                    "multiple": True,
                    "custom_value": True
                }
            }),
            vol.Optional(CONF_LIMIT, default=current_data.get(CONF_LIMIT, DEFAULT_LIMIT)): int,
            vol.Optional(CONF_ONLYLINE,            description={"suggested_value": current_data.get(CONF_ONLYLINE, "")}): str,
            vol.Optional(CONF_HIDEDESTINATION,     description={"suggested_value": current_data.get(CONF_HIDEDESTINATION, "")}): str,
            vol.Optional(CONF_ONLYDESTINATION,     description={"suggested_value": current_data.get(CONF_ONLYDESTINATION, "")}): str,
            # Items can be grouped by collapsible sections
            "advanced_options": section(
                vol.Schema(
				    {
					    vol.Optional(CONF_HIDENAME,            description={"suggested_value": current_data.get(CONF_HIDENAME, "")}): bool,
                        vol.Optional(CONF_GLOBALID2,           description={"suggested_value": current_data.get(CONF_GLOBALID2, "")}): str,
                        vol.Optional(CONF_DOUBLESTATIONNUMBER, description={"suggested_value": current_data.get(CONF_DOUBLESTATIONNUMBER, "")}): str,
                        vol.Optional(CONF_TIMEZONE_FROM,       description={"suggested_value": current_data.get(CONF_TIMEZONE_FROM, "")}): str,
                        vol.Optional(CONF_TIMEZONE_TO,         description={"suggested_value": current_data.get(CONF_TIMEZONE_TO, "")}): str,
                        vol.Optional(CONF_ALERT_FOR,           description={"suggested_value": current_data.get(CONF_ALERT_FOR, "")}): str,
					}
                ),
                # Whether or not the section is initially collapsed (default = False)
                {"collapsed": True},
            )
        })

        return self.async_show_form(
            step_id="init",
            data_schema=self.options_schema
        )

Das Problem ist jetzt, dass alles was der Section zugeordnet ist nicht mehr gespeichert wird. Auch werden die bisher gespeicherten Werte dort nicht angezeigt.

Entferne ich die Section, funktioniert wieder alles.

        self.options_schema = vol.Schema({
            vol.Required(CONF_NAME, default=current_data.get(CONF_NAME)): str,
            vol.Required(CONF_GLOBALID, default=current_data.get(CONF_GLOBALID)): str,
            vol.Optional(CONF_TRANSPORTTYPES, default=selected_transport_types): selector({
                "select": {
                    "options": transport_types,
                    "multiple": True,
                    "custom_value": True
                }
            }),
            vol.Optional(CONF_LIMIT, default=current_data.get(CONF_LIMIT, DEFAULT_LIMIT)): int,
            vol.Optional(CONF_ONLYLINE,            description={"suggested_value": current_data.get(CONF_ONLYLINE, "")}): str,
            vol.Optional(CONF_HIDEDESTINATION,     description={"suggested_value": current_data.get(CONF_HIDEDESTINATION, "")}): str,
            vol.Optional(CONF_ONLYDESTINATION,     description={"suggested_value": current_data.get(CONF_ONLYDESTINATION, "")}): str,
	        vol.Optional(CONF_HIDENAME,            description={"suggested_value": current_data.get(CONF_HIDENAME, "")}): bool,
            vol.Optional(CONF_GLOBALID2,           description={"suggested_value": current_data.get(CONF_GLOBALID2, "")}): str,
            vol.Optional(CONF_DOUBLESTATIONNUMBER, description={"suggested_value": current_data.get(CONF_DOUBLESTATIONNUMBER, "")}): str,
            vol.Optional(CONF_TIMEZONE_FROM,       description={"suggested_value": current_data.get(CONF_TIMEZONE_FROM, "")}): str,
            vol.Optional(CONF_TIMEZONE_TO,         description={"suggested_value": current_data.get(CONF_TIMEZONE_TO, "")}): str,
            vol.Optional(CONF_ALERT_FOR,           description={"suggested_value": current_data.get(CONF_ALERT_FOR, "")}): str,
        })