Xpersona
T

Tuya Cloud

CLAWHUB · Unverified

Read sensor data and control Tuya IoT devices via Tuya Cloud API or local LAN. Use when the user wants to list devices, read temperature, humidity, soil mois...

62
Rank
84
Safety
1.7k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.7K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: medium.

clawhub skill install s17cx7a4cv5x0318ynafxfrs6h83hn86:tuya-cloud
  1. Install using `clawhub skill install s17cx7a4cv5x0318ynafxfrs6h83hn86:tuya-cloud` in an isolated environment before connecting it to live workloads.
  2. No published capability contract is available yet, so validate auth and request/response behavior manually.
  3. Review the upstream CLAWHUB listing at https://clawhub.ai/minshi-veyt/tuya-cloud before using production credentials.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-minshi-veyt-tuya-cloud/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

98,139 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: tuya-cloud
description: Read sensor data and control Tuya IoT devices via Tuya Cloud API or local LAN. Use when the user wants to list devices, read temperature, humidity, soil moisture, battery or other sensor data, or send commands to switches and valves. Requires TUYA_ACCESS_ID, TUYA_ACCESS_SECRET, and optionally TUYA_API_ENDPOINT in .env.
license: MIT
metadata: {"openclaw":{"emoji":"🔌","primaryEnv":"TUYA_ACCESS_ID","requires":{"env":["TUYA_ACCESS_ID","TUYA_ACCESS_SECRET"],"bins":["python3"]}}}
---

# Tuya Cloud Controller

Read sensor data and control Tuya IoT devices via `scripts/tuya_controller.py`. Supports both Tuya Cloud API and direct local LAN control.

## Device registry

Known controllable devices are defined in `scripts/config.py` as `CONTROLLABLE_DEVICES` (OPTIONAL).  
**Always consult this list first if exist** to resolve a device name to its `device_id`.  
For valve devices the `valve` key gives the DP code ( e.g. `switch_1`) to use as the command `code`.  
Only call `tuya_list_devices` if the device is not listed in the config.

## Setup

Add credentials to `.env`:

```bash
TUYA_ACCESS_ID=your_access_id
TUYA_ACCESS_SECRET=your_access_secret
TUYA_API_ENDPOINT=https://openapi.tuyaeu.com  # default: tuyaus.com (US)
```

Regional endpoints: EU `tuyaeu.com` · US `tuyaus.com` · CN `tuyacn.com` · IN `tuyain.com`

Enable **IoT Core** service in your Tuya IoT Platform project, and grant devices controllable permission (read-only by default).

## Tools

### `tuya_list_devices`

List all Tuya devices linked to the cloud project.

```bash
python scripts/tuya_controller.py list_devices
python scripts/tuya_controller.py list_devices --output_format json --output_path devices.json
```

### `tuya_read_24h_avg`

Return the 24-hour average soil moisture (humidity) for a sensor, computed from its Tuya DP log history.

```bash
python scripts/tuya_controller.py read_24h_avg <device_id>
```

Output is a JSON object:

```json
{
  "avg_humidity": 34.2,   // mean of all va_humidity log entries over 24 h; null if no data
  "count": 47,            // number of log entries found
  "min_humidity": 28.0,
  "max_humidity": 41.0
}
```

If `count` is 0 all fields are `null` — this happens when the device has no log history yet or the Tuya logs API is rate-limited. The garden-irrigation skill falls back to the current reading in that case.

### `tuya_read_last_n`

Return the average soil moisture from the last N humidity readings, looking back up to 7 days. Preferred over `read_24h_avg` — avoids pagination-related rate limiting and gives a stable average regardless of time of day.

```bash
python scripts/tuya_controller.py read_last_n <device_id>
python scripts/tuya_controller.py read_last_n <device_id> --n 100
```

Output is the same JSON shape as `read_24h_avg`:

```json
{
  "avg_humidity": 59.3,
  "count": 50,
  "min_humidity": 46.0,
  "max_humidity": 66.0
}
```

If `count` is 0 all fields are `null` — rate-limited or no log history. The garden-irr

README.md

# Tuya Cloud Controller

Control and read Tuya/Smart Life devices via the Tuya Cloud OpenAPI.
The installation guide can be found here: https://medium.com/@min.shi.happy/building-a-tuya-smart-home-controller-skill-for-openclaw-beadb796c05c

---

## 1. Get your API credentials

### Step 1 — Sign in to the Tuya Developer Platform

