A fast and concurrent Tuya Local API implementation in Rust
Project description
Rustuya
Local-network control of Tuya-compatible devices, built in Rust with first-class Python bindings. Designed for fleets of hundreds to thousands of devices — a native Rust core handles the I/O while the Python facade releases the GIL on every blocking call, so threaded Python workers stay live.
Install
Rust
cargo add rustuya
Python
pip install rustuya
Quick start
Rust
use rustuya::sync::Device;
let dev = Device::new("DEVICE_ID", "LOCAL_KEY");
dev.set_value(1, true)?; // turn on DP 1
println!("{:?}", dev.status()?); // read current DPS
for msg in dev.listener() { // real-time events
println!("{:?}", msg);
}
Python
from rustuya import Device
dev = Device("DEVICE_ID", "LOCAL_KEY")
dev.set_value(1, True) # turn on DP 1
print(dev.status()) # read current DPS
for msg in dev.listener(): # real-time events
print(msg)
Features
- Local-only — talks directly to devices over LAN, no Tuya Cloud
- Rust core + Python bindings (PyO3) — same engine for both
- Built for fleet scale — per-device background tasks with automatic reconnection and exponential backoff
- Full protocol coverage — Tuya 3.1 / 3.2 / 3.3 / 3.4 / 3.5 + device22
See the Guide for the full API reference, design philosophy, and architecture notes.
Credits
The Tuya protocol layer in rustuya is derived from the specifications and error codes documented in tinytuya:
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rustuya-0.3.0rc6.tar.gz.
File metadata
- Download URL: rustuya-0.3.0rc6.tar.gz
- Upload date:
- Size: 93.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4d593e124abbdf34dcbcdf3f238928879bd517d8f5ecdb426433a107653256b
|
|
| MD5 |
17eb2bf6972a739e6e4b432fba4a286c
|
|
| BLAKE2b-256 |
514892eb400313585fe9d64a5130bfb8370322bf7e99900c72827a7ae3db0bfe
|
Provenance
The following attestation bundles were made for rustuya-0.3.0rc6.tar.gz:
Publisher:
publish.yml on 3735943886/rustuya
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rustuya-0.3.0rc6.tar.gz -
Subject digest:
b4d593e124abbdf34dcbcdf3f238928879bd517d8f5ecdb426433a107653256b - Sigstore transparency entry: 1763991173
- Sigstore integration time:
-
Permalink:
3735943886/rustuya@071ba8e8eed775a5d75c6ccbaa4e187b54058baf -
Branch / Tag:
refs/tags/v0.3.0-rc.6 - Owner: https://github.com/3735943886
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@071ba8e8eed775a5d75c6ccbaa4e187b54058baf -
Trigger Event:
push
-
Statement type:
File details
Details for the file rustuya-0.3.0rc6-cp37-abi3-win_amd64.whl.
File metadata
- Download URL: rustuya-0.3.0rc6-cp37-abi3-win_amd64.whl
- Upload date:
- Size: 917.6 kB
- Tags: CPython 3.7+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5736320ca002107f8755eb33be6aa20ea4c117a23202e385f026c8f48c1ab872
|
|
| MD5 |
00944dbff3f36dbf3eef5bb03bc62883
|
|
| BLAKE2b-256 |
ee93c5c6a475c708a992a0b08a7b61313cceed28fc25c01529f79756ced2c8de
|
Provenance
The following attestation bundles were made for rustuya-0.3.0rc6-cp37-abi3-win_amd64.whl:
Publisher:
publish.yml on 3735943886/rustuya
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rustuya-0.3.0rc6-cp37-abi3-win_amd64.whl -
Subject digest:
5736320ca002107f8755eb33be6aa20ea4c117a23202e385f026c8f48c1ab872 - Sigstore transparency entry: 1763993565
- Sigstore integration time:
-
Permalink:
3735943886/rustuya@071ba8e8eed775a5d75c6ccbaa4e187b54058baf -
Branch / Tag:
refs/tags/v0.3.0-rc.6 - Owner: https://github.com/3735943886
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@071ba8e8eed775a5d75c6ccbaa4e187b54058baf -
Trigger Event:
push
-
Statement type:
File details
Details for the file rustuya-0.3.0rc6-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: rustuya-0.3.0rc6-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9adcce103aaa458520892045fe159bdabb3a58a0d58d45ec27feac0198ac935f
|
|
| MD5 |
80479a9714148814be96199ef8cc1925
|
|
| BLAKE2b-256 |
53402264eef7bacf9ff4254325ae7a5884c770d2772f48ee90e7c72158566df0
|
Provenance
The following attestation bundles were made for rustuya-0.3.0rc6-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
publish.yml on 3735943886/rustuya
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rustuya-0.3.0rc6-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
9adcce103aaa458520892045fe159bdabb3a58a0d58d45ec27feac0198ac935f - Sigstore transparency entry: 1763991999
- Sigstore integration time:
-
Permalink:
3735943886/rustuya@071ba8e8eed775a5d75c6ccbaa4e187b54058baf -
Branch / Tag:
refs/tags/v0.3.0-rc.6 - Owner: https://github.com/3735943886
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@071ba8e8eed775a5d75c6ccbaa4e187b54058baf -
Trigger Event:
push
-
Statement type:
File details
Details for the file rustuya-0.3.0rc6-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: rustuya-0.3.0rc6-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1333ef03fa42fbc81b8f0e92b50c373d426c54b15c335852311601b4e9687768
|
|
| MD5 |
9d133614c0119a0cc35a1f9c17a6c77a
|
|
| BLAKE2b-256 |
2c1012c4621f7fdb065022f2b186f24e70a02036d5475b487a1bffd81b8d5385
|
Provenance
The following attestation bundles were made for rustuya-0.3.0rc6-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
publish.yml on 3735943886/rustuya
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rustuya-0.3.0rc6-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
1333ef03fa42fbc81b8f0e92b50c373d426c54b15c335852311601b4e9687768 - Sigstore transparency entry: 1763993094
- Sigstore integration time:
-
Permalink:
3735943886/rustuya@071ba8e8eed775a5d75c6ccbaa4e187b54058baf -
Branch / Tag:
refs/tags/v0.3.0-rc.6 - Owner: https://github.com/3735943886
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@071ba8e8eed775a5d75c6ccbaa4e187b54058baf -
Trigger Event:
push
-
Statement type:
File details
Details for the file rustuya-0.3.0rc6-cp37-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: rustuya-0.3.0rc6-cp37-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.7+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
173e4e23bfab7a9f087065897619d6547cfc914a2dae01d2afa444fd4d8335a1
|
|
| MD5 |
6186bcea35e73bd61115fdc0c1adf4db
|
|
| BLAKE2b-256 |
206f57b2ae4d1fa97a465fe7b4beea088e6791dc47edf67e8a3c9ad5ed843397
|
Provenance
The following attestation bundles were made for rustuya-0.3.0rc6-cp37-abi3-macosx_11_0_arm64.whl:
Publisher:
publish.yml on 3735943886/rustuya
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rustuya-0.3.0rc6-cp37-abi3-macosx_11_0_arm64.whl -
Subject digest:
173e4e23bfab7a9f087065897619d6547cfc914a2dae01d2afa444fd4d8335a1 - Sigstore transparency entry: 1763992629
- Sigstore integration time:
-
Permalink:
3735943886/rustuya@071ba8e8eed775a5d75c6ccbaa4e187b54058baf -
Branch / Tag:
refs/tags/v0.3.0-rc.6 - Owner: https://github.com/3735943886
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@071ba8e8eed775a5d75c6ccbaa4e187b54058baf -
Trigger Event:
push
-
Statement type: