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.0rc5.tar.gz (92.8 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.0rc5-cp37-abi3-win_amd64.whl (911.2 kB view details)

Uploaded CPython 3.7+Windows x86-64

rustuya-0.3.0rc5-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.0rc5-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.0rc5-cp37-abi3-macosx_11_0_arm64.whl (998.0 kB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

File details

Details for the file rustuya-0.3.0rc5.tar.gz.

File metadata

  • Download URL: rustuya-0.3.0rc5.tar.gz
  • Upload date:
  • Size: 92.8 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.0rc5.tar.gz
Algorithm Hash digest
SHA256 e3093cf3d349db551197c4646325e86d0aaacb97ab498808c2aa9888cbf9d889
MD5 dd5a04dfb3de7c2e60fbfff6d67434e5
BLAKE2b-256 7287013a4346a53d79472456c997756d5e470762342ce3c10736257cf9eb5a50

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustuya-0.3.0rc5.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.0rc5-cp37-abi3-win_amd64.whl.

File metadata

  • Download URL: rustuya-0.3.0rc5-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 911.2 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.0rc5-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 3e9b23a108fb4b04ffa4b5a5f05afce62aeb8de6efeb0b38d13760de647df3c1
MD5 1eeba0ab88e2ac606b08d8dd8aca4660
BLAKE2b-256 a039eb58976f11fe9b8fa94c4e74182abfc3d44e1e6e4ed748df15ebffe66a39

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustuya-0.3.0rc5-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.0rc5-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rustuya-0.3.0rc5-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 17127a5ba78ec7aa7e4c27ff05fa4a07a44c5ba6490b13859e389f2d55c08a3d
MD5 59e8c36734389fb1b25b67324ea1eeef
BLAKE2b-256 8ba8b1d9459048a276dd76cb1e0757fff13919970e5f7ec50c4d1da14d24b001

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustuya-0.3.0rc5-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.0rc5-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rustuya-0.3.0rc5-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 91e6c083273b2cf13b8b076900eaa1cd44fa40870f60973851c29463ed86c095
MD5 2c2e057e74e79d19d52a8da6e3d6c214
BLAKE2b-256 6c64418afa9bdc4c0a2c8c2cb871676fc200028bba375b13a55f99f1cfbdc144

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustuya-0.3.0rc5-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.0rc5-cp37-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustuya-0.3.0rc5-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 23080ef2a3d9a5d21262ae6c35682bcc606ad1620e2a4a3bfa14214808b86738
MD5 e00c3e0f69d4c6ff73bdf3b701f4a9d1
BLAKE2b-256 11046c2648de9743665d7405afb2da55162c74b6c09ef90b96244f8635239e24

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustuya-0.3.0rc5-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