Get my rasberry pi 3 to shut off automaticly

I almost always fall asleep in front of my TV. Are there any way to get the screen to shut off after like 10 minutes when idleing?

Leave the pi on. It was designed to run 24/7. Just set the sleep timer on your TV.

service.sleeptimer http://forum.kodi.tv/showthread.php?tid=211971 It’s installable straight from the official Kodi repository. It’s under the Services category. You could have it activate the builtin Dim screensaver or if you really insist on having the Raspberry Pi shutdown(which isn’t necessary as ActionA pointed out) you could select the custom command option and input this:
sudo shutdown -h now

Exactly what I was looking for, thanks!