Tuya Smart
Control and automate Tuya Smart devices with official cloud APIs, secure request signing, region-aware routing, and safe command execution.
by clawic★ 23 GitHub stars
Install Tuya Smart in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
Setup
On first use, read setup.md and align activation boundaries, cloud region context, and write-safety defaults before sending Tuya commands.
When to Use
Use this skill when the user needs practical execution across the Tuya ecosystem: cloud API authentication, device discovery, DPS-based command control, account linking, or automation orchestration. Use this instead of generic IoT advice when outcomes depend on Tuya Smart API behavior, regional endpoints, request signing, and command validation.
Architecture
Memory lives in ~/Clawic/data/tuya/. See memory-template.md for structure and status values.
~/Clawic/data/tuya/
|-- memory.md # Core context and activation boundaries
|-- environments.md # Region, project, app-account, and endpoint mapping
|-- devices.md # Device inventory, capabilities, and command mappings
|-- automations.md # Cross-device orchestration plans and safeguards
`-- incidents.md # Error signatures, fixes, and verification evidence
Quick Reference
Use the smallest file needed for the current task.
| Topic | File |
|---|---|
| Setup and activation behavior | setup.md |
| Memory and workspace templates | memory-template.md |
| Cloud auth and signing reference | auth-signing.md |
| User account and home/device linking | account-linking.md |
| Device commands and state workflows | device-operations.md |
| Multi-device rollout patterns | orchestration-playbooks.md |
| Diagnostics and recovery | troubleshooting.md |
Requirements
- Tuya IoT Platform project credentials: Access ID and Access Secret
- Environment variables:
TUYA_ACCESS_IDandTUYA_ACCESS_SECRET - Correct regional OpenAPI endpoint for the project data center
- Device permissions enabled in the project (Cloud Authorization and required API groups)
- For account-based device binding: configured user permission package and app account flow
Never ask users to paste production secrets into chat logs. Prefer local environment variables and redacted examples.
Data Storage
Keep local operational notes in ~/Clawic/data/tuya/:
- environment and endpoint mappings
- device command dictionaries by product/device id
- approved automation policies and rollback plans
- incident signatures and validated remediations
Core Rules
1. Resolve Region and Project Scope Before Any API Call
- Confirm project environment, app type, and region endpoint first.
- Block execution if region and project are ambiguous because token and device calls will fail or target the wrong tenant.
2. Build and Verify Tuya Signature Inputs Exactly
- Sign every request with Tuya's documented HMAC-SHA256 process.
- If
sign,t, nonce, body hash, or signed headers are inconsistent, treat the request as invalid and rebuild before retrying.
3. Discover Device Capabilities Before Sending Commands
- Read device details and function schema before writes.
- Generate commands only from supported
codevalues and valid data types/ranges.
4. Use Read-Before-Write and Read-After-Write Control Loops
- Capture baseline status before command execution.
- After each write, verify resulting state and stop rollout on mismatch.
5. Apply Explicit Safety Gates for Real Device Writes
- Start with read-only inspection and dry-run command plans.
- Require explicit confirmation before high-impact actions (power, heating, locks, alarms, or bulk updates).
6. Keep Account Linking and Device Ownership Consistent
- Match app account model, cloud project permissions, and user-device binding flow.
- If device list and control APIs disagree, reconcile account linkage before troubleshooting commands.
7. Design Automations as Idempotent, Observable Sequences
- Use deterministic run ids, bounded retries, and clear stop conditions.
- Track each step with expected state checks to avoid duplicate or partial actions across device fleets.
8. Preserve Security and Privacy Boundaries
- Use least-privilege credentials and only declared endpoints.
- Read credentials from environment variables and never write raw secrets to local notes.
- Treat project tokens as short-lived runtime data and avoid persisting them unless the user explicitly requests it.
Common Traps
- Choosing the wrong regional endpoint -> valid credentials fail and device lookup appears empty.
- Sending commands without checking function schema -> invalid
code/valuepairs and rejected writes. - Mixing app-account and cloud-account assumptions -> users appear linked but device control fails.
- Retrying signed requests with stale timestamps/nonces -> repeated signature errors.
- Running bulk commands without staged verification -> large-scale bad state transitions.
- Treating online status as control success -> command accepted but target state not achieved.
External Endpoints
| Endpoint | Data Sent | Purpose |
|---|---|---|
| https://op |
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- _meta.json
- account-linking.md
- auth-signing.md
- device-operations.md
- memory-template.md
- orchestration-playbooks.md
- setup.md
- troubleshooting.md
FAQ
What does the Tuya Smart skill do?
Control and automate Tuya Smart devices with official cloud APIs, secure request signing, region-aware routing, and safe command execution.
How do I install the Tuya Smart skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the Tuya Smart skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…