@switchbot/homebridge-switchbot 1.15.1-beta.0 → 1.15.1-beta.10

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.
Files changed (117) hide show
  1. package/.github/ISSUE_TEMPLATE/bug-report.yml +1 -0
  2. package/.github/ISSUE_TEMPLATE/feature-request.yml +1 -0
  3. package/.github/ISSUE_TEMPLATE/support-request.yml +1 -0
  4. package/.prettierrc +1 -1
  5. package/CHANGELOG.md +9 -0
  6. package/config.schema.json +11 -4
  7. package/dist/device/bot.d.ts +8 -7
  8. package/dist/device/bot.d.ts.map +1 -1
  9. package/dist/device/bot.js +104 -28
  10. package/dist/device/bot.js.map +1 -1
  11. package/dist/device/colorbulb.d.ts +8 -7
  12. package/dist/device/colorbulb.d.ts.map +1 -1
  13. package/dist/device/colorbulb.js +223 -58
  14. package/dist/device/colorbulb.js.map +1 -1
  15. package/dist/device/contact.d.ts +3 -3
  16. package/dist/device/contact.d.ts.map +1 -1
  17. package/dist/device/contact.js +54 -11
  18. package/dist/device/contact.js.map +1 -1
  19. package/dist/device/curtain.d.ts +9 -8
  20. package/dist/device/curtain.d.ts.map +1 -1
  21. package/dist/device/curtain.js +102 -28
  22. package/dist/device/curtain.js.map +1 -1
  23. package/dist/device/humidifier.d.ts +8 -7
  24. package/dist/device/humidifier.d.ts.map +1 -1
  25. package/dist/device/humidifier.js +187 -66
  26. package/dist/device/humidifier.js.map +1 -1
  27. package/dist/device/lock.d.ts +8 -7
  28. package/dist/device/lock.d.ts.map +1 -1
  29. package/dist/device/lock.js +98 -22
  30. package/dist/device/lock.js.map +1 -1
  31. package/dist/device/meter.d.ts +4 -4
  32. package/dist/device/meter.d.ts.map +1 -1
  33. package/dist/device/meter.js +55 -12
  34. package/dist/device/meter.js.map +1 -1
  35. package/dist/device/meterplus.d.ts +3 -3
  36. package/dist/device/meterplus.d.ts.map +1 -1
  37. package/dist/device/meterplus.js +53 -10
  38. package/dist/device/meterplus.js.map +1 -1
  39. package/dist/device/motion.d.ts +3 -3
  40. package/dist/device/motion.d.ts.map +1 -1
  41. package/dist/device/motion.js +53 -13
  42. package/dist/device/motion.js.map +1 -1
  43. package/dist/device/plug.d.ts +8 -7
  44. package/dist/device/plug.d.ts.map +1 -1
  45. package/dist/device/plug.js +100 -24
  46. package/dist/device/plug.js.map +1 -1
  47. package/dist/device/striplight.d.ts +8 -7
  48. package/dist/device/striplight.d.ts.map +1 -1
  49. package/dist/device/striplight.js +186 -47
  50. package/dist/device/striplight.js.map +1 -1
  51. package/dist/irdevice/airconditioner.d.ts +7 -6
  52. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  53. package/dist/irdevice/airconditioner.js +40 -6
  54. package/dist/irdevice/airconditioner.js.map +1 -1
  55. package/dist/irdevice/airpurifier.d.ts +7 -6
  56. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  57. package/dist/irdevice/airpurifier.js +46 -11
  58. package/dist/irdevice/airpurifier.js.map +1 -1
  59. package/dist/irdevice/camera.d.ts +7 -6
  60. package/dist/irdevice/camera.d.ts.map +1 -1
  61. package/dist/irdevice/camera.js +40 -6
  62. package/dist/irdevice/camera.js.map +1 -1
  63. package/dist/irdevice/fan.d.ts +8 -7
  64. package/dist/irdevice/fan.d.ts.map +1 -1
  65. package/dist/irdevice/fan.js +40 -6
  66. package/dist/irdevice/fan.js.map +1 -1
  67. package/dist/irdevice/light.d.ts +7 -6
  68. package/dist/irdevice/light.d.ts.map +1 -1
  69. package/dist/irdevice/light.js +40 -6
  70. package/dist/irdevice/light.js.map +1 -1
  71. package/dist/irdevice/other.d.ts +7 -6
  72. package/dist/irdevice/other.d.ts.map +1 -1
  73. package/dist/irdevice/other.js +40 -6
  74. package/dist/irdevice/other.js.map +1 -1
  75. package/dist/irdevice/tv.d.ts +8 -7
  76. package/dist/irdevice/tv.d.ts.map +1 -1
  77. package/dist/irdevice/tv.js +40 -6
  78. package/dist/irdevice/tv.js.map +1 -1
  79. package/dist/irdevice/vacuumcleaner.d.ts +7 -6
  80. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  81. package/dist/irdevice/vacuumcleaner.js +40 -6
  82. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  83. package/dist/irdevice/waterheater.d.ts +7 -6
  84. package/dist/irdevice/waterheater.d.ts.map +1 -1
  85. package/dist/irdevice/waterheater.js +40 -6
  86. package/dist/irdevice/waterheater.js.map +1 -1
  87. package/dist/platform.d.ts +10 -6
  88. package/dist/platform.d.ts.map +1 -1
  89. package/dist/platform.js +211 -93
  90. package/dist/platform.js.map +1 -1
  91. package/dist/settings.d.ts +4 -21
  92. package/dist/settings.d.ts.map +1 -1
  93. package/dist/settings.js +3 -3
  94. package/dist/settings.js.map +1 -1
  95. package/package.json +12 -12
  96. package/src/device/bot.ts +104 -37
  97. package/src/device/colorbulb.ts +227 -95
  98. package/src/device/contact.ts +53 -14
  99. package/src/device/curtain.ts +105 -38
  100. package/src/device/humidifier.ts +189 -84
  101. package/src/device/lock.ts +97 -30
  102. package/src/device/meter.ts +55 -16
  103. package/src/device/meterplus.ts +52 -13
  104. package/src/device/motion.ts +52 -16
  105. package/src/device/plug.ts +101 -33
  106. package/src/device/striplight.ts +189 -68
  107. package/src/irdevice/airconditioner.ts +44 -9
  108. package/src/irdevice/airpurifier.ts +52 -17
  109. package/src/irdevice/camera.ts +46 -11
  110. package/src/irdevice/fan.ts +50 -15
  111. package/src/irdevice/light.ts +48 -13
  112. package/src/irdevice/other.ts +46 -11
  113. package/src/irdevice/tv.ts +56 -21
  114. package/src/irdevice/vacuumcleaner.ts +46 -11
  115. package/src/irdevice/waterheater.ts +46 -11
  116. package/src/platform.ts +232 -107
  117. package/src/settings.ts +4 -25
