Can you create sub devices programmatically or conditionally?

I’m implementing an app to control my thermostats. The thermostats are accessed via a single Zigbee module. The module exposes each thermostat on a specific endpoint. I implemented the first thermostat and I’m now looking into supporting the others. The only way it seems possible is to add them as subdevices in the driver.compose.json

{
  "name": {
    "en": "Danfoss Icon Zigbee Module"
  },
  "class": "other",
  "capabilities": [],
  "platforms": ["local"],
  "connectivity": ["zigbee"],
  "zigbee": {
    "manufacturerName": "Danfoss",
    "productId": ["0x0200", "0x8020"],
    "endpoints": {
      "1": {
        "clusters": [513],
        "bindings": [513]
      },
      "2": {
        "clusters": [513],
        "bindings": [513]
      },
      "3": {
        "clusters": [513],
        "bindings": [513]
      },
      "4": {
        "clusters": [513],
        "bindings": [513]
      }
    },
    "devices": {
      "thermostat1": {
        "class": "thermostat",
        "capabilities": ["measure_temperature", "target_temperature"],
        "name": { "en": "Thermostat 1" },
        "settings": []
      },
      "thermostat2": {
        "class": "thermostat",
        "capabilities": ["measure_temperature", "target_temperature"],
        "name": { "en": "Thermostat 2" },
        "settings": []
      },
      "thermostat3": {
        "class": "thermostat",
        "capabilities": ["measure_temperature", "target_temperature"],
        "name": { "en": "Thermostat 3" },
        "settings": []
      },
      "thermostat4": {
        "class": "thermostat",
        "capabilities": ["measure_temperature", "target_temperature"],
        "name": { "en": "Thermostat 4" },
        "settings": []
      }
    }
  },
  "images": {
    "large": "/drivers/updown_remote_control/assets/images/large.png",
    "small": "/drivers/updown_remote_control/assets/images/small.png"
  }
}

Based on the subDeviceId in device.js I can link the correct endpoint id to each device. Which allows me to control all the thermostats for which an endpoint is available. However, in my case I only have 3 (the 4th thermostat in driver.compose.json is for testing purposes). But there can be up to 15 thermostats.

I can do this by adding 15 devices in the devices key in driver.compose.json. But this also makes them all available after pairing in the devices list in the Homey app. Ideally I want to check the amount of available endpointIds and create a matching amount of devices .

I can lookup the available endpoints via zclNode in device.js. But I don’t think there is any way to exclude or destroy a device within device.js. this.destroy() only seems to destroy the instance but the thermostat is still available in the devices list in Homey app.

I wonder if there is a way to create/destroy devices programmatically or conditionally.