Create derived entities based on match rules

I have a number of sensors which expose humidity and temperature.

For each of these, I would like to create an associated entity using (for example) the Mold Risk Index integration (GitHub - Strixx76/mold_risk_index: Calculate the level of risk of mold growth in a crawl space.) . There are also other useful derived entities (eg GitHub - dolezsa/thermal_comfort: Thermal Comfort sensor for HA (absolute humidity, heat index, dew point, thermal perception)).

For each of these I need to manually add and configure the integration one by one for each of the sensors. Is it possible to automate this?

I am envisioning either a template loop in a configuration to add all the desired entities, or a match rule against which the integration creates entities.

Is anything like this possible?

You cannot use templating to build active configuration. You can use it to print the configuration for you in the Template editior tool then copy/paste the results into your configuration.

Thanks for the pointer to using a temporary template to generate a yaml snippet. I can use that for thermal_comfort, but unfortunately mold_risk_index gives me an error: "The mold_risk_index integration does not support YAML setup, please remove it from your configuration"

I will look into using the API to create missing entities (but it looks like this is not perfect:

Actually, the API has an undocumented DELETE method: How to remove entities without a unique_id? Where are they? - #24 by fhp, so maybe that could work