I have an Adafruit Feather ESP32 whose GPIOs I use to control an external device. I don't want the device to drain the power of the ESP32 sometimes, so I set the GPIOs to INPUT. When I go into deep sleep though, the GPIOs suddenly get some random voltages and start drawing power. A few GPIOs are 3.3V, others are 0.7V, and some are near 0V.
What is the correct/standard way to make the microcontroller not leak any power to that external device. One way is obviously physically disconnecting that device, but I want an automated way. Is it solvable by software or do I need special hardware to achieve my goal?