ESP32S3 Battery charger automatic

Check which PMIC your board uses, if any.
If it’s bare TP4056, it won’t support auto power switching.
Try a dev board with proper PMIC (like IP5306 or BQ24074).