First, create the following folder
📂BP
└📄manifest.json
└📚pack_icon.png
└📂functions
└📄wake_with_owner.mcfunction
Enter your command in wake_with_owner.mcfunction
example: summon ender_crystal
Then enable the addon you created and use the block with wake_with_owner.mcfunction.
And if you perform a certain action, you can execute the wake_with_owner.mcfunction.