Smart Plug

GPIO control for external relay integration

Smart Plug

PwnPower includes GPIO control for hardware integration with relays, smart plugs, or other external devices.

GPIO Pin

The smart plug feature controls GPIO4 on the ESP32-C3.

Controls

ActionEffect
Turn OnSets GPIO4 HIGH (3.3V)
Turn OffSets GPIO4 LOW (0V)

Use Cases

  • Control a relay module to switch AC power
  • Toggle indicator LEDs
  • Trigger external circuits based on web interface commands
  • Integration with home automation systems

API Access

Control the GPIO programmatically:

POST /gpio
{"pin": 4, "value": 1}  // Turn on
{"pin": 4, "value": 0}  // Turn off

GET /gpio/status?pin=4
{"pin": 4, "level": 1}

Note: The GPIO state does not persist across reboots. The pin defaults to LOW on power-up.