Turn off a switch after it has been on for a while

Is there an app that will turn off a switch after it has been on for a time period? I want an app that will always turn off a light, if it has been on for 20 minutes or so.

It would be easy to write one, but I didn’t know if there was one already and I just shouldn’t find it.

Thanks,

“Power Allowance” will do exactly what you describe.

Thanks, exactly what I needed.