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.0rc4.tar.gz (89.1 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.0rc4-cp37-abi3-win_amd64.whl (906.1 kB view details)

Uploaded CPython 3.7+Windows x86-64

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

Uploaded CPython 3.7+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: rustuya-0.3.0rc4.tar.gz
  • Upload date:
  • Size: 89.1 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.0rc4.tar.gz
Algorithm Hash digest
SHA256 ad2a171bffb57028ff408997790caf34af59360948c29523b117d5087051057a
MD5 8c66f88a4c6008a7167e71aee16fe8d4
BLAKE2b-256 e00d2c9f6ff41379f4e75417913a7f0c90952414de2b20012a8ff68a50336c4f

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: rustuya-0.3.0rc4-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 906.1 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.0rc4-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b1f500ed87234abb273a9c96f1caa3f036b8cf1e8f17353a8a7f0d88c626d5f9
MD5 bde614abd083b229e78a9de814f4abfd
BLAKE2b-256 4ab8882e76203f35d753c8ff3c69d14ba41935962221b110b4c88071711a9684

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rustuya-0.3.0rc4-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dd2556f003328a6187c756032e47cdc6567072a0d949c37e405db2ca99050973
MD5 b7cf1c472df7c72708a28d1e720eb347
BLAKE2b-256 379ec7de1873ea902b1ac1b4af6f570d94fe7f1d6e4d2e81fe45778744c0e56f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rustuya-0.3.0rc4-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0226f4ad4a8976e35226017b8a7a840b672d9e0220ddb12d05491ee5b99add1f
MD5 a293b7d6fbfc7b34458dc05706a2e40f
BLAKE2b-256 75c656df89aae172772741ae7c6867d74d947a3b952e8888360d7797332e2237

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rustuya-0.3.0rc4-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1666aa7cb8edcb193616bb27cd704ab5697774cc2332caed4dbda47147a587a2
MD5 ed503a6d043b955245fc3cb8ea60ccd2
BLAKE2b-256 fd2a24640a49f7372beb3d0bd8e6e88693c4c70e40130835f460b0e16a683837

See more details on using hashes here.

Provenance

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