homebridge-tuya-plus 3.14.0-dev.25 → 3.14.0-dev.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/wiki/Tuya-Cloud-Setup.md +4 -104
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-tuya-plus",
|
|
3
|
-
"version": "3.14.0-dev.
|
|
3
|
+
"version": "3.14.0-dev.26",
|
|
4
4
|
"description": "A community-maintained Homebridge plugin for controlling Tuya devices in HomeKit. LAN-first, with an optional Tuya Cloud fallback for any device the LAN can't reach.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
package/wiki/Tuya-Cloud-Setup.md
CHANGED
|
@@ -4,12 +4,9 @@ This plugin is **LAN-first** — every Tuya device is controlled locally wheneve
|
|
|
4
4
|
|
|
5
5
|
It helps in two situations:
|
|
6
6
|
|
|
7
|
-
> **Devices that are never on the LAN.**
|
|
7
|
+
> **Devices that are never on the LAN.** Some devices, most notably some battery-powered **"sleepy"** ones, never keep the local port open and never answer LAN discovery, so the local protocol can't reach them. (Tuya's own developer docs state LAN control is unavailable in low-power mode.)
|
|
8
8
|
|
|
9
|
-
> **Devices that occasionally drop off the LAN.** If a normally-local device sometimes shows "No Response" in HomeKit, the cloud fallback quietly covers those moments
|
|
10
|
-
|
|
11
|
-
* Initial state + control go through the Tuya OpenAPI (signed HTTPS).
|
|
12
|
-
* Live updates (including physical button presses) arrive over Tuya's **MQTT** message service — no polling.
|
|
9
|
+
> **Devices that occasionally drop off the LAN.** If a normally-local device sometimes shows "No Response" in HomeKit, the cloud fallback quietly covers those moments.
|
|
13
10
|
|
|
14
11
|
---
|
|
15
12
|
|
|
@@ -38,107 +35,10 @@ Still in the project: **Devices → Link App Account → Add App Account**, then
|
|
|
38
35
|
|
|
39
36
|
## 4. Find the device ID
|
|
40
37
|
|
|
41
|
-
**Devices → All Devices** → click your device → copy its **Device ID** (a string like `bfae6739…tfx`). (You can also find it in
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
## 5. Configure the plugin
|
|
46
|
-
|
|
47
|
-
Add a **top-level `cloud` block** with your credentials. That's all that's needed — every device then tries the LAN first and uses the cloud as a backup.
|
|
48
|
-
|
|
49
|
-
A device that is **never** reachable on the LAN (a battery-powered "sleepy" timer) simply has **no local `key`**: without one it can't speak the LAN protocol, so the plugin reaches it through the cloud session. There are two project styles:
|
|
50
|
-
|
|
51
|
-
### Smart Home project (recommended — what most people have)
|
|
52
|
-
|
|
53
|
-
Authenticates as your app account (username/password), so it sees exactly the devices linked in step 3.
|
|
54
|
-
|
|
55
|
-
```json5
|
|
56
|
-
{
|
|
57
|
-
"platform": "TuyaLan",
|
|
58
|
-
"cloud": {
|
|
59
|
-
"accessId": "your-access-id",
|
|
60
|
-
"accessKey": "your-access-secret",
|
|
61
|
-
"region": "eu", // eu / us / cn / in / sg / eu-w / us-e
|
|
62
|
-
"username": "you@example.com", // your Tuya/Smart Life app login
|
|
63
|
-
"password": "your-app-password",
|
|
64
|
-
"countryCode": "48", // your phone country code (e.g. 1, 44, 48)
|
|
65
|
-
"schema": "tuyaSmart" // or "smartlife" if you use the Smart Life app
|
|
66
|
-
},
|
|
67
|
-
"devices": [
|
|
68
|
-
{
|
|
69
|
-
"name": "Garden Irrigation",
|
|
70
|
-
"type": "IrrigationSystem",
|
|
71
|
-
"id": "bfae6739xxxxxxxxxxxxxx", // the cloud Device ID
|
|
72
|
-
"valveCount": 4
|
|
73
|
-
// no "key" -> this device is reached over the cloud
|
|
74
|
-
}
|
|
75
|
-
]
|
|
76
|
-
}
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Custom project
|
|
80
|
-
|
|
81
|
-
If you created a **Custom** project (devices linked by QR to the project's asset) just omit `username`/`password`/`countryCode`/`schema`:
|
|
82
|
-
|
|
83
|
-
```json5
|
|
84
|
-
"cloud": {
|
|
85
|
-
"accessId": "your-access-id",
|
|
86
|
-
"accessKey": "your-access-secret",
|
|
87
|
-
"region": "eu"
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
> There is one global session. The plugin doesn't support per-device cloud credentials or multiple Tuya accounts — put your credentials in the single top-level `cloud` block. A cloud-only device just omits its local `key`.
|
|
38
|
+
**Devices → All Devices** → click your device → copy its **Device ID** (a string like `bfae6739…tfx`). (You can also find it in Tuya/Smart Life apps: device → ✎/⚙ → *Device Information*.)
|
|
92
39
|
|
|
93
40
|
---
|
|
94
41
|
|
|
95
|
-
## Data-points: numbers on the LAN, codes on the cloud
|
|
96
|
-
|
|
97
|
-
Over the LAN, data-points are numbered (1, 2, …). Over the **cloud** they're named **codes** (e.g. `switch_1`, `battery_percentage`). You normally don't need to care which is which: when the cloud session connects, the plugin reads the device's *thing shadow*, which lists both the code **and** the numeric id for each data-point, and learns the mapping. From then on a configuration written either way works over either transport — a numeric-DP config falls back to the cloud, and a code-based config works on the LAN.
|
|
98
|
-
|
|
99
|
-
When a cloud device connects, the plugin **logs the data-points** it reports (code and numeric id), e.g.:
|
|
100
|
-
|
|
101
|
-
```
|
|
102
|
-
Garden Irrigation: Tuya Cloud data-points → switch_1(dp 1)=false, switch_2(dp 2)=false, switch_3(dp 3)=false, switch_4(dp 4)=false, countdown_1(dp 5)=0, …, battery_percentage(dp 46)=99
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
The `IrrigationSystem` defaults already match the common 4-zone layout (`switch_1`…`switch_4`, battery `battery_percentage`). If your device differs, use the logged codes:
|
|
106
|
-
|
|
107
|
-
```json5
|
|
108
|
-
"valves": [
|
|
109
|
-
{ "name": "Front Lawn", "dp": "switch_1", "defaultDuration": 900 },
|
|
110
|
-
{ "name": "Back Lawn", "dp": "switch_2", "defaultDuration": 900 }
|
|
111
|
-
],
|
|
112
|
-
"dpBattery": "battery_percentage"
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
See **[Irrigation Systems / Sprinklers](https://github.com/adrianjagielak/homebridge-tuya-plus/blob/main/wiki/Supported-Device-Types.md#irrigation-systems--sprinklers)** for all options (per-zone durations, master switch, etc.).
|
|
116
|
-
|
|
117
|
-
---
|
|
118
|
-
|
|
119
|
-
## Realtime updates (MQTT)
|
|
120
|
-
|
|
121
|
-
Live updates use Tuya's MQTT message service via the **`mqtt`** package, which is an *optional dependency* installed automatically. If it's missing (or `"realtime": false`), cloud devices still work and stay controllable, but external changes (a physical button, the device's own timer) won't show up until Homebridge restarts. To force-install it:
|
|
122
|
-
|
|
123
|
-
```
|
|
124
|
-
sudo npm install -g mqtt
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
The realtime stream connects out to Tuya's broker on **port 8883** — make sure your firewall allows that outbound (it's open on normal home networks).
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
## Troubleshooting
|
|
132
|
-
|
|
133
|
-
| Symptom | Cause / fix |
|
|
134
|
-
|---|---|
|
|
135
|
-
| `Tuya Cloud connection failed: token request failed … (code 1004)` | Wrong **Access ID/Secret**, or host clock skew — the signature includes a timestamp, so keep the machine **NTP-synced**. |
|
|
136
|
-
| `… (code 1106) permission deny` / `(code 40001900) No space permission` | API service not authorized or **trial expired** (step 2), or **wrong region**, or you logged in with the developer account instead of the **app** account, or this specific device isn't linked to the project (step 3). The cloud backs every device as a fallback, so a single LAN-only device that isn't in the project logs this once — harmless if that device already works over the LAN. |
|
|
137
|
-
| Device connects but shows nothing / `0` devices | **Region mismatch**, or the device isn't linked to the project (step 3), or the linked account isn't the device's **owner** (shared/guest access hides devices). |
|
|
138
|
-
| `realtime disabled: the optional "mqtt" package is not installed` | Install `mqtt` (above), or ignore if you don't need live external updates. |
|
|
139
|
-
| Realtime never connects (control works, external changes don't) | Outbound **port 8883** blocked by a firewall. |
|
|
140
|
-
| Logs show different codes than expected | Use the codes from the startup log line shown above. |
|
|
141
|
-
|
|
142
42
|
### Security note
|
|
143
43
|
|
|
144
|
-
Your **Access Secret** and app password are sensitive. Keep them only in your Homebridge `config.json`. If you ever share a config for support, redact them
|
|
44
|
+
Your **Access Secret** and app password are sensitive. Keep them only in your Homebridge `config.json`. If you ever share a config for support, redact them.
|