Presence sensors.
You’ll have a few different options for setting up presence:
Buy the SmartThings presence sensor for $30 each (you’ll need 2, obviously).
Use your phone (has a fairly large geofence area)
If you have Android, SharpTools is an option: Phone Presence + Tasker + SharpTools = No More Doors Unlocking At Random and also SharpTools Presence
Router with DD-WRT: Presence Detection using DD-WRT Router Script
You can then use these presence detection items to trigger your routines.