Wallmount tablet charger smart plug automation or template

What is the best way to automate the smart switch for a charger for a wall mounted tablet? Normally I would have an automation that turns on the smart plug when the battery level is down to 15% and another automation that turns off the smart plug when the battery reaches 100%. Is there a more efficient way so that I don’t have two separate automations?

Bit late to the party - but this template does it very well. Full credit to the creator ( seamus65

Wallpanel Battery Management - Blueprints Exchange - Home Assistant Community (home-assistant.io)