Connecting Tuya smart devices with n8n is easier than you think.
In this tutorial, we’ll walk you through a complete n8n Tuya integration — from creating your Tuya Cloud API credentials to building automated smart home workflows.
Whether you’re a maker, developer, or IoT enthusiast, this guide will help you link Tuya devices with n8n and start automating real-world actions.
Why Connect Tuya with n8n?
Tuya is one of the largest smart-home and IoT platforms, powering millions of connected devices worldwide.
n8n, on the other hand, is an open-source automation platform that lets you visually connect APIs and build event-driven workflows.
By combining both, you can:
- Control Tuya devices directly from your n8n dashboard.
- Trigger actions based on device data (temperature, motion, energy).
- Build cross-platform automations that connect Tuya with Slack, Google Sheets, or even ChatGPT.
Example: When a Tuya temperature sensor reports over 30°C, n8n automatically sends an alert via Slack or turns on the air conditioning.
What You’ll Need Before Starting
Before connecting Tuya with n8n, make sure you have:
- A Tuya Developer Account – create one at iot.tuya.com.
- Your Tuya Cloud Project set up, including:
- Access ID and Access Secret
- API endpoint (e.g.,
https://openapi.tuyaeu.com)
- A working n8n instance (self-hosted or cloud).
- Optional: the Tuya community node if you prefer a simplified setup.
Step 1: Get Tuya Cloud API Credentials
- Log into the Tuya IoT Platform.
- Create a new Cloud Project → “Smart Home PaaS.”
- Copy your Access ID and Access Secret under Project → Authorization.
- Link your Tuya App Account so the API can access your devices.
- Test the API endpoint with Postman or n8n’s HTTP Request node.
Tip: Use the “Device List” endpoint to make sure your Tuya devices are visible.
API:GET /v1.0/devices
For developers who want to go deeper, you can also explore Tuya SDK customization to build custom device integrations at the firmware level.
Step 2: Configure Tuya in n8n
Now that you have credentials, let’s connect Tuya to n8n.
- Open n8n and add an HTTP Request node.
- Select GET and enter your Tuya API URL, for example: https://openapi.tuyaus.com/v1.0/devices ((Note: this is an API URL, not a webpage. You can access it through tools like Postman or the n8n HTTP Request node with proper authentication headers.)
- In Headers, add:
client_id:
sign:
t:
sign_method: HMAC-SHA256
access_token:- Generate the signature using Tuya’s API authentication rules.
- Connect the node to other services — for example, a Slack, Telegram, or Google Sheets node to log data.

Pro Tip: You can automate token refresh using an n8n Cron node that runs every 12 hours.
Step 3: Create Your First Automation Workflow
Let’s build a simple use case: turn on Tuya lights automatically when motion is detected.
- Add a Webhook node as the entry point.
- Add the HTTP Request node to fetch Tuya device status.
- Add an IF node → “If motion = true.”
- Add another HTTP Request node → POST to the Tuya “Turn On” API.
- Optionally, connect an AI node (OpenAI / GPT) to generate a smart message:
“Motion detected in the living room — lights turned on automatically.”
This flow can be expanded to control multiple devices or send alerts to your preferred channels.
Need inspiration? Explore AI Workflow Examples to see how similar automations are built.
Common Integration Issues (and How to Fix Them)
| Issue | Cause | Fix |
|---|---|---|
401 Unauthorized | Invalid signature or expired token | Regenerate Access Token using the /token endpoint. |
| Device not showing up | Device not linked to Tuya Cloud Project | Rebind device under Linked App Account. |
| Timeout error | Wrong data center region | Check API endpoint (US, EU, CN, etc.). |
Note: Tuya tokens expire every 2 hours by default. Automate token refresh to avoid interruptions.
Bonus: Combine Tuya + n8n + AI
You can enhance this setup with AI to create intelligent IoT workflows.
Example:
- A motion sensor triggers n8n.
- n8n sends data to OpenAI API.
- AI decides whether to send a notification or take further action.
This pattern — AI decision → n8n execution → IoT response —
is the foundation of modern AIoT automation, which can scale from homes to retail and industrial use cases.
Want to scale beyond tutorials? Discover how ZedIoT’s AIoT Platform unifies AI workflows with IoT devices.
Final Thoughts: Next Steps
You’ve just learned how to connect Tuya smart devices with n8n and create your first workflow.
From here, you can explore more complex automations like energy monitoring, environment alerts, or predictive maintenance.
If you’d like to go beyond simple tutorials and build enterprise-grade AI IoT automations,
we can help you design and deploy end-to-end workflows integrating Tuya, OpenAI, and n8n.
Learn how our AIoT Platform connects hardware, AI models, and workflow automation for real-world IoT systems.
FAQ
Q1: Can I integrate Tuya devices directly in n8n?
Yes. You can use either the official HTTP Request node with Tuya Cloud API or the community Tuya node for simplified setup.
Q2: Is n8n free to use?
Yes. n8n is open source and free for self-hosting. A managed cloud version is also available at n8n.io.
Q3: Can I connect other IoT platforms?
Absolutely. You can extend the same logic to connect platforms like Home Assistant, Shelly, or custom ESP32 sensors.
Q4: What is n8n Tuya integration?
n8n Tuya integration connects Tuya smart devices to n8n workflows using Tuya Cloud API, enabling smart home automation and IoT workflows.
Appendix: Tuya Cloud API Reference
Here are the official Tuya Cloud API endpoints mentioned in this tutorial.
All endpoints are verified and publicly documented on Tuya Developer Portal.
| Function | API Endpoint | Method | Description | Reference |
|---|---|---|---|---|
| Get Token | /v1.0/token?grant_type=1 | POST | Obtain an access_token for API requests (valid for 7200 seconds). | Authentication API |
| Get Device List | /v1.0/devices | GET | Retrieve all devices under your Tuya Cloud project. | Device Management |
| Get Device Details | /v1.0/devices/{device_id} | GET | Get detailed information (status, attributes) of a specific device. | Device Info API |
| Send Device Command | /v1.0/devices/{device_id}/commands | POST | Control a device (e.g., turn on light, adjust brightness). | Device Control API |
| Bind App Account | /v1.0/cloud/projects/{project_id}/apps/{app_schema}/user | POST | Link your mobile app account to the Tuya Cloud project. | Project Configuration |
| Regional Endpoints | https://openapi.tuya{region}.com | — | Choose based on your project region: us, eu, cn, or in. | Regional API Guide |
Request Headers
Each API call requires the following headers for signature verification:
| Header | Description |
|---|---|
client_id | Your Tuya Cloud Access ID |
sign | HMAC-SHA256 signature (client_id + access_token + t) |
t | Current timestamp in milliseconds |
sign_method | Always HMAC-SHA256 |
access_token | Token returned from /v1.0/token |
Note:
The optional AI node (e.g., OpenAI or GPT integration) described in this tutorial is not part of the Tuya API.
It represents a possible workflow extension using n8n or HTTP Request nodes.



