Skip to main content

This package provides a gateway to control Tuya devices from xAAL network.

Tuya protocol is the common protocol used in cheap chinese outlets, smart plugs, and RGB lamps. It use the cloud base “Smart Life” mobile application (Android/IOS).

This protocol isn’t really reliable. If you can, avoid the use of Smart Life APP when this gateway is running. This should be ok, but attributes can be out of sync. The gateway polls devices state every 45 seconds but due to socket error, this can be a little longuer.

The complete guide to extract keys is there: https://github.com/codetheweb/tuyapi/blob/master/docs/SETUP.md

Notes : The main issue is that tuya devices close every connection after 10 seconds.

Supported devices

The gateway supports: PowerRelays (from 1 to x relais), SmartPlugs (same as relais but with a single power-meter), lamps and RGB lamps

Configuration samples

  • Dimmer Lamp / LSC Smart filament

[[device_id]]
 ip = 192.168.1.x
 key = xxxxxxxxxxxxxxxx
 type = lamp_dimmer
 white_temp = 1800, 2700  # for LSC
 addr = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
  • RGB Lamp / LSC RGB1

[[device_id]]
 ip = 192.168.1.x
 key = xxxxxxxxxxxxxxxx
 type = lamp_rgb
 white_temp = 1800, 2700  # for LSC
 white_temp = 3000, 6500  # for Utorch LE7
 addr = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
  • Alphawise dumb single outlet

[[device_id]]
  ip = 192.168.1.x
  key = xxxxxxxxxxxxxxxx
  type = powerrelay
  • SmartPlug (single outlet) / BW-SHP6

[[device_id]]
  ip = 192.168.1.x
  key = xxxxxxxxxxxxxxxx
  type = smartplug
  • SmartPlug (dual outlet) / BW-SHP7

[[device_id]]
  ip = 192.168.1.x
  key = xxxxxxxxxxxxxxxx
  type = smartplug
  dps = 1, 2               # <= 2 outlets
  pmeter_dps = 18, 19, 20  # <= dps for current / power / voltage

Metadata

Release files for xaal.tuya 0.3.1

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

Source distribution (sdist)

Source distribution for xaal.tuya 0.3.1
File Size Uploaded
xaal_tuya-0.3.1.tar.gz 20.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xaal.tuya 0.3.1
File Interpreter ABI Platform
xaal_tuya-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 40.0 kB

Release files / xaal_tuya-0.3.1.tar.gz

Download URL xaal_tuya-0.3.1.tar.gz
Size 20.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f38713f76cec695e71948e80cfcf80e03798d009b115a5389b3094c64e5f7e2f
BLAKE2b-256 checksum
How to use checksums
84069d23ef69cf0555b7cbe6e78db7b0e21fa38b5e5a8a17a9c23bf375d9211c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / xaal_tuya-0.3.1-py3-none-any.whl

Download URL xaal_tuya-0.3.1-py3-none-any.whl
Size 19.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b25700f1ef873527edae4f3c5b7aeaff68c854582eadf2ff73b8e06e64962b50
BLAKE2b-256 checksum
How to use checksums
94931577da2d40d7204f654a294e67b42564193a62d38fcfac19831cb12e87c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2

2 release files

0.1

2 release files

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