For local control, every Tuya Wi-Fi device needs four values:
| Value | What it is |
|---|---|
| Device ID | the device's unique ID in the Tuya system |
| IP address | its address on your LAN |
| Local key | the encryption key for the local protocol (16 characters) |
| Protocol version | 3.1, 3.2, 3.3, 3.4 or 3.5, depending on firmware |
The local key is not shown in the Smart Life app. The usual way to get it for your own devices is the TinyTuya wizard, which reads it from your account through the Tuya cloud once.
Procedure (TinyTuya wizard)
- Pair all devices in the Smart Life or Tuya Smart app first.
- Create a developer account on the Tuya IoT platform (iot.tuya.com) and a Cloud Project.
- Choose the data center that matches the region of your app account. A mismatch is a common reason the wizard finds no devices.
- Make sure the project has the required API services (TinyTuya's README lists them; at the time of writing IoT Core and Authorization).
- Link your app account to the project (Devices → Link App Account → scan the QR code with the Smart Life app).
- Copy the project's Access ID and Access Secret from its overview page.
- Run the wizard and answer its prompts:
pip install tinytuya
python -m tinytuya wizard
The wizard writes the device list with IDs and keys to local files (devices.json and related files). Treat them like passwords.
Keep keys valid
- Re-pairing changes the key. Removing a device from the app and adding it again (or resetting it) generates a new local key. If local control suddenly fails with decrypt errors, fetch the keys again.
- Give devices a fixed IP (DHCP reservation) so your configuration doesn't break when addresses change.
- Don't publish
devices.json, logs or screenshots containing local keys.
Alternatives
Home Assistant's Tuya Local offers a cloud-assisted setup that retrieves device data from your Tuya account without creating an IoT developer account. LocalTuya can also fetch and refresh keys if you give it Tuya IoT cloud API credentials.