Lock password required after some time of not using it Unlocking my phone every time gets a bit annoying, but I still want the phone to be locked for security purposes.

Is there a way for the phone to ask me for my passcode only if I haven't used the phone for longer than say 30 minutes?

This way if my phone is lost it will still have the password protection, and when I am using my phone in short spurts it won't force me to enter the password.

Nexus 6p
Android 7 Nougat
All  of what you need can be done on Native android; No apps or root required. Go into your settings, Display, and Set 'Sleep' To 30 Minutes of inactivity.

Then, go into the Lock screen/security settings, and untick 'Power button instantly locks device'

Now, even though hitting the power button turns the screen off, it won't lock, and if you leave the phone to it, it will lock and turn off after 30 mins.

As Ethan Said, you can also adjust how long after the screen turning off the phone locks, then just disable lock on power button as before.