Skip to main content

local-tuya

tests PyPi python DockerHub

Control Tuya devices with MQTT over LAN.

Features

  • fully asynchronous
  • persistent and robust communication to the device and to MQTT
  • MQTT discovery
  • automatic remote device state updates (remotes can still be used)
  • configurable buffering for subsequent updates
  • constraints between device commands

Supported devices

Installation

The easiest way is to use the Docker image:

docker run -v {PATH_TO_CONFIG}:/app/conf.yaml:ro gpajot/local-tuya

Alternatively, you can use the python package and run directly: CONFIG=path/to/config python -m local-tuya.manager

Configuration

The minimal config is:

mqtt:
  discovery_prefix: {YOUR_PREFIX_HERE}
  hostname: 127.0.0.1
devices:
  - name: My AC
    model: Airton AC
    config:
      tuya:
        id_: {DEVICE_ID_HERE}
        address: {DEVICE_IP_HERE}
        key: {DEVICE_KEY_HERE}

To control a device you will need these 3 things:

  • the device ID
  • the device local IP address
  • the device local key (encryption key generated upon pairing)

Architecture

This library is composed of three main components:

  • the Tuya protocol
  • the device
  • the MQTT client

Tuya protocol

The Tuya protocol is responsible for handling communication details with the Tuya device. Its interface consists of an asynchronous method to update the device and exposes state changes via events.

See protocol module.

Device

The device handles higher level functional logic such as buffering, constraints and specific device commands.

See device module.

MQTT client

Communication with home hubs through MQTT, supporting auto discovery.

See mqtt module.

Metadata

Release files for local-tuya 4.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for local-tuya 4.1.0
File Size Uploaded Provenance Actions
local_tuya-4.1.0.tar.gz 21.4 kB With provenance Details for local_tuya-4.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for local-tuya 4.1.0
File Interpreter ABI Platform Actions
local_tuya-4.1.0-py3-none-any.whl Python 3 none any Details for local_tuya-4.1.0-py3-none-any.whl

Total release size: 58.2 kB

Release files / local_tuya-4.1.0.tar.gz

Download URL local_tuya-4.1.0.tar.gz
Size 21.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d9a33f6815cbbe4a17924031a5c6d032f2d1f15f520611ef72aa24d689944089
BLAKE2b-256 checksum
How to use checksums
96f89eb8418174d5a782e6529233a33fb247580b5eeb8daa855cd42be45fa3fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2025.

Transparency log

Release files / local_tuya-4.1.0-py3-none-any.whl

Download URL local_tuya-4.1.0-py3-none-any.whl
Size 36.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45c7fc67ff239caa56a4d6b2749425d278a5a10f62fcf93390b046da0a03d4d6
BLAKE2b-256 checksum
How to use checksums
463c6b1d15e5978e147e471763bb2a7c2c869275bfd095f63db5f6282361b3bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2025.

Transparency log

Security for local-tuya 4.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for local_tuya-4.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

4.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page