Add multiple sensors with one config entry

I build a custom component, but I can’t figure out how to setup platforms multiple times. (for every “device”)

When I run this only one device gets created and every other one gets a ValueError: Config entry has already been setup! Can somebody help me with this?

Here is my code:

def handle_asterisk_event(event, manager, hass, entry):"event.headers: " + json.dumps(event.headers))"ObjectName: " + event.get_header("ObjectName"))
    _extension = event.get_header("ObjectName")[DOMAIN][entry.entry_id] = _extension
    hass.config_entries.async_setup_platforms(entry, PLATFORMS)


async def async_setup_entry(hass, entry, async_add_devices):
    """Setting up every extension."""
    extension =[DOMAIN][entry.entry_id]
    entry_id = entry.entry_id
    _LOGGER.warning(f"Setting up asterisk extension device for extension {extension}")
    async_add_devices([AsteriskExtension(hass, extension, entry_id)], True)

This function is being called for every device I want to set up.

Thanks for helping. :slight_smile: