tinytuya
Python module to interface with Tuya WiFi smart devices
What it is and what it does
TinyTuya is a Python library for controlling Tuya-compatible smart home devices—plugs, switches, lights, window covers, and similar IoT hardware—either directly over your local network or through Tuya's cloud API. It communicates with devices using Tuya Protocols 3.1 through 3.5 and serves as a replacement for the older pytuya module. The library handles device discovery via built-in network scanning, retrieves device status, and sends commands to change state or settings.
The package depends on requests for cloud operations, colorama for terminal output formatting, and cryptography for secure device communication. It can run on space-limited systems like OpenWRT routers by installing without automatic dependencies and choosing an alternative cryptography library (PyCryptodome, pyaes, or PyCrypto). Setup requires obtaining a local key for each device through Tuya's IoT platform or the built-in setup wizard, which links your Smart Life app account to retrieve device credentials.
Use it for:
- Automate smart plugs and switches in a home or office without relying on cloud-only interfaces.
- Build local-network monitoring dashboards that poll device status without internet dependency.
- Integrate Tuya devices into custom home automation scripts or larger IoT orchestration systems.
- Discover and inventory Tuya devices on a network using the built-in scanner.
- Control window covers, lights, and other stateful devices programmatically from Python applications.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Controls and monitors Tuya WiFi smart devices (plugs, switches, lights, covers) over local network or cloud API using Tuya Protocols 3.1–3.5.
Yes, if you own Tuya smart devices and want local control without cloud dependency. The package is actively maintained, has low install friction, carries no known vulnerabilities, and offers both local and cloud modes. Requires upfront setup (device pairing, credential retrieval) but is straightforward for developers familiar with IoT device provisioning.
Install
tinytuya on PyPI
pip
pip install tinytuyauv
uv add tinytuyapoetry
poetry add tinytuyaInstalling tinytuya
Before you install
Low friction install with three standard runtime dependencies (requests, colorama, cryptography). Active maintenance with recent releases; last commit 2026-07-19. Supports optional cryptography alternatives (PyCryptodome, pyaes) for space-constrained systems.
License in practice
MIT license (permissive) allows commercial and private use with minimal restrictions.
Quickstart
pip install tinytuya
import tinytuya
d = tinytuya.Device('DEVICE_ID_HERE', 'IP_ADDRESS_HERE', 'LOCAL_KEY_HERE', version=3.3)
data = d.status()
print('Device status: %r' % data)
Tuya devices must be activated via Smart Life App; you need device ID, IP address, local key, and protocol version (3.1–3.5) to communicate.
Verify before relying
- Whether the package supports Python 2 or only Python 3 (classifiers list Python 3 but requires_python is unspecified).
- Performance characteristics when controlling many devices or polling at high frequency.
- Whether cloud connectivity requires active Tuya IoT Platform subscription or if local-only operation is always available.
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — requests, colorama, cryptography |
| Maintenance | actively maintained — 39 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 687,853/month — #5,343 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: tinytuya-1.20.0-py3-none-any.whl
Tags
More Networking packages
h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
psutilpsutil retrieves real-time information about…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
uvloopuvloop is a drop-in replacement for Python's…
permissive · top 1,000 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
pyzmqPyZMQ provides Python bindings for ZeroMQ…
permissive · top 1,000 on PyPI
meross-iotA Python library for controlling Meross IoT…
permissive · top 15,000 on PyPI
pywemoDiscovers and controls Belkin WeMo smart home…
permissive · top 15,000 on PyPI
tuya-device-sharing-sdkA Python SDK for Tuya's Open API that handles…
permissive · top 15,000 on PyPI
gardena-bluetoothControls Gardena Bluetooth-enabled watering…
permissive · top 15,000 on PyPI
python-fullykioskProvides a Python interface to the Fully Kiosk…
permissive · top 15,000 on PyPI
python-miioPython library and CLI tool for controlling…
copyleft · top 15,000 on PyPI
python-tadoPyTado provides a Python interface to the Tado…
copyleft · top 15,000 on PyPI
pyvesyncAsynchronous Python library to discover,…
permissive · top 15,000 on PyPI
govee-bleProvides Python bindings to discover, connect…
permissive · top 15,000 on PyPI
seamOfficial Python SDK for the Seam API that…
permissive · top 15,000 on PyPI