tuyapi/cloud
A NodeJS wrapper for Tuya's API.
At the moment, only the mobile/app API is supported as it covers the vast majority of use cases.
Installation
npm i @tuyapi/cloud
Usage
const Cloud = require('@tuyapi/cloud');
let api = new Cloud({key: 'your-api-app-key', secret: 'your-api-app-secret'});
api.register({email: 'example@example.com', password: 'example-password'}).then(async sid => {
let token = await api.request({action: 'tuya.m.device.token.create', data: {'timeZone': '-05:00'}});
console.log(token)
});
Documentation
Development
- After cloning, run
npm i
. - Add a file called
keys.json
with the contents
{
"key": "your-api-key",
"secret": "your-api-secret"
}
- Create a file called
dev.js
as a playground. Since dev.js
is in .gitignore
, it won't be committed. - To run tests, run
npm test
. - To output coverage, run
npm run cover
(it will exit with an error). - To build documentation, run
npm run document
.