About the only way of doing that without opening the phone (which I strongly suggest that you not do) is to not charge it (which I also recommend that you don't do). Why don't you join the Android Central community so that you can keep the conversation here, and tell us what is that you're trying to accomplish by disabling the battery? (Other than shortening the battery's life, there's probably a better way of doing what you want.)
It's it possible the OP is wanting to disable the fully charged notification, or simply not charge to full? For the former, I'm not sure if that's possible. For the latter, you'd have to just unplug it sooner (an app like AccuBattery can help with that).
GSam has settable alarms for low below% and above%, and selectable notification tones for them.
But rooting with Magisk is even better - you can run Magisk Charging Switch and set the maximum charge amount (even with the charger plugged in it won't charge until it reaches the minimum current you set it to start charging at). So you can run really safe - 80 40, you can keep the charge at almost a single point, say 75%, or you can destroy the battery by setting it to 100 0 (not using it at all). But if you don't want to walk around with a long charging cable, MCS and GSam make it easy - plug it in and unplug it when you think about it, but if it discharges too far when it's not plugged in, GSam reminds you.