Skip to content

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.

  • 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.js in server/) and shows Server listening on port 80.
  • wohand.com and www.wohand.com resolve 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.
  1. 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.
  2. Press Install. The plug downloads the stage from your server; its log should show /version/wocaotech/firmware/WoPlugUS/WoPlugUS_V12.bin.
  3. 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.md5 and /payload.bin.

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.

While the ESPreSwitch stage is running, both LEDs blink together to show what it’s doing.

Nothing erased yet: safe to unplug

PatternMeaningWhat to do
Slow blink, once a secondLooking for WiFiWait. After a minute it switches to the rescue network
2 blinks, pauseNo WiFi after a minute, so the plug has opened its own rescue network espreswitch-xxxxxxJoin it and enter a WiFi network (see below)
Short blip every 2 secondsOn WiFi, but the ESPreSwitch server isn’t answering properlyCheck the server is running, the payload has finished downloading, and wohand.com resolves to it
3 blinks, long pauseRefused: the payload is too big for this plug’s flash layoutNothing was erased. Pick a smaller payload or unplug
SolidTalking to the server; about to erase or copying itself to the other slotWait

Flash erased: do NOT unplug

PatternMeaningWhat to do
Fast blink, 5 times a secondWriting ESPresenseWait; it reboots into ESPresense when done
5 fast blinks, pauseA write attempt failed (WiFi dropped, server unreachable, or checksum mismatch); retryingKeep 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

Two different networks can help here:

  • espreswitch, password espreswitch: a network you create. The plug joins it only if it has no saved WiFi. It must resolve wohand.com to your server.
  • espreswitch-xxxxxx: an open rescue network the plug opens after a minute without WiFi (xxxxxx matches the espresense-xxxxxx network it opens once converted). Join it; the page should pop up, or browse to http://192.168.4.1. Enter a WiFi network that resolves wohand.com to 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.

The plug boots ESPresense with no settings and opens an open WiFi network named espresense- plus its MAC address.

  1. 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.
  2. Once the plug is on your network, open its web page, go to Hardware, and set:
FunctionPin
RelayGPIO6
ButtonGPIO2
LEDsGPIO7 and GPIO8, inverted

From then on, update it like any other ESPresense node using the plain esp32c3 firmware.

On iPhone (Safari has no Web Bluetooth) or if this page can’t connect, send the same commands with nRF Connect:

  1. Connect to the plug, expand Unknown Service, and open the write screen on the Unknown Characteristic with WRITE.
  2. Send BYTE_ARRAY 570F0A010C.
  3. Wait about a minute, then send 570F0B.