package/dist/platform.js CHANGED
@@ -24,9 +24,12 @@ const airpurifier_1 = require("./irdevice/airpurifier");
24
24
  const waterheater_1 = require("./irdevice/waterheater");
25
25
  const vacuumcleaner_1 = require("./irdevice/vacuumcleaner");
26
26
  const airconditioner_1 = require("./irdevice/airconditioner");
27
- const axios_1 = __importDefault(require("axios"));
28
- const settings_1 = require("./settings");
27
+ const https_1 = __importDefault(require("https"));
28
+ const crypto_1 = __importDefault(require("crypto"));
29
+ const buffer_1 = require("buffer");
29
30
  const fakegato_history_1 = __importDefault(require("fakegato-history"));
31
+ const fs_1 = require("fs");
32
+ const settings_1 = require("./settings");
30
33
  /**
31
34
  * HomebridgePlatform
32
35
  * This class is the main constructor for your plugin, this is where you should
@@ -41,9 +44,6 @@ class SwitchBotPlatform {
41
44
  this.Characteristic = this.api.hap.Characteristic;
42
45
  // this is used to track restored cached accessories
43
46
  this.accessories = [];
44
- this.axios = axios_1.default.create({
45
- responseType: 'json',
46
- });
47
47
  this.version = require('../package.json').version || '1.12.8'; // eslint-disable-line @typescript-eslint/no-var-requires
48
48
  this.logs();
49
49
  this.debugLog('Finished initializing platform:', this.config.name);
@@ -67,12 +67,6 @@ class SwitchBotPlatform {
67
67
  }
68
68
  return;
69
69
  }
70
- // setup axios interceptor to add headers / api key to each request
71
- this.axios.interceptors.request.use((request) => {
72
- request.headers.Authorization = this.config.credentials?.openToken;
73
- request.headers['Content-Type'] = 'application/json; charset=utf8';
74
- return request;
75
- });
76
70
  // import fakegato-history module
77
71
  this.fakegatoAPI = (0, fakegato_history_1.default)(api);
78
72
  // When this event is fired it means Homebridge has restored all cached accessories from disk.
@@ -83,7 +77,12 @@ class SwitchBotPlatform {
83
77
  this.debugLog('Executed didFinishLaunching callback');
84
78
  // run the method to discover / register your devices as accessories
85
79
  try {
86
- this.discoverDevices();
80
+ if (this.config.credentials?.openToken && !this.config.credentials.token) {
81
+ await this.updateToken();
82
+ }
83
+ else {
84
+ this.discoverDevices();
85
+ }
87
86
  }
88
87
  catch (e) {
89
88
  this.errorLog('Failed to Discover Devices.', JSON.stringify(e.message));
@@ -126,7 +125,7 @@ class SwitchBotPlatform {
126
125
  /**
127
126
  * Verify the config passed to the plugin is valid
128
127
  */
