Flashing ESPHome and Tasmota onto Commercial Smart Plugs and Switches
This site already covers ESPHome in depth for projects you build from scratch — a WiFi sensor on a bare ESP32, a custom component written in C++. But a huge amount of cheap commercial smart-home hardware — plugs, in-wall switches, power strips, some bulbs — already contains an ESP8266 or ESP32 inside it, running stock Tuya or vendor cloud firmware. Replacing that firmware with ESPHome or Tasmota turns a cloud-dependent gadget into a fully local device that works with Home Assistant with no app, no account, and no dependency on a vendor's servers staying in business. This guide covers how to identify a flashable device, get firmware onto it, and what to watch for.
Step 1: Confirm the Hardware Before You Buy or Open Anything
Not every smart plug has an ESP chip inside, and vendors change internals between hardware revisions without changing the model number or box art. Before buying in bulk or cracking open a device you already own:
- Check the Tasmota device template database and the ESPHome community device database for your exact model and hardware revision (often printed inside the battery/wiring compartment or on a sticker under the device).
- Look specifically for whether the device supports tuya-convert (an over-the-air flashing exploit that works without opening the case) or requires physical UART pads — this changes your flashing method entirely.
- Be aware that a "known good" model can silently switch to a non-ESP chip (some vendors have moved to Realtek or proprietary chips specifically to block this kind of flashing) — a recent purchase of a previously-flashable model is not a guarantee.
Method 1: Over-the-Air (tuya-convert)
Where it still works, tuya-convert is the easiest path: it exploits the device's initial WiFi provisioning handshake to push new firmware without ever opening the case. It requires a Linux machine (a Raspberry Pi is a popular choice) acting as a temporary access point the smart plug connects to during a simulated setup process, after which it pushes a flashing stub and then your chosen firmware. This method has gotten progressively less reliable as vendors patch the exploit in firmware updates, so success depends heavily on your specific device's current firmware version — a plug fresh out of the box with old firmware is far more likely to work than one that's already auto-updated itself.
Method 2: UART / Serial Flashing
When OTA flashing isn't available, you open the case and find the chip's UART pads (TX, RX, GND, and a way to pull GPIO0 low to enter flash mode) and wire up a USB-to-serial adapter to flash directly, the same way you'd flash a bare ESP8266 or ESP32 dev board. This is more work but far more reliable, and it's the only option on devices that block OTA conversion:
- Open the case (unplug from mains first — many of these plugs have exposed mains-voltage traces right next to the low-voltage logic side).
- Identify the chip (ESP8266 variants like the ESP8285 are extremely common in these plugs) and locate TX/RX/GND/3V3 pads, often unpopulated holes or test points rather than a proper header.
- Wire a 3.3V USB-to-serial adapter, hold the flash-mode pin low during power-up, and flash with esptool (for Tasmota) or the ESPHome flashing tool/web installer (for ESPHome).
- Reassemble, and do first-time WiFi/API setup over the device's own AP or captive portal before it goes back into the wall or outlet.
ESPHome vs. Tasmota for This Use Case
ESPHomeTasmota Config styleYAML, compiled into firmware per deviceWeb UI + console commands, one firmware binary fits many devices Home Assistant integrationNative API, auto-discovered, very tightMQTT-based, slightly more setup but equally solid Best forShops already standardized on ESPHome/Home AssistantMixed environments, non-Home-Assistant users, quick single-device flashes OTA updates after first flashYes, from Home Assistant or the dashboardYes, from the Tasmota web UISafety
- Mains voltage is present inside these devices. Many smart plugs put the relay and mains-side traces within millimeters of the low-voltage logic board. Always unplug from the wall before opening, never probe or flash while the device is connected to mains, and treat the whole board as live until you've confirmed otherwise with a meter.
- Don't reassemble and plug in a device with a flashing jig or USB adapter still attached — isolate the low-voltage flashing side completely from mains before power-cycling for test.
- A bricked relay is a fire risk, not just an inconvenience. Test a freshly flashed device's relay switching behavior with a low-draw load before trusting it with anything high-current, and don't leave a freshly modified device unattended on a real load until you've confirmed it behaves correctly.
Once flashed, these repurposed plugs slot directly into the same Home Assistant, MQTT, and Node-RED automation setups already covered on this site for DIY ESP32 sensor nodes — they're just cheaper, pre-built enclosures with a relay already wired in, which makes them a genuinely useful shortcut for shop power control (killing power to a 3D printer or laser overnight, for instance) rather than building an equivalent relay box from scratch.