@switchbot/homebridge-switchbot 2.0.0-beta.13 → 2.0.0-beta.15

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 (84) hide show
  1. package/dist/device/bot.d.ts.map +1 -1
  2. package/dist/device/bot.js +19 -18
  3. package/dist/device/bot.js.map +1 -1
  4. package/dist/device/colorbulb.js +25 -25
  5. package/dist/device/colorbulb.js.map +1 -1
  6. package/dist/device/contact.d.ts.map +1 -1
  7. package/dist/device/contact.js +7 -6
  8. package/dist/device/contact.js.map +1 -1
  9. package/dist/device/curtain.d.ts.map +1 -1
  10. package/dist/device/curtain.js +14 -13
  11. package/dist/device/curtain.js.map +1 -1
  12. package/dist/device/humidifier.d.ts.map +1 -1
  13. package/dist/device/humidifier.js +18 -17
  14. package/dist/device/humidifier.js.map +1 -1
  15. package/dist/device/lock.d.ts.map +1 -1
  16. package/dist/device/lock.js +8 -7
  17. package/dist/device/lock.js.map +1 -1
  18. package/dist/device/meter.d.ts.map +1 -1
  19. package/dist/device/meter.js +9 -8
  20. package/dist/device/meter.js.map +1 -1
  21. package/dist/device/meterplus.d.ts.map +1 -1
  22. package/dist/device/meterplus.js +8 -7
  23. package/dist/device/meterplus.js.map +1 -1
  24. package/dist/device/motion.d.ts.map +1 -1
  25. package/dist/device/motion.js +7 -6
  26. package/dist/device/motion.js.map +1 -1
  27. package/dist/device/plug.d.ts.map +1 -1
  28. package/dist/device/plug.js +13 -12
  29. package/dist/device/plug.js.map +1 -1
  30. package/dist/device/striplight.d.ts.map +1 -1
  31. package/dist/device/striplight.js +27 -26
  32. package/dist/device/striplight.js.map +1 -1
  33. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  34. package/dist/irdevice/airconditioner.js +10 -9
  35. package/dist/irdevice/airconditioner.js.map +1 -1
  36. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  37. package/dist/irdevice/airpurifier.js +8 -7
  38. package/dist/irdevice/airpurifier.js.map +1 -1
  39. package/dist/irdevice/camera.d.ts.map +1 -1
  40. package/dist/irdevice/camera.js +7 -6
  41. package/dist/irdevice/camera.js.map +1 -1
  42. package/dist/irdevice/fan.d.ts.map +1 -1
  43. package/dist/irdevice/fan.js +10 -9
  44. package/dist/irdevice/fan.js.map +1 -1
  45. package/dist/irdevice/light.d.ts.map +1 -1
  46. package/dist/irdevice/light.js +9 -8
  47. package/dist/irdevice/light.js.map +1 -1
  48. package/dist/irdevice/other.d.ts.map +1 -1
  49. package/dist/irdevice/other.js +7 -6
  50. package/dist/irdevice/other.js.map +1 -1
  51. package/dist/irdevice/tv.d.ts.map +1 -1
  52. package/dist/irdevice/tv.js +16 -15
  53. package/dist/irdevice/tv.js.map +1 -1
  54. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  55. package/dist/irdevice/vacuumcleaner.js +7 -6
  56. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  57. package/dist/irdevice/waterheater.d.ts.map +1 -1
  58. package/dist/irdevice/waterheater.js +7 -6
  59. package/dist/irdevice/waterheater.js.map +1 -1
  60. package/dist/platform.d.ts.map +1 -1
  61. package/dist/platform.js +44 -43
  62. package/dist/platform.js.map +1 -1
  63. package/package.json +1 -1
  64. package/src/device/bot.ts +19 -18
  65. package/src/device/colorbulb.ts +25 -25
  66. package/src/device/contact.ts +7 -6
  67. package/src/device/curtain.ts +14 -13
  68. package/src/device/humidifier.ts +18 -17
  69. package/src/device/lock.ts +8 -7
  70. package/src/device/meter.ts +9 -8
  71. package/src/device/meterplus.ts +8 -7
  72. package/src/device/motion.ts +7 -6
  73. package/src/device/plug.ts +13 -12
  74. package/src/device/striplight.ts +27 -26
  75. package/src/irdevice/airconditioner.ts +10 -9
  76. package/src/irdevice/airpurifier.ts +8 -7
  77. package/src/irdevice/camera.ts +7 -6
  78. package/src/irdevice/fan.ts +10 -9
  79. package/src/irdevice/light.ts +9 -8
  80. package/src/irdevice/other.ts +7 -6
  81. package/src/irdevice/tv.ts +16 -15
  82. package/src/irdevice/vacuumcleaner.ts +7 -6
  83. package/src/irdevice/waterheater.ts +7 -6
  84. package/src/platform.ts +44 -43