129
- verifyConfig() {
128
+ async verifyConfig() {
130
129
  this.config.options = this.config.options || {};
131
130
  const platformConfig = {};
132
131
  if (this.config.options.logging) {
@@ -169,8 +168,8 @@ class SwitchBotPlatform {
169
168
  }
170
169
  }
171
170
  }
172
- if (this.config.options.refreshRate < 30) {
173
- throw new Error('Refresh Rate must be above 30 (30 seconds).');
171
+ if (this.config.options.refreshRate < 5) {
172
+ throw new Error('Refresh Rate must be above 5 (5 seconds).');
174
173
  }
175
174
  if (!this.config.options.refreshRate) {
176
175
  // default 120 seconds (2 minutes)
@@ -190,12 +189,64 @@ class SwitchBotPlatform {
190
189
  this.debugLog('Missing Credentials');
191
190
  }
192
191
  }
193
- if (!this.config.credentials?.openToken) {
192
+ if (!this.config.credentials?.token) {
194
193
  if (this.platformLogging?.includes('debug')) {
195
- this.errorLog('Missing openToken');
194
+ this.errorLog('Missing token');
196
195
  this.warnLog('Cloud Enabled SwitchBot Devices & IR Devices will not work');
197
196
  }
198
197
  }
198
+ if (this.config.credentials?.token) {
199
+ if (!this.config.credentials?.secret) {
200
+ if (this.platformLogging?.includes('debug')) {
201
+ this.errorLog('Missing secret');
202
+ this.warnLog('Cloud Enabled SwitchBot Devices & IR Devices will not work');
203
+ }
204
+ throw Error('Missing secret');
205
+ }
206
+ }
207
+ }
208
+ }
209
+ /**
210
+ * The openToken was old config.
211
+ * This method saves the openToken as the token in the config.json file
212
+ * @param this.config.credentials.openToken
213
+ */
214
+ async updateToken() {
215
+ try {
216
+ // check the new token was provided
217
+ if (!this.config.credentials?.openToken) {
218
+ throw new Error('New token not provided');
219
+ }
220
+ // load in the current config
221
+ const currentConfig = JSON.parse((0, fs_1.readFileSync)(this.api.user.configPath(), 'utf8'));
222
+ // check the platforms section is an array before we do array things on it
223
+ if (!Array.isArray(currentConfig.platforms)) {
224
+ throw new Error('Cannot find platforms array in config');
225
+ }
226
+ // find this plugins current config
227
+ const pluginConfig = currentConfig.platforms.find((x) => x.platform === settings_1.PLATFORM_NAME);
228
+ if (!pluginConfig) {
229
+ throw new Error(`Cannot find config for ${settings_1.PLATFORM_NAME} in platforms array`);
230
+ }
231
+ // check the .credentials is an object before doing object things with it
232
+ if (typeof pluginConfig.credentials !== 'object') {
233
+ throw new Error('pluginConfig.credentials is not an object');
234
+ }
235
+ // Move openToken to token
236
+ this.warnLog('This plugin has been updated to use OpenAPI v1.1, config is set with openToken.');
237
+ this.warnLog('`openToken` config has been moved to the `token` config, Please restart Homebridge.');
238
+ // set the refresh token
239
+ pluginConfig.credentials.token = this.config.credentials?.openToken;
240
+ pluginConfig.credentials.openToken = 'Delete';
241
+ if (this.platformLogging?.includes('debug')) {
242
+ this.warnLog(`Token: ${pluginConfig.credentials.token}`);
243
+ }
244
+ // save the config, ensuring we maintain pretty json
245
+ (0, fs_1.writeFileSync)(this.api.user.configPath(), JSON.stringify(currentConfig, null, 4));
246
+ this.verifyConfig();
247
+ }
248
+ catch (e) {
249
+ this.errorLog(e);
199
250
  }
200
251
  }
201
252
  /**
@@ -203,85 +254,123 @@ class SwitchBotPlatform {
203
254
  */
204
255
  async discoverDevices() {
205
256
  try {
206
- if (this.config.credentials?.openToken) {
207
- const devicesAPI = (await this.axios.get(settings_1.DeviceURL)).data;
208
- this.deviceListInfo(devicesAPI);
209
- this.debugLog(JSON.stringify(devicesAPI));
210
- // SwitchBot Devices
211
- if (devicesAPI.body.deviceList.length !== 0) {
212
- this.infoLog(`Total SwitchBot Devices Found: ${devicesAPI.body.deviceList.length}`);
213
- }
214
- else {
215
- this.debugLog(`Total SwitchBot Devices Found: ${devicesAPI.body.deviceList.length}`);
216
- }
217
- const deviceLists = devicesAPI.body.deviceList;
218
- if (!this.config.options?.devices) {
219
- this.debugLog(`SwitchBot Device Config Not Set: ${JSON.stringify(this.config.options?.devices)}`);
220
- const devices = deviceLists.map((v) => v);
221
- for (const device of devices) {
222
- if (device.deviceType) {
223
- if (device.configDeviceName) {
224
- device.deviceName = device.configDeviceName;
257
+ if (this.config.credentials?.token) {
258
+ const t = Date.now();
259
+ const nonce = 'requestID';
260
+ const data = this.config.credentials?.token + t + nonce;
261
+ const signTerm = crypto_1.default.createHmac('sha256', this.config.credentials?.secret).update(buffer_1.Buffer.from(data, 'utf-8')).digest();
262
+ const sign = signTerm.toString('base64');
263
+ this.debugLog(sign);
264
+ const options = {
265
+ hostname: settings_1.HostDomain,
266
+ port: 443,
267
+ path: settings_1.DevicePath,
268
+ method: 'GET',
269
+ headers: {
270
+ 'Authorization': this.config.credentials?.token,
271
+ 'sign': sign,
272
+ 'nonce': nonce,
273
+ 't': t,
274
+ 'Content-Type': 'application/json',
275
+ },
276
+ };
277
+ const req = https_1.default.request(options, (res) => {
278
+ this.debugLog(`statusCode: ${res.statusCode}`);
279
+ this.debugLog(`headers: ${JSON.stringify(res.headers)}`);
280
+ let rawData = '';
281
+ res.on('data', (d) => {
282
+ rawData += d;
283
+ this.debugLog(`d: ${d}`);
284
+ });
285
+ res.on('end', () => {
286
+ try {
287
+ const devicesAPI = JSON.parse(rawData);
288
+ this.debugLog(`devicesAPI: ${JSON.stringify(devicesAPI.body)}`);
289
+ // SwitchBot Devices
290
+ if (devicesAPI.body.deviceList.length !== 0) {
291
+ this.infoLog(`Total SwitchBot Devices Found: ${devicesAPI.body.deviceList.length}`);
225
292
  }
226
- this.createDevice(device);
227
- }
228
- }
229
- }
230
- else if (this.config.credentials?.openToken && this.config.options.devices) {
231
- this.debugLog(`SwitchBot Device Config Set: ${JSON.stringify(this.config.options?.devices)}`);
232
- const deviceConfigs = this.config.options?.devices;
233
- const mergeBydeviceId = (a1, a2) => a1.map((itm) => ({
234
- ...a2.find((item) => item.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') === itm.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') && item),
235
- ...itm,
236
- }));
237
- const devices = mergeBydeviceId(deviceLists, deviceConfigs);
238
- this.debugLog(`SwitchBot Devices: ${JSON.stringify(devices)}`);
239
- for (const device of devices) {
240
- if (device.deviceType) {
241
- if (device.configDeviceName) {
242
- device.deviceName = device.configDeviceName;
293
+ else {
294
+ this.debugLog(`Total SwitchBot Devices Found: ${devicesAPI.body.deviceList.length}`);
295
+ }
296
+ const deviceLists = devicesAPI.body.deviceList;
297
+ if (!this.config.options?.devices) {
298
+ this.debugLog(`SwitchBot Device Config Not Set: ${JSON.stringify(this.config.options?.devices)}`);
299
+ const devices = deviceLists.map((v) => v);
300
+ for (const device of devices) {
301
+ if (device.deviceType) {
302
+ if (device.configDeviceName) {
303
+ device.deviceName = device.configDeviceName;
304
+ }
305
+ this.createDevice(device);
306
+ }
307
+ }
308
+ }
309
+ else if (this.config.credentials?.token && this.config.options.devices) {
310
+ this.debugLog(`SwitchBot Device Config Set: ${JSON.stringify(this.config.options?.devices)}`);
311
+ const deviceConfigs = this.config.options?.devices;
312
+ const mergeBydeviceId = (a1, a2) => a1.map((itm) => ({
313
+ ...a2.find((item) => item.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') === itm.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') && item),
314
+ ...itm,
315
+ }));
316
+ const devices = mergeBydeviceId(deviceLists, deviceConfigs);
317
+ this.debugLog(`SwitchBot Devices: ${JSON.stringify(devices)}`);
318
+ for (const device of devices) {
319
+ if (device.deviceType) {
320
+ if (device.configDeviceName) {
321
+ device.deviceName = device.configDeviceName;
322
+ }
323
+ this.createDevice(device);
324
+ }
325
+ }
326
+ }
327
+ else {
328
+ this.errorLog('SwitchBot Token Supplied, Issue with Auth.');
329
+ }
330
+ // IR Devices
331
+ if (devicesAPI.body.infraredRemoteList.length !== 0) {
332
+ this.infoLog(`Total IR Devices Found: ${devicesAPI.body.infraredRemoteList.length}`);
333
+ }
334
+ else {
335
+ this.debugLog(`Total IR Devices Found: ${devicesAPI.body.infraredRemoteList.length}`);
336
+ }
337
+ const irDeviceLists = devicesAPI.body.infraredRemoteList;
338
+ if (!this.config.options?.irdevices) {
339
+ this.debugLog(`IR Device Config Not Set: ${JSON.stringify(this.config.options?.irdevices)}`);
340
+ const devices = irDeviceLists.map((v) => v);
341
+ for (const device of devices) {
342
+ if (device.remoteType) {
343
+ this.createIRDevice(device);
344
+ }
345
+ }
346
+ }
347
+ else {
348
+ this.debugLog(`IR Device Config Set: ${JSON.stringify(this.config.options?.irdevices)}`);
349
+ const irDeviceConfig = this.config.options?.irdevices;
350
+ const mergeIRBydeviceId = (a1, a2) => a1.map((itm) => ({
351
+ ...a2.find((item) => item.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') === itm.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') && item),
352
+ ...itm,
353
+ }));
354
+ const devices = mergeIRBydeviceId(irDeviceLists, irDeviceConfig);
355
+ this.debugLog(`IR Devices: ${JSON.stringify(devices)}`);
356
+ for (const device of devices) {
357
+ if (device.remoteType) {
358
+ this.createIRDevice(device);
359
+ }
360
+ }
243
361
  }
244
- this.createDevice(device);
245
- }
246
- }
247
- }
248
- else {
249
- this.errorLog('Neither SwitchBot OpenToken or Device Config are not set.');
250
- }
251
- // IR Devices
252
- if (devicesAPI.body.infraredRemoteList.length !== 0) {
253
- this.infoLog(`Total IR Devices Found: ${devicesAPI.body.infraredRemoteList.length}`);
254
- }
255
- else {
256
- this.debugLog(`Total IR Devices Found: ${devicesAPI.body.infraredRemoteList.length}`);
257
- }
258
- const irDeviceLists = devicesAPI.body.infraredRemoteList;
259
- if (!this.config.options?.irdevices) {
260
- this.debugLog(`IR Device Config Not Set: ${JSON.stringify(this.config.options?.irdevices)}`);
261
- const devices = irDeviceLists.map((v) => v);
262
- for (const device of devices) {
263
- if (device.remoteType) {
264
- this.createIRDevice(device);
265
362
  }
266
- }
267
- }
268
- else {
269
- this.debugLog(`IR Device Config Set: ${JSON.stringify(this.config.options?.irdevices)}`);
270
- const irDeviceConfig = this.config.options?.irdevices;
271
- const mergeIRBydeviceId = (a1, a2) => a1.map((itm) => ({
272
- ...a2.find((item) => item.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') === itm.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') && item),
273
- ...itm,
274
- }));
275
- const devices = mergeIRBydeviceId(irDeviceLists, irDeviceConfig);
276
- this.debugLog(`IR Devices: ${JSON.stringify(devices)}`);
277
- for (const device of devices) {
278
- if (device.remoteType) {
279
- this.createIRDevice(device);
363
+ catch (e) {
364
+ this.errorLog(e.message);
280
365
  }
281
- }
282
- }
366
+ });
367
+ });
368
+ req.on('error', (error) => {
369
+ this.errorLog(error);
370
+ });
371
+ req.end();
283
372
  }
284
- else if (!this.config.credentials?.openToken && this.config.options?.devices) {
373
+ else if (!this.config.credentials?.token && this.config.options?.devices) {
285
374
  this.debugLog(`SwitchBot Device Manual Config Set: ${JSON.stringify(this.config.options?.devices)}`);
286
375
  const deviceConfigs = this.config.options?.devices;
287
376
  const devices = deviceConfigs.map((v) => v);
@@ -294,7 +383,7 @@ class SwitchBotPlatform {
294
383
  }
295
384
  }
296
385
  else {
297
- this.errorLog('Neither SwitchBot OpenToken or Device Config are not set.');
386
+ this.errorLog('Neither SwitchBot Token or Device Config are not set.');
298
387
  }
299
388
  }
300
389
  catch (e) {
@@ -1579,7 +1668,36 @@ class SwitchBotPlatform {
1579
1668
  async deviceInfo(device) {
1580
1669
  if (this.platformLogging?.includes('debug')) {
1581
1670
  this.warnLog(JSON.stringify(device));
1582
- this.deviceStatus = (await this.axios.get(`${settings_1.DeviceURL}/${device.deviceId}/status`)).data;
1671
+ const t = Date.now();
1672
+ const nonce = 'requestID';
1673
+ const data = this.config.credentials?.token + t + nonce;
1674
+ const signTerm = crypto_1.default.createHmac('sha256', this.config.credentials?.secret).update(buffer_1.Buffer.from(data, 'utf-8')).digest();
1675
+ const sign = signTerm.toString('base64');
1676
+ this.debugLog(sign);
1677
+ const options = {
1678
+ hostname: settings_1.HostDomain,
1679
+ port: 443,
1680
+ path: `${settings_1.DevicePath}/${device.deviceId}/status`,
1681
+ method: 'GET',
1682
+ headers: {
1683
+ Authorization: this.config.credentials?.token,
1684
+ sign: sign,
1685
+ nonce: nonce,
1686
+ t: t,
1687
+ 'Content-Type': 'application/json',
1688
+ },
1689
+ };
1690
+ const req = https_1.default.request(options, (res) => {
1691
+ this.debugLog(`statusCode: ${res.statusCode}`);
1692
+ res.on('data', (d) => {
1693
+ process.stdout.write(d);
1694
+ });
1695
+ });
1696
+ req.on('error', (error) => {
1697
+ this.errorLog(error);
1698
+ });
1699
+ req.end();
1700
+ this.deviceStatus = req;
1583
1701
  if (this.deviceStatus.message === 'success') {
1584
1702
  this.warnLog(`${device.deviceName} deviceInfoStatus: ${JSON.stringify(this.deviceStatus)}`);
1585
1703
  }