Auto turn off switch for android phone according to battery status
Tasker is exactly what you need.

You can do lots of automation with tasker. App is a bit hard to understand but when you figured it out it has the power of freedom.

Tasker Play Store Link