Tuya powers a huge slice of cheap smart plugs, switches and breakers. The catch: out of the box, every "on/off" round-trips through Tuya's cloud. That means latency, a hard dependency on your internet connection, and your usage data leaving your house.
The good news — Tuya devices also speak a local protocol, and once you have a few credentials you never need the cloud again.
Two flavors: WiFi and BLE
Tuya devices come in two transports, and they need different approaches:
- WiFi devices — talk the local Tuya protocol over your LAN. You query and control them directly by IP. We maintain a small C++ library and an MQTT bridge for exactly this.
- BLE devices (many breakers) — talk Bluetooth with SMP pairing and AES-CBC encrypted commands. An ESP32-C3 bridge does the pairing/handshake and exposes a clean switch to Home Assistant over MQTT.
Getting your keys
Both paths need a few values from the Tuya cloud (one-time). The easiest tool is tinytuya:
pip install tinytuya
python -m tinytuya wizard
That hands you the Device ID, Local Key, UUID and MAC — everything the local protocol needs.
Why bother
- Instant — no cloud round-trip, switching is local-LAN fast
- Private — commands and state never leave your network
- Resilient — automations keep running during an internet outage
- No lock-in — open-source firmware you can read and own
Both the WiFi library and the BLE bridge are open source — or order a ready-flashed bridge and skip straight to plugging it in.