Skip to main content

A fast and concurrent Tuya Local API implementation in Rust

Project description

Rustuya

Crates.io Pypi.org Documentation License: MIT

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rustuya-0.3.0rc6.tar.gz (93.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rustuya-0.3.0rc6-cp37-abi3-win_amd64.whl (917.6 kB view details)

Uploaded CPython 3.7+Windows x86-64

rustuya-0.3.0rc6-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ x86-64

rustuya-0.3.0rc6-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ARM64

rustuya-0.3.0rc6-cp37-abi3-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

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

Hashes for rustuya-0.3.0rc6.tar.gz
Algorithm Hash digest
SHA256 b4d593e124abbdf34dcbcdf3f238928879bd517d8f5ecdb426433a107653256b
MD5 17eb2bf6972a739e6e4b432fba4a286c
BLAKE2b-256 514892eb400313585fe9d64a5130bfb8370322bf7e99900c72827a7ae3db0bfe

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustuya-0.3.0rc6.tar.gz:

Publisher: publish.yml on 3735943886/rustuya

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for rustuya-0.3.0rc6-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 5736320ca002107f8755eb33be6aa20ea4c117a23202e385f026c8f48c1ab872
MD5 00944dbff3f36dbf3eef5bb03bc62883
BLAKE2b-256 ee93c5c6a475c708a992a0b08a7b61313cceed28fc25c01529f79756ced2c8de

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustuya-0.3.0rc6-cp37-abi3-win_amd64.whl:

Publisher: publish.yml on 3735943886/rustuya

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustuya-0.3.0rc6-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rustuya-0.3.0rc6-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9adcce103aaa458520892045fe159bdabb3a58a0d58d45ec27feac0198ac935f
MD5 80479a9714148814be96199ef8cc1925
BLAKE2b-256 53402264eef7bacf9ff4254325ae7a5884c770d2772f48ee90e7c72158566df0

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustuya-0.3.0rc6-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rustuya-0.3.0rc6-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1333ef03fa42fbc81b8f0e92b50c373d426c54b15c335852311601b4e9687768
MD5 9d133614c0119a0cc35a1f9c17a6c77a
BLAKE2b-256 2c1012c4621f7fdb065022f2b186f24e70a02036d5475b487a1bffd81b8d5385

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustuya-0.3.0rc6-cp37-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustuya-0.3.0rc6-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 173e4e23bfab7a9f087065897619d6547cfc914a2dae01d2afa444fd4d8335a1
MD5 6186bcea35e73bd61115fdc0c1adf4db
BLAKE2b-256 206f57b2ae4d1fa97a465fe7b4beea088e6791dc47edf67e8a3c9ad5ed843397

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page