package/dist/platform.js CHANGED
@@ -28,6 +28,7 @@ const https_1 = __importDefault(require("https"));
28
28
  const crypto_1 = __importDefault(require("crypto"));
29
29
  const buffer_1 = require("buffer");
30
30
  const fakegato_history_1 = __importDefault(require("fakegato-history"));
31
+ const super_stringify_1 = __importDefault(require("super-stringify"));
31
32
  const fs_1 = require("fs");
32
33
  const settings_1 = require("./settings");
33
34
  /**
@@ -61,9 +62,9 @@ class SwitchBotPlatform {
61
62
  this.debugLog('Config OK');
62
63
  }
63
64
  catch (e) {
64
- this.errorLog(JSON.stringify(e.message));
65
+ this.errorLog((0, super_stringify_1.default)(e.message));
65
66
  if (this.platformLogging?.includes('debug')) {
66
- this.errorLog(JSON.stringify(e));
67
+ this.errorLog((0, super_stringify_1.default)(e));
67
68
  }
68
69
  return;
69
70
  }
@@ -85,9 +86,9 @@ class SwitchBotPlatform {
85
86
  }
86
87
  }
87
88
  catch (e) {
88
- this.errorLog('Failed to Discover Devices.', JSON.stringify(e.message));
89
+ this.errorLog('Failed to Discover Devices.', (0, super_stringify_1.default)(e.message));
89
90
  if (this.platformLogging?.includes('debug')) {
90
- this.errorLog(JSON.stringify(e));
91
+ this.errorLog((0, super_stringify_1.default)(e));
91
92
  }
92
93
  }
93
94
  });
@@ -138,7 +139,7 @@ class SwitchBotPlatform {
138
139
  platformConfig['pushRate'] = this.config.options.pushRate;
139
140
  }
140
141
  if (Object.entries(platformConfig).length !== 0) {
141
- this.infoLog(`Platform Config: ${JSON.stringify(platformConfig)}`);
142
+ this.infoLog(`Platform Config: ${(0, super_stringify_1.default)(platformConfig)}`);
142
143
  }
143
144
  if (this.config.options) {
144
145
  // Device Config
@@ -242,7 +243,7 @@ class SwitchBotPlatform {
242
243
  this.warnLog(`Token: ${pluginConfig.credentials.token}`);
243
244
  }
244
245
  // save the config, ensuring we maintain pretty json
245
- (0, fs_1.writeFileSync)(this.api.user.configPath(), JSON.stringify(currentConfig, null, 4));
246
+ (0, fs_1.writeFileSync)(this.api.user.configPath(), (0, super_stringify_1.default)(currentConfig, null, 4));
246
247
  this.verifyConfig();
247
248
  }
248
249
  catch (e) {
@@ -276,7 +277,7 @@ class SwitchBotPlatform {
276
277
  };
277
278
  const req = https_1.default.request(options, (res) => {
278
279
  this.debugLog(`statusCode: ${res.statusCode}`);
279
- this.debugLog(`headers: ${JSON.stringify(res.headers)}`);
280
+ this.debugLog(`headers: ${(0, super_stringify_1.default)(res.headers)}`);
280
281
  let rawData = '';
281
282
  res.on('data', (d) => {
282
283
  rawData += d;
@@ -285,7 +286,7 @@ class SwitchBotPlatform {
285
286
  res.on('end', () => {
286
287
  try {
287
288
  const devicesAPI = JSON.parse(rawData);
288
- this.debugLog(`devicesAPI: ${JSON.stringify(devicesAPI.body)}`);
289
+ this.debugLog(`devicesAPI: ${(0, super_stringify_1.default)(devicesAPI.body)}`);
289
290
  // SwitchBot Devices
290
291
  if (devicesAPI.body.deviceList.length !== 0) {
291
292
  this.infoLog(`Total SwitchBot Devices Found: ${devicesAPI.body.deviceList.length}`);
@@ -295,7 +296,7 @@ class SwitchBotPlatform {
295
296
  }
296
297
  const deviceLists = devicesAPI.body.deviceList;
297
298
  if (!this.config.options?.devices) {
298
- this.debugLog(`SwitchBot Device Config Not Set: ${JSON.stringify(this.config.options?.devices)}`);
299
+ this.debugLog(`SwitchBot Device Config Not Set: ${(0, super_stringify_1.default)(this.config.options?.devices)}`);
299
300
  const devices = deviceLists.map((v) => v);
300
301
  for (const device of devices) {
301
302
  if (device.deviceType) {
@@ -307,14 +308,14 @@ class SwitchBotPlatform {
307
308
  }
308
309
  }
309
310
  else if (this.config.credentials?.token && this.config.options.devices) {
310
- this.debugLog(`SwitchBot Device Config Set: ${JSON.stringify(this.config.options?.devices)}`);
311
+ this.debugLog(`SwitchBot Device Config Set: ${(0, super_stringify_1.default)(this.config.options?.devices)}`);
311
312
  const deviceConfigs = this.config.options?.devices;
312
313
  const mergeBydeviceId = (a1, a2) => a1.map((itm) => ({
313
314
  ...a2.find((item) => item.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') === itm.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') && item),
314
315
  ...itm,
315
316
  }));
316
317
  const devices = mergeBydeviceId(deviceLists, deviceConfigs);
317
- this.debugLog(`SwitchBot Devices: ${JSON.stringify(devices)}`);
318
+ this.debugLog(`SwitchBot Devices: ${(0, super_stringify_1.default)(devices)}`);
318
319
  for (const device of devices) {
319
320
  if (device.deviceType) {
320
321
  if (device.configDeviceName) {
@@ -336,7 +337,7 @@ class SwitchBotPlatform {
336
337
  }
337
338
  const irDeviceLists = devicesAPI.body.infraredRemoteList;
338
339
  if (!this.config.options?.irdevices) {
339
- this.debugLog(`IR Device Config Not Set: ${JSON.stringify(this.config.options?.irdevices)}`);
340
+ this.debugLog(`IR Device Config Not Set: ${(0, super_stringify_1.default)(this.config.options?.irdevices)}`);
340
341
  const devices = irDeviceLists.map((v) => v);
341
342
  for (const device of devices) {
342
343
  if (device.remoteType) {
@@ -345,14 +346,14 @@ class SwitchBotPlatform {
345
346
  }
346
347
  }
347
348
  else {
348
- this.debugLog(`IR Device Config Set: ${JSON.stringify(this.config.options?.irdevices)}`);
349
+ this.debugLog(`IR Device Config Set: ${(0, super_stringify_1.default)(this.config.options?.irdevices)}`);
349
350
  const irDeviceConfig = this.config.options?.irdevices;
350
351
  const mergeIRBydeviceId = (a1, a2) => a1.map((itm) => ({
351
352
  ...a2.find((item) => item.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') === itm.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') && item),
352
353
  ...itm,
353
354
  }));
354
355
  const devices = mergeIRBydeviceId(irDeviceLists, irDeviceConfig);
355
- this.debugLog(`IR Devices: ${JSON.stringify(devices)}`);
356
+ this.debugLog(`IR Devices: ${(0, super_stringify_1.default)(devices)}`);
356
357
  for (const device of devices) {
357
358
  if (device.remoteType) {
358
359
  this.createIRDevice(device);
@@ -371,7 +372,7 @@ class SwitchBotPlatform {
371
372
  req.end();
372
373
  }
373
374
  else if (!this.config.credentials?.token && this.config.options?.devices) {
374
- this.debugLog(`SwitchBot Device Manual Config Set: ${JSON.stringify(this.config.options?.devices)}`);
375
+ this.debugLog(`SwitchBot Device Manual Config Set: ${(0, super_stringify_1.default)(this.config.options?.devices)}`);
375
376
  const deviceConfigs = this.config.options?.devices;
376
377
  const devices = deviceConfigs.map((v) => v);
377
378
  for (const device of devices) {
@@ -432,10 +433,10 @@ class SwitchBotPlatform {
432
433
  this.errorLog('Failed to Discover Devices');
433
434
  }
434
435
  if (this.platformLogging === 'debug') {
435
- this.errorLog(`Failed to Discover Devices, Error Message: ${JSON.stringify(e.message)}`);
436
+ this.errorLog(`Failed to Discover Devices, Error Message: ${(0, super_stringify_1.default)(e.message)}`);
436
437
  }
437
438
  if (this.platformLogging === 'debugMode') {
438
- this.errorLog(`Failed to Discover Devices, Error: ${JSON.stringify(e)}`);
439
+ this.errorLog(`Failed to Discover Devices, Error: ${(0, super_stringify_1.default)(e)}`);
439
440
  }
440
441
  }
441
442
  createDevice(device) {
@@ -581,7 +582,7 @@ class SwitchBotPlatform {
581
582
  //existingAccessory.context.firmwareRevision = firmware;
582
583
  existingAccessory.context.model = device.deviceType;
583
584
  existingAccessory.context.deviceID = device.deviceId;
584
- existingAccessory.displayName = device.deviceName;
585
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
585
586
  existingAccessory.context.firmwareRevision = device.firmware;
586
587
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
587
588
  await this.connectionTypeExistingAccessory(device, existingAccessory);
@@ -629,11 +630,11 @@ class SwitchBotPlatform {
629
630
  // the accessory already exists
630
631
  if (this.registerDevice(device)) {
631
632
  this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName} DeviceID: ${device.deviceId}`);
632
- this.debugLog(JSON.stringify(device.bot?.mode));
633
+ this.debugLog((0, super_stringify_1.default)(device.bot?.mode));
633
634
  // if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
634
635
  existingAccessory.context.model = device.deviceType;
635
636
  existingAccessory.context.deviceID = device.deviceId;
636
- existingAccessory.displayName = device.deviceName;
637
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
637
638
  existingAccessory.context.firmwareRevision = device.firmware;
638
639
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
639
640
  await this.connectionTypeExistingAccessory(device, existingAccessory);
@@ -650,7 +651,7 @@ class SwitchBotPlatform {
650
651
  else if (this.registerDevice(device)) {
651
652
  // the accessory does not yet exist, so we need to create it
652
653
  this.infoLog(`Adding new accessory: ${device.deviceName} ${device.deviceType} DeviceID: ${device.deviceId}`);
653
- this.debugLog(JSON.stringify(device.bot?.mode));
654
+ this.debugLog((0, super_stringify_1.default)(device.bot?.mode));
654
655
  // create a new accessory
655
656
  const accessory = new this.api.platformAccessory(device.deviceName, uuid);
656
657
  // store a copy of the device object in the `accessory.context`
@@ -686,7 +687,7 @@ class SwitchBotPlatform {
686
687
  // if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
687
688
  existingAccessory.context.model = device.deviceType;
688
689
  existingAccessory.context.deviceID = device.deviceId;
689
- existingAccessory.displayName = device.deviceName;
690
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
690
691
  existingAccessory.context.firmwareRevision = device.firmware;
691
692
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
692
693
  await this.connectionTypeExistingAccessory(device, existingAccessory);
@@ -737,7 +738,7 @@ class SwitchBotPlatform {
737
738
  // if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
738
739
  existingAccessory.context.model = device.deviceType;
739
740
  existingAccessory.context.deviceID = device.deviceId;
740
- existingAccessory.displayName = device.deviceName;
741
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
741
742
  existingAccessory.context.firmwareRevision = device.firmware;
742
743
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
743
744
  await this.connectionTypeExistingAccessory(device, existingAccessory);
@@ -788,7 +789,7 @@ class SwitchBotPlatform {
788
789
  // if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
789
790
  existingAccessory.context.model = device.deviceType;
790
791
  existingAccessory.context.deviceID = device.deviceId;
791
- existingAccessory.displayName = device.deviceName;
792
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
792
793
  existingAccessory.context.firmwareRevision = device.firmware;
793
794
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
794
795
  await this.connectionTypeExistingAccessory(device, existingAccessory);
@@ -839,7 +840,7 @@ class SwitchBotPlatform {
839
840
  // if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
840
841
  existingAccessory.context.model = device.deviceType;
841
842
  existingAccessory.context.deviceID = device.deviceId;
842
- existingAccessory.displayName = device.deviceName;
843
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
843
844
  existingAccessory.context.firmwareRevision = device.firmware;
844
845
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
845
846
  await this.connectionTypeExistingAccessory(device, existingAccessory);
@@ -890,7 +891,7 @@ class SwitchBotPlatform {
890
891
  // if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
891
892
  existingAccessory.context.model = device.deviceType;
892
893
  existingAccessory.context.deviceID = device.deviceId;
893
- existingAccessory.displayName = device.deviceName;
894
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
894
895
  existingAccessory.context.firmwareRevision = device.firmware;
895
896
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
896
897
  await this.connectionTypeExistingAccessory(device, existingAccessory);
@@ -965,7 +966,7 @@ class SwitchBotPlatform {
965
966
  // if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
966
967
  existingAccessory.context.model = device.deviceType;
967
968
  existingAccessory.context.deviceID = device.deviceId;
968
- existingAccessory.displayName = device.deviceName;
969
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
969
970
  existingAccessory.context.firmwareRevision = device.firmware;
970
971
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
971
972
  await this.connectionTypeExistingAccessory(device, existingAccessory);
@@ -1016,7 +1017,7 @@ class SwitchBotPlatform {
1016
1017
  // if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
1017
1018
  existingAccessory.context.model = device.deviceType;
1018
1019
  existingAccessory.context.deviceID = device.deviceId;
1019
- existingAccessory.displayName = device.deviceName;
1020
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
1020
1021
  existingAccessory.context.firmwareRevision = device.firmware;
1021
1022
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1022
1023
  await this.connectionTypeExistingAccessory(device, existingAccessory);
@@ -1067,7 +1068,7 @@ class SwitchBotPlatform {
1067
1068
  // if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
1068
1069
  existingAccessory.context.model = device.deviceType;
1069
1070
  existingAccessory.context.deviceID = device.deviceId;
1070
- existingAccessory.displayName = device.deviceName;
1071
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
1071
1072
  existingAccessory.context.firmwareRevision = device.firmware;
1072
1073
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1073
1074
  await this.connectionTypeExistingAccessory(device, existingAccessory);
@@ -1118,7 +1119,7 @@ class SwitchBotPlatform {
1118
1119
  // if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
1119
1120
  existingAccessory.context.model = device.deviceType;
1120
1121
  existingAccessory.context.deviceID = device.deviceId;
1121
- existingAccessory.displayName = device.deviceName;
1122
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
1122
1123
  existingAccessory.context.firmwareRevision = device.firmware;
1123
1124
  existingAccessory.context.deviceType = `SwitchBot: ${device.deviceType}`;
1124
1125
  await this.connectionTypeExistingAccessory(device, existingAccessory);
@@ -1167,7 +1168,7 @@ class SwitchBotPlatform {
1167
1168
  // if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
1168
1169
  existingAccessory.context.model = device.remoteType;
1169
1170
  existingAccessory.context.deviceID = device.deviceId;
1170
- existingAccessory.displayName = device.deviceName;
1171
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
1171
1172
  existingAccessory.context.firmwareRevision = device.firmware;
1172
1173
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1173
1174
  await this.connectionTypeExistingIRAccessory(existingAccessory);
@@ -1218,7 +1219,7 @@ class SwitchBotPlatform {
1218
1219
  // if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
1219
1220
  existingAccessory.context.model = device.remoteType;
1220
1221
  existingAccessory.context.deviceID = device.deviceId;
1221
- existingAccessory.displayName = device.deviceName;
1222
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
1222
1223
  existingAccessory.context.firmwareRevision = device.firmware;
1223
1224
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1224
1225
  await this.connectionTypeExistingIRAccessory(existingAccessory);
@@ -1269,7 +1270,7 @@ class SwitchBotPlatform {
1269
1270
  // if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
1270
1271
  existingAccessory.context.model = device.remoteType;
1271
1272
  existingAccessory.context.deviceID = device.deviceId;
1272
- existingAccessory.displayName = device.deviceName;
1273
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
1273
1274
  existingAccessory.context.firmwareRevision = device.firmware;
1274
1275
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1275
1276
  await this.connectionTypeExistingIRAccessory(existingAccessory);
@@ -1320,7 +1321,7 @@ class SwitchBotPlatform {
1320
1321
  // if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
1321
1322
  existingAccessory.context.model = device.remoteType;
1322
1323
  existingAccessory.context.deviceID = device.deviceId;
1323
- existingAccessory.displayName = device.deviceName;
1324
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
1324
1325
  existingAccessory.context.firmwareRevision = device.firmware;
1325
1326
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1326
1327
  await this.connectionTypeExistingIRAccessory(existingAccessory);
@@ -1371,7 +1372,7 @@ class SwitchBotPlatform {
1371
1372
  // if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
1372
1373
  existingAccessory.context.model = device.remoteType;
1373
1374
  existingAccessory.context.deviceID = device.deviceId;
1374
- existingAccessory.displayName = device.deviceName;
1375
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
1375
1376
  existingAccessory.context.firmwareRevision = device.firmware;
1376
1377
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1377
1378
  await this.connectionTypeExistingIRAccessory(existingAccessory);
@@ -1422,7 +1423,7 @@ class SwitchBotPlatform {
1422
1423
  // if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
1423
1424
  existingAccessory.context.model = device.remoteType;
1424
1425
  existingAccessory.context.deviceID = device.deviceId;
1425
- existingAccessory.displayName = device.deviceName;
1426
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
1426
1427
  existingAccessory.context.firmwareRevision = device.firmware;
1427
1428
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1428
1429
  await this.connectionTypeExistingIRAccessory(existingAccessory);
@@ -1473,7 +1474,7 @@ class SwitchBotPlatform {
1473
1474
  // if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
1474
1475
  existingAccessory.context.model = device.remoteType;
1475
1476
  existingAccessory.context.deviceID = device.deviceId;
1476
- existingAccessory.displayName = device.deviceName;
1477
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
1477
1478
  existingAccessory.context.firmwareRevision = device.firmware;
1478
1479
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1479
1480
  await this.connectionTypeExistingIRAccessory(existingAccessory);
@@ -1524,7 +1525,7 @@ class SwitchBotPlatform {
1524
1525
  // if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
1525
1526
  existingAccessory.context.model = device.remoteType;
1526
1527
  existingAccessory.context.deviceID = device.deviceId;
1527
- existingAccessory.displayName = device.deviceName;
1528
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
1528
1529
  existingAccessory.context.firmwareRevision = device.firmware;
1529
1530
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1530
1531
  await this.connectionTypeExistingIRAccessory(existingAccessory);
@@ -1575,7 +1576,7 @@ class SwitchBotPlatform {
1575
1576
  // if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:
1576
1577
  existingAccessory.context.model = device.remoteType;
1577
1578
  existingAccessory.context.deviceID = device.deviceId;
1578
- existingAccessory.displayName = device.deviceName;
1579
+ existingAccessory.displayName = device.configDeviceName || device.deviceName;
1579
1580
  existingAccessory.context.firmwareRevision = device.firmware;
1580
1581
  existingAccessory.context.deviceType = `IR: ${device.remoteType}`;
1581
1582
  await this.connectionTypeExistingIRAccessory(existingAccessory);
@@ -1676,12 +1677,12 @@ class SwitchBotPlatform {
1676
1677
  }
1677
1678
  deviceListInfo(devices) {
1678
1679
  if (this.platformLogging?.includes('debug')) {
1679
- this.warnLog(`deviceListInfoStatus: ${JSON.stringify(devices)}`);
1680
+ this.warnLog(`deviceListInfoStatus: ${(0, super_stringify_1.default)(devices)}`);
1680
1681
  }
1681
1682
  }
1682
1683
  async deviceInfo(device) {
1683
1684
  if (this.platformLogging?.includes('debug')) {
1684
- this.warnLog(JSON.stringify(device));
1685
+ this.warnLog((0, super_stringify_1.default)(device));
1685
1686
  const t = Date.now();
1686
1687
  const nonce = 'requestID';
1687
1688
  const data = this.config.credentials?.token + t + nonce;
@@ -1713,10 +1714,10 @@ class SwitchBotPlatform {
1713
1714
  req.end();
1714
1715
  this.deviceStatus = req;
1715
1716
  if (this.deviceStatus.message === 'success') {
1716
- this.warnLog(`${device.deviceName} deviceInfoStatus: ${JSON.stringify(this.deviceStatus)}`);
1717
+ this.warnLog(`${device.deviceName} deviceInfoStatus: ${(0, super_stringify_1.default)(this.deviceStatus)}`);
1717
1718
  }
1718
1719
  else {
1719
- this.warnLog(`${device.deviceName} deviceInfoStatus: ${JSON.stringify(this.deviceStatus.message)}`);
1720
+ this.warnLog(`${device.deviceName} deviceInfoStatus: ${(0, super_stringify_1.default)(this.deviceStatus.message)}`);
1720
1721
  this.warnLog('Unable to retreive deviceInfoStatus.');
1721
1722
  }
1722
1723
  }