You say above that the phone need to be plugged in.Doesn’t it also work whilst attached to a magsafe charging stand?
4 Ways to Fix StandBy Mode Not Working on iPhone
Is the StandBy mode not working on iPhone running iOS 17? Here are all the seven ways using which you can fix the issue!