Go to [platform.tuya.com](https://platform.tuya.com) and sign in with your Tuya account.  
In the left sidebar navigate to **Cloud → Development**.

### Step 2 — Create a cloud project

On the **My Cloud Projects** page, click **Create Cloud Project**.  
Choose the **Smart Home** project type — this is the type that links Smart Life / Tuya app devices and supports OpenAPI access.

### Step 3 — Fill in project details

Enter a project name, description, and select the **data center region** that matches your Smart Life app account:

| Region | Data center |
|---|---|
| Europe | `openapi.tuyaeu.com` |
| Americas / SEA | `openapi.tuyaus.com` |
| China | `openapi.tuyacn.com` |
| India | `openapi.tuyain.com` |

Click **Create** to proceed to the project configuration flow.

### Step 4 — Authorize API services

In the configuration wizard, authorize the cloud services the project needs.  
At minimum, subscribe to and authorize **IoT Core** and **Smart Home Device Control**.

### Step 5 — Open the project Overview

After creation, click into the project to open its **Overview** page.  
Tuya automatically generates a pair of authorization keys for every new project.

### Step 6 — Copy the authorization keys

On the Overview page, locate the **Authorization Key** section.  
Copy the two values into your `.env` file:

```bash
TUYA_ACCESS_ID=<Client ID / Access ID shown here>
TUYA_ACCESS_SECRET=<Client Secret / Access Secret shown here>
TUYA_API_ENDPOINT=https://openapi.tuyaeu.com   # match to your region
```

### Step 7 — Set device permission to Controllable

By default, devices are added with **read-only** permission.  
To be able to send commands (turn on/off, set values, etc.) you must upgrade this:

1. Inside the project, go to the **Devices** tab.
2. Find your linked devices and open the permission settings.
3. Change the permission from **Read** to **Controllable**.

Without this step, `control_device` commands will be rejected by the API.

---

## 2. Link your Smart Life devices

Inside the project, go to **Devices → Link Tuya App Account** and scan the QR code with your Smart Life app. This imports all devices from your app into the project so they are accessible via the API.

---

## 3. Install dependencies

```bash
pip install tinytuya python-dotenv
```

---

## 4. Verify the setup

```bash
python scripts/tuya_controller.py list_devices
```

You should see a list of all your linked devices with their IDs and online status.

_meta.json

{
  "ownerId": "kn7dxj3hsd6ytdzyzysgj8349h82efgt",
  "slug": "tuya-cloud",
  "version": "1.0.9",
  "publishedAt": 1779720818977
}

skill-card.md

## Description:

Reads sensor data and controls Tuya IoT devices through the Tuya Cloud API or local LAN, including device listing, environmental and status readings, moisture averages, and switch or valve commands.

This skill is ready for commercial/non-commercial use.

## Publisher:

[minshi-veyt](https://clawhub.ai/user/minshi-veyt)

### License/Terms of Use:

MIT-0

## Use Case:

Developers and home automation operators use this skill to configure Tuya API credentials, discover linked Smart Life/Tuya devices, read sensor status, calculate soil-moisture averages, and send cloud or LAN control commands to switches and valves.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: Cloud or LAN commands can operate real Tuya devices, including valves and switches.

Mitigation: Review each proposed command before execution, use a restricted Tuya project, and avoid running bundled tests against live devices.

Risk: Tuya access secrets and local_key values can grant device-control access if exposed.

Mitigation: Keep .env out of source control, avoid sharing logs or transcripts containing secrets, and prefer safer secret storage before LAN control.

Risk: Unpinned dependency ranges may change runtime behavior over time.

Mitigation: Pin and review dependencies before production use.

## Reference(s):

- [Tuya Developer Platform](https://platform.tuya.com)
- [Tuya Cloud Controller installation guide](https://medium.com/@min.shi.happy/building-a-tuya-smart-home-controller-skill-for-openclaw-beadb796c05c)
- [ClawHub skill page](https://clawhub.ai/minshi-veyt/skills/tuya-cloud)

## Skill Output:

**Output Type(s):** [text, JSON, shell commands, configuration guidance]

**Output Format:** [Markdown instructions with shell commands; command results may be JSON or plain text.]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [Requires Tuya credentials for cloud operations; local LAN read/control requires device ID, IP address, and local_key.]

## Skill Version(s):

1.0.9 (source: server release evidence)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

requirements.txt

tinytuya>=1.12.0
python-dotenv>=1.0.0

Sponsored

Ads related to Tuya Cloud and adjacent AI workflows.