I haven't had any luck running any of the phones I've had open like that (a Redmi 9T and a few Sony phones), but it's worth a try.
You can probably solder the wires from a suitable power adapter to the internal battery connector pins if your phone still uses those, though you may also need a resistor in-line somewhere to trick it into thinking there's a healthy battery installed.
Make sure you get a proper adapter for the task if you go down this route. Some people recommend just chopping up a phone charger, but putting 5V on a circuit that expects ~4.3V at max sounds like a bad idea to me.
...that's a thought. Now I'm wondering if I could scavenge a smart power plug/strip somewhere and do a bit of programming to automate things that way. A project for later, maybe -- ended up picking up a few old webcams and they're doing the job so far.