tsvesync 1.3.7 → 1.3.8

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/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { VeSync } from './lib/vesync';
2
2
  export { VeSyncAirBypass } from './lib/vesyncFanImpl';
3
3
  export { VeSyncOutlet7A, VeSyncOutlet10A, VeSyncOutlet15A, VeSyncOutdoorPlug } from './lib/vesyncOutletImpl';
4
4
  export { VeSyncBulb } from './lib/vesyncBulb';
5
- export { VeSyncWallSwitch } from './lib/vesyncSwitchImpl';
5
+ export { VeSyncWallSwitch, VeSyncDimmerSwitch } from './lib/vesyncSwitchImpl';
6
6
  export { VeSyncBaseDevice } from './lib/vesyncBaseDevice';
7
7
  export { Helpers, setApiBaseUrl } from './lib/helpers';
8
8
  export { CREDENTIAL_ERROR_CODES, CROSS_REGION_ERROR_CODES, isCredentialError, isCrossRegionError } from './lib/constants';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decodeJwtTimestamps = exports.isCrossRegionError = exports.isCredentialError = exports.CROSS_REGION_ERROR_CODES = exports.CREDENTIAL_ERROR_CODES = exports.setApiBaseUrl = exports.Helpers = exports.VeSyncBaseDevice = exports.VeSyncWallSwitch = exports.VeSyncBulb = exports.VeSyncOutdoorPlug = exports.VeSyncOutlet15A = exports.VeSyncOutlet10A = exports.VeSyncOutlet7A = exports.VeSyncAirBypass = exports.VeSync = void 0;
3
+ exports.decodeJwtTimestamps = exports.isCrossRegionError = exports.isCredentialError = exports.CROSS_REGION_ERROR_CODES = exports.CREDENTIAL_ERROR_CODES = exports.setApiBaseUrl = exports.Helpers = exports.VeSyncBaseDevice = exports.VeSyncDimmerSwitch = exports.VeSyncWallSwitch = exports.VeSyncBulb = exports.VeSyncOutdoorPlug = exports.VeSyncOutlet15A = exports.VeSyncOutlet10A = exports.VeSyncOutlet7A = exports.VeSyncAirBypass = exports.VeSync = void 0;
4
4
  // Export main VeSync manager class
5
5
  var vesync_1 = require("./lib/vesync");
6
6
  Object.defineProperty(exports, "VeSync", { enumerable: true, get: function () { return vesync_1.VeSync; } });
@@ -16,6 +16,7 @@ var vesyncBulb_1 = require("./lib/vesyncBulb");
16
16
  Object.defineProperty(exports, "VeSyncBulb", { enumerable: true, get: function () { return vesyncBulb_1.VeSyncBulb; } });
17
17
  var vesyncSwitchImpl_1 = require("./lib/vesyncSwitchImpl");
18
18
  Object.defineProperty(exports, "VeSyncWallSwitch", { enumerable: true, get: function () { return vesyncSwitchImpl_1.VeSyncWallSwitch; } });
19
+ Object.defineProperty(exports, "VeSyncDimmerSwitch", { enumerable: true, get: function () { return vesyncSwitchImpl_1.VeSyncDimmerSwitch; } });
19
20
  // Export base device class
20
21
  var vesyncBaseDevice_1 = require("./lib/vesyncBaseDevice");
21
22
  Object.defineProperty(exports, "VeSyncBaseDevice", { enumerable: true, get: function () { return vesyncBaseDevice_1.VeSyncBaseDevice; } });
