async def _async_service_create_central_link(hass: HomeAssistant, service: ServiceCall) -> None:
    """Service to create central links for Homematic(IP) Local devices."""
    try:
        if (entry_id := service.data.get(CONF_ENTRY_ID)) is not None and (
            control := _async_get_control_unit(hass=hass, entry_id=entry_id)
        ) is not None:
            await control.central.create_central_links()
        elif hm_device := _async_get_hm_device_by_service_data(hass=hass, service=service):
            await hm_device.create_central_links()
    except BaseHomematicException as ex:
        raise HomeAssistantError(ex) from ex
    _LOGGER.debug("Called create_central_links")
Service to create central links for Homematic(IP) Local devices.
custom_components/homematicip_local/services.py