Automation trigger depending on time since home

I have a door sensor and would like to trigger different things depending if someone is leaving or coming home. I have a device tracker.

  1. Device just came home and door opens
  2. All devices were at home for at least 10 minutes and door opens

I saw the for option, but that seems to only apply to the same trigger and not another entity

You have to create 2 seperate automations for this. Use a condition to check if group.all_devices is home for at least 10 minutes.