You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
console.log('Result of setting status to '+!status +': '+ result);
80
+
let status =awaitdevice.get();
68
81
69
-
device.get().then(status=> {
70
-
console.log('New status:', status);
71
-
return;
72
-
});
73
-
});
74
-
});
75
-
```
82
+
console.log(`Current status: ${status}.`);
76
83
77
-
This should report the current status, set the device to the opposite of what it currently is, then report the changed status. The above examples will work with smart plugs; they may need some tweaking for other types of devices.
84
+
awaitdevice.set({set:!status});
78
85
79
-
See the [setup instructions](docs/SETUP.md) for how to find the needed parameters.
86
+
status =awaitdevice.get();
87
+
88
+
console.log(`New status: ${status}.`);
89
+
90
+
device.disconnect();
91
+
})();
92
+
```
80
93
81
94
82
95
## 📝 Notes
83
96
- Only one TCP connection can be in use with a device at once. If using this, do not have the app on your phone open.
84
97
- Some devices ship with older firmware that may not work with `tuyapi`. If you're experiencing issues, please try updating the device's firmware in the official app.
85
98
86
99
87
-
## 📓 Docs
100
+
## 📓 Documentation
88
101
89
102
See the [docs](https://codetheweb.github.io/tuyapi/index.html).
90
103
@@ -103,6 +116,13 @@ See the [docs](https://codetheweb.github.io/tuyapi/index.html).
0 commit comments