@@ -22,7 +22,7 @@ class VeSyncWallSwitch extends vesyncSwitch_1.VeSyncSwitch {
22
22
  logger_1.logger.debug(`Getting details for device: ${this.deviceName}`);
23
23
  const body = {
24
24
  ...helpers_1.Helpers.reqBody(this.manager, 'devicedetail'),
25
- uuid: this.cid,
25
+ uuid: this.uuid,
26
26
  method: 'devicedetail'
27
27
  };
28
28
  const [response, statusCode] = await this.callApi('/inwallswitch/v1/device/devicedetail', 'post', body, helpers_1.Helpers.reqHeaders(this.manager));
@@ -44,7 +44,7 @@ class VeSyncWallSwitch extends vesyncSwitch_1.VeSyncSwitch {
44
44
  const body = {
45
45
  ...helpers_1.Helpers.reqBody(this.manager, 'devicedetail'),
46
46
  method: 'configurations',
47
- uuid: this.cid
47
+ uuid: this.uuid
48
48
  };
49
49
  const [response] = await this.callApi('/inwallswitch/v1/device/configurations', 'post', body, helpers_1.Helpers.reqHeaders(this.manager));
50
50
  if ((response === null || response === void 0 ? void 0 : response.code) === 0) {
@@ -63,7 +63,7 @@ class VeSyncWallSwitch extends vesyncSwitch_1.VeSyncSwitch {
63
63
  const body = {
64
64
  ...helpers_1.Helpers.reqBody(this.manager, 'devicestatus'),
65
65
  status: 'off',
66
- uuid: this.cid
66
+ uuid: this.uuid
67
67
  };
68
68
  const [response] = await this.callApi('/inwallswitch/v1/device/devicestatus', 'put', body, helpers_1.Helpers.reqHeaders(this.manager));
69
69
  if ((response === null || response === void 0 ? void 0 : response.code) === 0) {
@@ -82,7 +82,7 @@ class VeSyncWallSwitch extends vesyncSwitch_1.VeSyncSwitch {
82
82
  const body = {
83
83
  ...helpers_1.Helpers.reqBody(this.manager, 'devicestatus'),
84
84
  status: 'on',
85
- uuid: this.cid
85
+ uuid: this.uuid
86
86
  };
87
87
  const [response] = await this.callApi('/inwallswitch/v1/device/devicestatus', 'put', body, helpers_1.Helpers.reqHeaders(this.manager));
88
88
  if ((response === null || response === void 0 ? void 0 : response.code) === 0) {
@@ -114,7 +114,7 @@ class VeSyncDimmerSwitch extends vesyncSwitch_1.VeSyncSwitch {
114
114
  logger_1.logger.debug(`Getting details for device: ${this.deviceName}`);
115
115
  const body = {
116
116
  ...helpers_1.Helpers.reqBody(this.manager, 'devicedetail'),
117
- uuid: this.cid,
117
+ uuid: this.uuid,
118
118
  method: 'devicedetail'
119
119
  };
120
120
  const [response, statusCode] = await this.callApi('/dimmer/v1/device/devicedetail', 'post', body, helpers_1.Helpers.reqHeaders(this.manager));
@@ -146,7 +146,7 @@ class VeSyncDimmerSwitch extends vesyncSwitch_1.VeSyncSwitch {
146
146
  const body = {
147
147
  ...helpers_1.Helpers.reqBody(this.manager, 'devicedetail'),
148
148
  method: 'configurations',
149
- uuid: this.cid
149
+ uuid: this.uuid
150
150
  };
151
151
  const [response] = await this.callApi('/dimmer/v1/device/configurations', 'post', body, helpers_1.Helpers.reqHeaders(this.manager));
152
152
  if ((response === null || response === void 0 ? void 0 : response.code) === 0) {
@@ -165,7 +165,7 @@ class VeSyncDimmerSwitch extends vesyncSwitch_1.VeSyncSwitch {
165
165
  const body = {
166
166
  ...helpers_1.Helpers.reqBody(this.manager, 'devicestatus'),
167
167
  status: 'off',
168
- uuid: this.cid
168
+ uuid: this.uuid
169
169
  };
170
170
  const [response] = await this.callApi('/dimmer/v1/device/devicestatus', 'put', body, helpers_1.Helpers.reqHeaders(this.manager));
171
171
  if ((response === null || response === void 0 ? void 0 : response.code) === 0) {
@@ -184,7 +184,7 @@ class VeSyncDimmerSwitch extends vesyncSwitch_1.VeSyncSwitch {
184
184
  const body = {
185
185
  ...helpers_1.Helpers.reqBody(this.manager, 'devicestatus'),
186
186
  status: 'on',
187
- uuid: this.cid
187
+ uuid: this.uuid
188
188
  };
189
189
  const [response] = await this.callApi('/dimmer/v1/device/devicestatus', 'put', body, helpers_1.Helpers.reqHeaders(this.manager));
190
190
  if ((response === null || response === void 0 ? void 0 : response.code) === 0) {
@@ -206,8 +206,8 @@ class VeSyncDimmerSwitch extends vesyncSwitch_1.VeSyncSwitch {
206
206
  logger_1.logger.debug(`Setting brightness to ${brightness} for device: ${this.deviceName}`);
207
207
  const body = {
208
208
  ...helpers_1.Helpers.reqBody(this.manager, 'devicestatus'),
209
- brightness: brightness.toString(),
210
- uuid: this.cid
209
+ brightness,
210
+ uuid: this.uuid
211
211
  };
212
212
  const [response] = await this.callApi('/dimmer/v1/device/updatebrightness', 'put', body, helpers_1.Helpers.reqHeaders(this.manager));
213
213
  if ((response === null || response === void 0 ? void 0 : response.code) === 0) {
@@ -231,7 +231,7 @@ class VeSyncDimmerSwitch extends vesyncSwitch_1.VeSyncSwitch {
231
231
  blue: Math.round(blue)
232
232
  },
233
233
  status: 'on',
234
- uuid: this.cid
234
+ uuid: this.uuid
235
235
  };
236
236
  const [response] = await this.callApi('/dimmer/v1/device/devicergbstatus', 'put', body, helpers_1.Helpers.reqHeaders(this.manager));
237
237
  if ((response === null || response === void 0 ? void 0 : response.code) === 0) {
@@ -251,7 +251,7 @@ class VeSyncDimmerSwitch extends vesyncSwitch_1.VeSyncSwitch {
251
251
  const body = {
252
252
  ...helpers_1.Helpers.reqBody(this.manager, 'devicestatus'),
253
253
  status: 'off',
254
- uuid: this.cid
254
+ uuid: this.uuid
255
255
  };
256
256
  const [response] = await this.callApi('/dimmer/v1/device/devicergbstatus', 'put', body, helpers_1.Helpers.reqHeaders(this.manager));
257
257
  if ((response === null || response === void 0 ? void 0 : response.code) === 0) {
@@ -269,7 +269,7 @@ class VeSyncDimmerSwitch extends vesyncSwitch_1.VeSyncSwitch {
269
269
  logger_1.logger.debug(`Turning on RGB color for device: ${this.deviceName}`);
270
270
  const body = {
271
271
  ...helpers_1.Helpers.reqBody(this.manager, 'devicestatus'),
272
- uuid: this.cid,
272
+ uuid: this.uuid,
273
273
  status: 'on'
274
274
  };
275
275
  const [response] = await this.callApi('/dimmer/v1/device/devicergbstatus', 'put', body, helpers_1.Helpers.reqHeaders(this.manager));
@@ -288,7 +288,7 @@ class VeSyncDimmerSwitch extends vesyncSwitch_1.VeSyncSwitch {
288
288
  logger_1.logger.debug(`Turning on indicator light for device: ${this.deviceName}`);
289
289
  const body = {
290
290
  ...helpers_1.Helpers.reqBody(this.manager, 'devicestatus'),
291
- uuid: this.cid,
291
+ uuid: this.uuid,
292
292
  status: 'on'
293
293
  };
294
294
  const [response] = await this.callApi('/dimmer/v1/device/indicatorlightstatus', 'put', body, helpers_1.Helpers.reqHeaders(this.manager));
@@ -307,7 +307,7 @@ class VeSyncDimmerSwitch extends vesyncSwitch_1.VeSyncSwitch {
307
307
  logger_1.logger.debug(`Turning off indicator light for device: ${this.deviceName}`);
308
308
  const body = {
309
309
  ...helpers_1.Helpers.reqBody(this.manager, 'devicestatus'),
310
- uuid: this.cid,
310
+ uuid: this.uuid,
311
311
  status: 'off'
312
312
  };
313
313
  const [response] = await this.callApi('/dimmer/v1/device/indicatorlightstatus', 'put', body, helpers_1.Helpers.reqHeaders(this.manager));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsvesync",
3
- "version": "1.3.7",
3
+ "version": "1.3.8",
4
4
  "description": "A TypeScript library for interacting with VeSync smart home devices",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -5,7 +5,7 @@ export { VeSync } from './lib/vesync';
5
5
  export { VeSyncAirBypass } from './lib/vesyncFanImpl';
6
6
  export { VeSyncOutlet7A, VeSyncOutlet10A, VeSyncOutlet15A, VeSyncOutdoorPlug } from './lib/vesyncOutletImpl';
7
7
  export { VeSyncBulb } from './lib/vesyncBulb';
8
- export { VeSyncWallSwitch } from './lib/vesyncSwitchImpl';
8
+ export { VeSyncWallSwitch, VeSyncDimmerSwitch } from './lib/vesyncSwitchImpl';
9
9
 
10
10
  // Export base device class
11
11
  export { VeSyncBaseDevice } from './lib/vesyncBaseDevice';
@@ -23,7 +23,7 @@ export class VeSyncWallSwitch extends VeSyncSwitch {
23
23
  logger.debug(`Getting details for device: ${this.deviceName}`);
24
24
  const body = {
25
25
  ...Helpers.reqBody(this.manager, 'devicedetail'),
26
- uuid: this.cid,
26
+ uuid: this.uuid,
27
27
  method: 'devicedetail'
28
28
  };
29
29
 
@@ -53,7 +53,7 @@ export class VeSyncWallSwitch extends VeSyncSwitch {
53
53
  const body = {
54
54
  ...Helpers.reqBody(this.manager, 'devicedetail'),
55
55
  method: 'configurations',
56
- uuid: this.cid
56
+ uuid: this.uuid
57
57
  };
58
58
 
59
59
  const [response] = await this.callApi(
@@ -79,7 +79,7 @@ export class VeSyncWallSwitch extends VeSyncSwitch {
79
79
  const body = {
80
80
  ...Helpers.reqBody(this.manager, 'devicestatus'),
81
81
  status: 'off',
82
- uuid: this.cid
82
+ uuid: this.uuid
83
83
  };
84
84
 
85
85
  const [response] = await this.callApi(
@@ -106,7 +106,7 @@ export class VeSyncWallSwitch extends VeSyncSwitch {
106
106
  const body = {
107
107
  ...Helpers.reqBody(this.manager, 'devicestatus'),
108
108
  status: 'on',
109
- uuid: this.cid
109
+ uuid: this.uuid
110
110
  };
111
111
 
112
112
  const [response] = await this.callApi(
@@ -147,7 +147,7 @@ export class VeSyncDimmerSwitch extends VeSyncSwitch {
147
147
  logger.debug(`Getting details for device: ${this.deviceName}`);
148
148
  const body = {
149
149
  ...Helpers.reqBody(this.manager, 'devicedetail'),
150
- uuid: this.cid,
150
+ uuid: this.uuid,
151
151
  method: 'devicedetail'
152
152
  };
153
153
 
@@ -187,7 +187,7 @@ export class VeSyncDimmerSwitch extends VeSyncSwitch {
187
187
  const body = {
188
188
  ...Helpers.reqBody(this.manager, 'devicedetail'),
189
189
  method: 'configurations',
190
- uuid: this.cid
190
+ uuid: this.uuid
191
191
  };
192
192
 
193
193
  const [response] = await this.callApi(
@@ -213,7 +213,7 @@ export class VeSyncDimmerSwitch extends VeSyncSwitch {
213
213
  const body = {
214
214
  ...Helpers.reqBody(this.manager, 'devicestatus'),
215
215
  status: 'off',
216
- uuid: this.cid
216
+ uuid: this.uuid
217
217
  };
218
218
 
219
219
  const [response] = await this.callApi(
@@ -240,7 +240,7 @@ export class VeSyncDimmerSwitch extends VeSyncSwitch {
240
240
  const body = {
241
241
  ...Helpers.reqBody(this.manager, 'devicestatus'),
242
242
  status: 'on',
243
- uuid: this.cid
243
+ uuid: this.uuid
244
244
  };
245
245
 
246
246
  const [response] = await this.callApi(
@@ -271,8 +271,8 @@ export class VeSyncDimmerSwitch extends VeSyncSwitch {
271
271
  logger.debug(`Setting brightness to ${brightness} for device: ${this.deviceName}`);
272
272
  const body = {
273
273
  ...Helpers.reqBody(this.manager, 'devicestatus'),
274
- brightness: brightness.toString(),
275
- uuid: this.cid
274
+ brightness,
275
+ uuid: this.uuid
276
276
  };
277
277
 
278
278
  const [response] = await this.callApi(
@@ -304,7 +304,7 @@ export class VeSyncDimmerSwitch extends VeSyncSwitch {
304
304
  blue: Math.round(blue)
305
305
  },
306
306
  status: 'on',
307
- uuid: this.cid
307
+ uuid: this.uuid
308
308
  };
309
309
 
310
310
  const [response] = await this.callApi(
@@ -332,7 +332,7 @@ export class VeSyncDimmerSwitch extends VeSyncSwitch {
332
332
  const body = {
333
333
  ...Helpers.reqBody(this.manager, 'devicestatus'),
334
334
  status: 'off',
335
- uuid: this.cid
335
+ uuid: this.uuid
336
336
  };
337
337
 
338
338
  const [response] = await this.callApi(
@@ -358,7 +358,7 @@ export class VeSyncDimmerSwitch extends VeSyncSwitch {
358
358
  logger.debug(`Turning on RGB color for device: ${this.deviceName}`);
359
359
  const body = {
360
360
  ...Helpers.reqBody(this.manager, 'devicestatus'),
361
- uuid: this.cid,
361
+ uuid: this.uuid,
362
362
  status: 'on'
363
363
  };
364
364
 
@@ -385,7 +385,7 @@ export class VeSyncDimmerSwitch extends VeSyncSwitch {
385
385
  logger.debug(`Turning on indicator light for device: ${this.deviceName}`);
386
386
  const body = {
387
387
  ...Helpers.reqBody(this.manager, 'devicestatus'),
388
- uuid: this.cid,
388
+ uuid: this.uuid,
389
389
  status: 'on'
390
390
  };
391
391
 
@@ -412,7 +412,7 @@ export class VeSyncDimmerSwitch extends VeSyncSwitch {
412
412
  logger.debug(`Turning off indicator light for device: ${this.deviceName}`);
413
413
  const body = {
414
414
  ...Helpers.reqBody(this.manager, 'devicestatus'),
415
- uuid: this.cid,
415
+ uuid: this.uuid,
416
416
  status: 'off'
417
417
  };
418
418
 
@@ -455,4 +455,4 @@ export const switchModules: Record<string, new (details: Record<string, any>, ma
455
455
  'ESWL01': VeSyncWallSwitch,
456
456
  'ESWL03': VeSyncWallSwitch,
457
457
  'ESWD16': VeSyncDimmerSwitch
458
- };
458
+ };