Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mathieu2301/tuya-cloud-api
API For Tuya Cloud
https://github.com/mathieu2301/tuya-cloud-api
tuya tuya-api tuya-cloud
Last synced: 2 months ago
JSON representation
API For Tuya Cloud
- Host: GitHub
- URL: https://github.com/mathieu2301/tuya-cloud-api
- Owner: Mathieu2301
- Created: 2021-02-17T12:44:40.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-04-08T07:57:21.000Z (over 3 years ago)
- Last Synced: 2024-10-07T09:05:48.900Z (3 months ago)
- Topics: tuya, tuya-api, tuya-cloud
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Tuya Cloud API
API for Tuya CloudNo dependencies 💪
___
## Installation```
npm i tuya-cloud
```## Example (test.js)
```javascript
const tuyaCloud = require('tuya-cloud');tuyaCloud.connect({
region: 'eu', // eu (Default) / us / cn / in
clientID: 'xxxxxxxxxxxxxxxxxxxx',
secret: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
}).then(async (tuya) => {
console.log('Logged !')const tempSensor = tuya.device('xxxxxxxxxxxxxxxxxxxxxx');
setInterval(async () => {
console.log(await tempSensor.getInfos());
console.log(await tempSensor.getStatus());
}, 10000);const light = tuya.device('xxxxxxxxxxxxxxxxxxxxxx');
console.log(await light.getFunctions());
console.log(await light.getStatus());light.sendCommands([
{
code: 'colour_data',
value: {
h: 120, // Green
s: 1000,
v: 1000,
},
},
]);}).catch((error) => {
console.error(error.message);
});```
___
## ProblemsIf you have errors in console or unwanted behavior, just reload the page.
If the problem persists, please create an issue [here](https://github.com/Mathieu2301/Tuya-Cloud-API/issues).