Automation combined with active profile

I’m wondering if you can activate an automation when a profile is set.
I don’t care if I’m at home and the door opens, but if I’m away I would like the automation to record with the cameras.
So kinda bind the automation to a profile (if home do nothing; if away record through automation when door opens)