Skip to content

Commit 668e64e

Browse files
authored
Merge pull request #141 from andreasbotsikas/pr/remove-tuyapi-openapi
2 parents eb8a4b9 + 5f8ddca commit 668e64e

File tree

4 files changed

+9
-397
lines changed

4 files changed

+9
-397
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,6 @@ typings/
6161

6262
# next.js build output
6363
.next
64+
65+
# Visual Studio Code settings, like the launch.json used for debugging
66+
.vscode

lib/link.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const ora = require('ora');
22
const TuyaLink = require('@tuyapi/link').wizard;
3-
const API = require('@tuyapi/openapi');
43
const c = require('./common');
54

65
async function link(config, options) {
@@ -50,11 +49,8 @@ async function link(config, options) {
5049
spinner.succeed('Device(s) registered!');
5150

5251
// Get device details
53-
const api = new API({key: options.apiKey, secret: options.apiSecret, schema: options.schema, region: options.region});
54-
55-
await api.getToken();
56-
57-
const deviceDetails = (await api.getDevices({ids: devices.map(d => d.id)})).devices;
52+
const device_ids = devices.map(d => d.device_id);
53+
const deviceDetails = (await link.getLinkedDevices({ids: device_ids})).devices;
5854

5955
// Save devices to config
6056
if (options.save) {

0 commit comments

Comments
 (0)