Remotely power on, power off, and monitor desktop PCs over Wi-Fi.
WirelessPowerSwitch is a small home-lab project made of two parts:
- Firmware for an ESP-01S (ESP8266) module that wires into a PC's front-panel headers and exposes a tiny HTTP API to simulate the power button and read the power LED.
- A JavaFX desktop application that talks to one or more of these modules, letting you start, stop, and monitor several PCs from a single dashboard.
- Overview
- Features
- How It Works
- Repository Structure
- Hardware & PCB
- Firmware Setup
- GUI Setup
- Building & Running from the Command Line
- Configuration
- HTTP API Reference
- Security Considerations
- Screenshots
- Tech Stack
Many desktops don't offer any built-in way to be turned on remotely (no Wake-on-LAN support, BIOS setting disabled, etc.), and a hard shutdown is sometimes needed for an unresponsive machine. WirelessPowerSwitch solves this with a small, cheap ESP8266 module wired directly to the motherboard's front-panel connector, controlled over the local network through a simple authenticated HTTP API and a friendly desktop GUI.
- Remote power on/off — simulates a normal front-panel button press.
- Forced shutdown — simulates a long button press (~6 seconds) to force off an unresponsive PC.
- Live status polling — reads the PC's power LED to report on/off state.
- Multi-PC dashboard — manage any number of PCs from one GUI, each as its own card.
- Shared-secret authentication — power actions require a matching SHA-256 key.
┌────────────────────┐ HTTP (port 60000) ┌───────────────────────┐
│ JavaFX Desktop │ ───────────────────────────────▶│ ESP-01S (ESP8266) │
│ Application │◀─────────────────────────────── │ running the sketch │
└────────────────────┘ JSON-less plain text └───────────────────────┘
│ │
PWRSW pin │ │ PWLED pin
▼ ▼
Power switch Power LED
header (out) header (in)
- The ESP-01S connects to Wi-Fi and starts an HTTP server on port
60000. - One GPIO (
PWRSW) is wired in parallel with the PC's power switch button; briefly pulling it low simulates a button press. - Another GPIO (
PWLED) reads the PC's power LED header to determine whether the PC is currently on or off. - Every power request must include a
keyquery parameter matching a SHA-256 hash pre-configured on the device. - The JavaFX GUI reads the list of managed PCs (name, IP, port) from
config.txt, renders one card per PC with Start, Stop, and Force Stop buttons, and refreshes every PC's status every 5 seconds.
WirelessPowerSwitch/
├── WirelessPowerSwitch.ino # ESP8266 firmware (Arduino sketch)
├── GUI/ # JavaFX desktop application
│ ├── config.txt # Shared secret key + list of managed PCs
│ ├── Assets/ # Images/icons used by the GUI
│ └── src/
│ ├── sample/
│ │ ├── Main.java # JavaFX application entry point
│ │ ├── Launcher.java # Plain-Java entry point (works around JavaFX packaging)
│ │ ├── Controller.java # Loads config.txt, builds the PC list, drives status polling
│ │ ├── Computer.java # UI card for a single PC (buttons + status)
│ │ ├── sample.fxml # UI layout
│ │ ├── styles.css # UI styling
│ │ └── Services/ # Async HTTP calls (JavaFX Service/Task)
│ │ ├── PowerService.java
│ │ ├── ForcePowerOffService.java
│ │ └── GetStatusService.java
│ └── META-INF/MANIFEST.MF
└── Doc/ # Diagrams and screenshots (referenced in this README)
A custom PCB (designed in EasyEDA) hosts the ESP-01S and interfaces it with the PC's front-panel power switch and power LED headers.
| Schematic | Layout |
|---|---|
![]() |
![]() |
Wiring summary (see WirelessPowerSwitch.ino):
| Signal | ESP8266 pin | Connects to | Direction |
|---|---|---|---|
PWRSW |
GPIO pin 3 | PC power switch header | Output — pulled low briefly to simulate a button press |
PWLED |
GPIO pin 1 | PC power LED header | Input — read to determine current power state |
- Open
WirelessPowerSwitch.inoin the Arduino IDE. - Install ESP8266 board support and the following libraries (all part of the ESP8266 Arduino core):
ESP8266WiFiESP8266WiFiMultiESP8266WebServer
- Configure your credentials directly in the sketch before flashing:
- Replace
<YOUR WIFI SSID>/<YOUR WIFI PASSWORD>inwifiMulti.addAP(...)with your network credentials. - Replace
SHA256KeyHashwith the SHA-256 hash of a secret key you choose (see Configuration — the GUI computes this hash from the same plaintext key you put inconfig.txt).
- Replace
- Select the ESP-01S / generic ESP8266 board and flash the sketch.
- Wire the module to the PC's front-panel headers as described in Hardware & PCB, then power it on — it will connect to Wi-Fi and start listening on port
60000.
Building & flashing with arduino-cli (alternative to the Arduino IDE):
# One-time setup
arduino-cli core update-index --additional-urls https://arduino.esp8266.com/stable/package_esp8266com_index.json
arduino-cli core install esp8266:esp8266 --additional-urls https://arduino.esp8266.com/stable/package_esp8266com_index.json
# Compile
arduino-cli compile --fqbn esp8266:esp8266:generic WirelessPowerSwitch.ino
# Upload (replace COM3 with your ESP-01S's serial/USB-adapter port)
arduino-cli upload -p COM3 --fqbn esp8266:esp8266:generic WirelessPowerSwitch.inoThe GUI (folder GUI/) is an IntelliJ IDEA JavaFX project (see JavaFxApplication.iml), not a Maven/Gradle build.
- Prerequisites: JDK 15+ and the JavaFX SDK 17 downloaded locally.
- Open the
GUIfolder as a project in IntelliJ IDEA. - Add the JavaFX SDK as a project library (
File > Project Structure > Libraries) pointing to thelibfolder of the SDK you downloaded — the project expects it underGUI/javafx-sdk-17/(already excluded via.gitignore). - Add the required JavaFX VM options when running
Main/Launcher, e.g.:--module-path "<path-to-javafx-sdk-17>\lib" --add-modules javafx.controls,javafx.fxml - Make sure
config.txtand theAssets/folder are present in the working directory when you run the app (see Configuration below) — both are loaded using relative paths. - Run
sample.Launcher(orsample.Main) to start the application.
If you don't want to use IntelliJ IDEA, the GUI can be compiled and run directly with the JDK, once you have downloaded the JavaFX SDK 17 and extracted it locally:
# From the GUI/ folder — set this to wherever you extracted the JavaFX SDK
$javafx = "C:\path\to\javafx-sdk-17\lib"
# Compile all sources into ./out
javac --module-path $javafx --add-modules javafx.controls,javafx.fxml `
-d out (Get-ChildItem -Recurse -Filter *.java src | ForEach-Object { $_.FullName })
# Copy non-Java resources (FXML, CSS) next to the compiled classes
Copy-Item src\sample\sample.fxml, src\sample\styles.css out\sample\
# Run (config.txt and Assets/ must be in the current working directory, i.e. GUI/)
java --module-path $javafx --add-modules javafx.controls,javafx.fxml -cp out sample.LauncherTo package a runnable JAR instead of running from out/ directly:
jar --create --file WirelessPowerSwitch.jar --main-class sample.Launcher -C out .
java --module-path $javafx --add-modules javafx.controls,javafx.fxml -jar WirelessPowerSwitch.jarThe JAR still needs to be run from a working directory that contains
config.txtandAssets/, since the code loads both via relative paths.
The GUI reads its setup from GUI/config.txt, a simple comma-separated text file:
HashKeyword
NAME 1,0.0.0.0,1000
NAME 2,0.0.0.1,1001
| Line | Format | Description |
|---|---|---|
| 1 | <secret key> |
Plaintext shared secret. The GUI hashes it with SHA-256 at startup and sends that hash as the key parameter on every power request — it must match SHA256KeyHash flashed on each ESP8266. |
| 2+ | <name>,<ip>,<port> |
One line per managed PC: display name, ESP8266 IP address, and HTTP port (60000 by default). |
If config.txt is missing or contains invalid lines, the GUI shows an error dialog (creating an empty file if needed) and exits so you can fix it before relaunching.
The ESP8266 firmware exposes the following endpoints on port 60000:
| Endpoint | Method | Query params | Response | Description |
|---|---|---|---|---|
/power |
GET | key |
200 OK / 400 |
Simulates a short (~1s) button press — toggles power on or off |
/powerOffForced |
GET | key |
200 OK / 400 |
Simulates a long (~6s) button press — forces the PC to shut down |
/getStatus |
GET | — | 1 (on) or 0 (off) |
Reads the current power LED state |
| (any other path) | any | — | 404 Not Found |
Fallback handler |
Requests to /power and /powerOffForced are rejected with 400 unless key matches the SHA-256 hash configured on the device.
- Authentication is a single shared-secret hash compared with the
keyquery parameter — this is lightweight, not a substitute for real authentication (no TLS, no per-user credentials, no rate limiting). - Treat each ESP8266 module as trusted-network-only: keep it behind your home router/firewall and never forward port
60000directly to the internet. - The secret key is stored in plaintext in
GUI/config.txton the client machine — protect access to that file.
GUI dashboard — one card per configured PC, with live status color (green = on, red = off) and Start / Stop / Force-Stop buttons:
Class diagram of the JavaFX application:
- Firmware: Arduino (C++) for ESP8266 / ESP-01S
- Desktop app: Java SDK 15, JavaFX 17
- PCB design: EasyEDA




