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.0rc7.tar.gz (94.4 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.0rc7-cp37-abi3-win_amd64.whl (910.2 kB view details)

Uploaded CPython 3.7+Windows x86-64

rustuya-0.3.0rc7-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.0rc7-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.0rc7-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.0rc7.tar.gz.

File metadata

  • Download URL: rustuya-0.3.0rc7.tar.gz
  • Upload date:
  • Size: 94.4 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.0rc7.tar.gz
Algorithm Hash digest
SHA256 ac84136431eccb576d0fc25f323c6c75c984719c9dbd85716ffbee85df119f1f
MD5 c517f1d01738cb5c940a11ae31b4beb3
BLAKE2b-256 a2223f6567bff3439c101738b26ac9310f355d3fc1a1f42d69bcfd42103cd9cc

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: rustuya-0.3.0rc7-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 910.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.0rc7-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 057e35a97be477b48beb0c9d5385fe7783c367c695b21bd5784b9d15870f8f97
MD5 56f1491026e224d6dfade3eb3e6e9877
BLAKE2b-256 a51f11688366bce77d80cd3808815cd4c7457b1760d1c68c28beb335b1f18a71

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rustuya-0.3.0rc7-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5697e76f26c0d1698c01ba4ccf2fce552098647823ff99ab884af0b56cb5b125
MD5 a9fdb8791272d99445a7ae0de949d89f
BLAKE2b-256 a41c33caf72e0c5ebdb655b760db5210550aa722d721eb57484ad5ede227b882

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rustuya-0.3.0rc7-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 996b0abe8142c53929aa20e8fa37a37a2ba8169ca343b1939d0b5f6ef0137ead
MD5 15512e2eb4c8863176521ab333529205
BLAKE2b-256 9e6eb6c096f50026de07e388defa8b0529a7b823fde8ad073518b9bf2cef937a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rustuya-0.3.0rc7-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fdbd85eedd76d1bab52b66024b793b50ae0b5c43c40f3893e79a46f52ef5b583
MD5 5c9e1761a5083310541b5a4f1aef7e0a
BLAKE2b-256 e8b3a9bb3f48e4d60cdb000e97f3c1f4e8d592dd89795da8fca1d911599110f2

See more details on using hashes here.

Provenance

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