I did it on mine. You can use ‘battery level’ state. Set it between 80-100% for example.
I think I’ve share mine tasker project somewhere in my comment quite awhile ago. anyway, if you want you can DM me.
edit: it’s not totally automatic. Need to manually unplug once reaching the level.
If you just need add-free feature why do you need to pay for monthly subscription? I thought for ad-free feature, we only need to pay for one-off payment.