ESPreSwitch
ESPreSwitch converts a stock SwitchBot Plug Mini (W1901400 / W1901401) to ESPresense over the air, without opening it. This page sends the two Bluetooth commands that start the conversion, replacing the nRF Connect steps in the README.
Before you start
Section titled “Before you start”- The plug is set up in the SwitchBot app and on your WiFi. Note its BLE MAC from the app.
- Don’t install any firmware update in the SwitchBot app.
- The ESPreSwitch server is running (
node index.jsinserver/) and showsServer listening on port 80. -
wohand.comandwww.wohand.comresolve to the server on your LAN. See README Part 2 for UniFi, pfSense and Pi-hole steps. - You’re on Chrome or Edge (desktop or Android), close enough to the plug for Bluetooth.
Trigger the conversion
Section titled “Trigger the conversion”- Press Connect to plug and pick your plug. Match it by the BLE MAC from the SwitchBot app. If it isn’t listed, tick Show all Bluetooth devices and try again.
- Press Install. The plug downloads the stage from your server; its log should show
/version/wocaotech/firmware/WoPlugUS/WoPlugUS_V12.bin. - Wait about a minute after the server logs
WoPlugUS_V12.bin(the countdown is a guide), then press Reboot. This step is required: Install only downloads the stage; Reboot makes the plug switch to it and restart. The server log then shows/payload.md5and/payload.bin.
This browser has no Web Bluetooth. Use Chrome or Edge on desktop or Android. On iPhone, useBluefy or the nRF Connect steps below.
Not connected.
The version byte is the version the plug thinks it’s “updating” to. It must differ from the plug’s current version; the default 0C is safe.
This page can’t show the server’s progress: a secure (https) page isn’t allowed to talk to a plain-http server on your LAN. Use the server’s log and the plug’s LEDs instead.
What the LEDs mean
Section titled “What the LEDs mean”While the ESPreSwitch stage is running, both LEDs blink together to show what it’s doing.
Nothing erased yet: safe to unplug
| Pattern | Meaning | What to do |
|---|---|---|
| Slow blink, once a second | Looking for WiFi | Wait. After a minute it switches to the rescue network |
| 2 blinks, pause | No WiFi after a minute, so the plug has opened its own rescue network espreswitch-xxxxxx | Join it and enter a WiFi network (see below) |
| Short blip every 2 seconds | On WiFi, but the ESPreSwitch server isn’t answering properly | Check the server is running, the payload has finished downloading, and wohand.com resolves to it |
| 3 blinks, long pause | Refused: the payload is too big for this plug’s flash layout | Nothing was erased. Pick a smaller payload or unplug |
| Solid | Talking to the server; about to erase or copying itself to the other slot | Wait |
Flash erased: do NOT unplug
| Pattern | Meaning | What to do |
|---|---|---|
| Fast blink, 5 times a second | Writing ESPresense | Wait; it reboots into ESPresense when done |
| 5 fast blinks, pause | A write attempt failed (WiFi dropped, server unreachable, or checksum mismatch); retrying | Keep it powered. Check the server. If WiFi is the problem, the rescue network still appears after a minute |
Other states
- Stock SwitchBot behaviour: the stage isn’t running yet.
- Dark, with an open
espresense-…WiFi network: the conversion worked. - Dark, with no network at all: the plug is done
The plug can’t reach WiFi
Section titled “The plug can’t reach WiFi”Two different networks can help here:
espreswitch, passwordespreswitch: a network you create. The plug joins it only if it has no saved WiFi. It must resolvewohand.comto your server.espreswitch-xxxxxx: an open rescue network the plug opens after a minute without WiFi (xxxxxxmatches theespresense-xxxxxxnetwork it opens once converted). Join it; the page should pop up, or browse to http://192.168.4.1. Enter a WiFi network that resolveswohand.comto your server. The rescue network closes as soon as you save, while the plug joins your network. If the join fails, it comes back in about a minute: reconnect and check the name and password.
See the README for details.
After the conversion
Section titled “After the conversion”The plug boots ESPresense with no settings and opens an open WiFi network named espresense- plus its MAC address.
- Join it and enter your WiFi, MQTT broker and room name in the portal (or browse to http://192.168.4.1). See Configuration Settings.
- Once the plug is on your network, open its web page, go to Hardware, and set:
| Function | Pin |
|---|---|
| Relay | GPIO6 |
| Button | GPIO2 |
| LEDs | GPIO7 and GPIO8, inverted |
From then on, update it like any other ESPresense node using the plain esp32c3 firmware.
Fallback: nRF Connect
Section titled “Fallback: nRF Connect”On iPhone (Safari has no Web Bluetooth) or if this page can’t connect, send the same commands with nRF Connect:
- Connect to the plug, expand Unknown Service, and open the write screen on the Unknown Characteristic with WRITE.
- Send BYTE_ARRAY
570F0A010C. - Wait about a minute, then send
570F0B.