@switchbot/homebridge-switchbot 1.8.3-beta.0 → 1.9.0

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 (105) hide show
  1. package/.eslintrc +1 -1
  2. package/.vscode/settings.json +1 -1
  3. package/CHANGELOG.md +8 -0
  4. package/config.schema.json +9 -0
  5. package/dist/devices/bots.d.ts +37 -34
  6. package/dist/devices/bots.d.ts.map +1 -1
  7. package/dist/devices/bots.js +196 -243
  8. package/dist/devices/bots.js.map +1 -1
  9. package/dist/devices/colorbulb.d.ts +50 -50
  10. package/dist/devices/colorbulb.d.ts.map +1 -1
  11. package/dist/devices/colorbulb.js +131 -145
  12. package/dist/devices/colorbulb.js.map +1 -1
  13. package/dist/devices/contact.d.ts +29 -27
  14. package/dist/devices/contact.d.ts.map +1 -1
  15. package/dist/devices/contact.js +115 -138
  16. package/dist/devices/contact.js.map +1 -1
  17. package/dist/devices/curtains.d.ts +31 -29
  18. package/dist/devices/curtains.d.ts.map +1 -1
  19. package/dist/devices/curtains.js +176 -211
  20. package/dist/devices/curtains.js.map +1 -1
  21. package/dist/devices/humidifiers.d.ts +33 -33
  22. package/dist/devices/humidifiers.d.ts.map +1 -1
  23. package/dist/devices/humidifiers.js +189 -214
  24. package/dist/devices/humidifiers.js.map +1 -1
  25. package/dist/devices/meters.d.ts +31 -30
  26. package/dist/devices/meters.d.ts.map +1 -1
  27. package/dist/devices/meters.js +100 -124
  28. package/dist/devices/meters.js.map +1 -1
  29. package/dist/devices/motion.d.ts +26 -25
  30. package/dist/devices/motion.d.ts.map +1 -1
  31. package/dist/devices/motion.js +102 -120
  32. package/dist/devices/motion.js.map +1 -1
  33. package/dist/devices/plugs.d.ts +23 -23
  34. package/dist/devices/plugs.d.ts.map +1 -1
  35. package/dist/devices/plugs.js +63 -81
  36. package/dist/devices/plugs.js.map +1 -1
  37. package/dist/index.d.ts +2 -2
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +3 -22
  40. package/dist/index.js.map +1 -1
  41. package/dist/irdevices/airconditioners.d.ts +6 -6
  42. package/dist/irdevices/airconditioners.d.ts.map +1 -1
  43. package/dist/irdevices/airconditioners.js +79 -105
  44. package/dist/irdevices/airconditioners.js.map +1 -1
  45. package/dist/irdevices/airpurifiers.d.ts +5 -5
  46. package/dist/irdevices/airpurifiers.d.ts.map +1 -1
  47. package/dist/irdevices/airpurifiers.js +42 -56
  48. package/dist/irdevices/airpurifiers.js.map +1 -1
  49. package/dist/irdevices/cameras.d.ts +5 -5
  50. package/dist/irdevices/cameras.d.ts.map +1 -1
  51. package/dist/irdevices/cameras.js +27 -31
  52. package/dist/irdevices/cameras.js.map +1 -1
  53. package/dist/irdevices/fans.d.ts +5 -5
  54. package/dist/irdevices/fans.d.ts.map +1 -1
  55. package/dist/irdevices/fans.js +38 -45
  56. package/dist/irdevices/fans.js.map +1 -1
  57. package/dist/irdevices/lights.d.ts +5 -5
  58. package/dist/irdevices/lights.d.ts.map +1 -1
  59. package/dist/irdevices/lights.js +33 -37
  60. package/dist/irdevices/lights.js.map +1 -1
  61. package/dist/irdevices/others.d.ts +5 -5
  62. package/dist/irdevices/others.d.ts.map +1 -1
  63. package/dist/irdevices/others.js +29 -34
  64. package/dist/irdevices/others.js.map +1 -1
  65. package/dist/irdevices/tvs.d.ts +5 -5
  66. package/dist/irdevices/tvs.d.ts.map +1 -1
  67. package/dist/irdevices/tvs.js +76 -91
  68. package/dist/irdevices/tvs.js.map +1 -1
  69. package/dist/irdevices/vacuumcleaners.d.ts +5 -5
  70. package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
  71. package/dist/irdevices/vacuumcleaners.js +27 -31
  72. package/dist/irdevices/vacuumcleaners.js.map +1 -1
  73. package/dist/irdevices/waterheaters.d.ts +5 -5
  74. package/dist/irdevices/waterheaters.d.ts.map +1 -1
  75. package/dist/irdevices/waterheaters.js +27 -31
  76. package/dist/irdevices/waterheaters.js.map +1 -1
  77. package/dist/platform.d.ts +12 -12
  78. package/dist/platform.d.ts.map +1 -1
  79. package/dist/platform.js +172 -241
  80. package/dist/platform.js.map +1 -1
  81. package/dist/settings.d.ts +2 -1
  82. package/dist/settings.d.ts.map +1 -1
  83. package/dist/settings.js +4 -4
  84. package/dist/settings.js.map +1 -1
  85. package/package.json +71 -72
  86. package/src/devices/bots.ts +455 -929
  87. package/src/devices/colorbulb.ts +246 -473
  88. package/src/devices/contact.ts +208 -381
  89. package/src/devices/curtains.ts +321 -613
  90. package/src/devices/humidifiers.ts +323 -594
  91. package/src/devices/meters.ts +186 -331
  92. package/src/devices/motion.ts +184 -327
  93. package/src/devices/plugs.ts +107 -175
  94. package/src/index.ts +5 -5
  95. package/src/irdevices/airconditioners.ts +149 -360
  96. package/src/irdevices/airpurifiers.ts +80 -178
  97. package/src/irdevices/cameras.ts +51 -109
  98. package/src/irdevices/fans.ts +77 -174
  99. package/src/irdevices/lights.ts +57 -110
  100. package/src/irdevices/others.ts +62 -137
  101. package/src/irdevices/tvs.ts +124 -249
  102. package/src/irdevices/vacuumcleaners.ts +52 -112
  103. package/src/irdevices/waterheaters.ts +53 -115
  104. package/src/platform.ts +357 -768
  105. package/src/settings.ts +24 -17
@@ -1,28 +1,9 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
2
  Object.defineProperty(exports, "__esModule", { value: true });
22
3
  exports.Curtain = void 0;
23
- const rxjs = __importStar(require("rxjs"));
24
- const operators = __importStar(require("rxjs/operators"));
25
- const settings = __importStar(require("../settings"));
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const settings_1 = require("../settings");
26
7
  class Curtain {
27
8
  constructor(platform, accessory, device) {
28
9
  this.platform = platform;
@@ -38,7 +19,7 @@ class Curtain {
38
19
  this.TargetPosition = 0;
39
20
  this.PositionState = this.platform.Characteristic.PositionState.STOPPED;
40
21
  // this is subject we use to track when we need to POST changes to the SwitchBot API
41
- this.doCurtainUpdate = new rxjs.Subject();
22
+ this.doCurtainUpdate = new rxjs_1.Subject();
42
23
  this.curtainUpdateInProgress = false;
43
24
  this.setNewTarget = false;
44
25
  // Retrieve initial values and updateHomekit
@@ -46,15 +27,14 @@ class Curtain {
46
27
  // set accessory information
47
28
  accessory
48
29
  .getService(this.platform.Service.AccessoryInformation)
49
- .setCharacteristic(this.platform.Characteristic.Manufacturer, "SwitchBot")
50
- .setCharacteristic(this.platform.Characteristic.Model, "SWITCHBOT-CURTAIN-W0701600")
30
+ .setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
31
+ .setCharacteristic(this.platform.Characteristic.Model, 'SWITCHBOT-CURTAIN-W0701600')
51
32
  .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId);
52
33
  // get the WindowCovering service if it exists, otherwise create a new WindowCovering service
53
34
  // you can create multiple services for each accessory
54
35
  (this.service =
55
36
  accessory.getService(this.platform.Service.WindowCovering) ||
56
- accessory.addService(this.platform.Service.WindowCovering)),
57
- `${device.deviceName} ${device.deviceType}`;
37
+ accessory.addService(this.platform.Service.WindowCovering)), `${device.deviceName} ${device.deviceType}`;
58
38
  // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
59
39
  // when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
60
40
  // accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Lightbulb, 'NAME', 'USER_DEFINED_SUBTYPE');
@@ -93,8 +73,7 @@ class Curtain {
93
73
  this.debugLog(`Curtain: ${accessory.displayName} Add Light Sensor Service`);
94
74
  (this.lightSensorService =
95
75
  this.accessory.getService(this.platform.Service.LightSensor) ||
96
- this.accessory.addService(this.platform.Service.LightSensor)),
97
- `${accessory.displayName} Light Sensor`;
76
+ this.accessory.addService(this.platform.Service.LightSensor)), `${accessory.displayName} Light Sensor`;
98
77
  this.lightSensorService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Light Sensor`);
99
78
  }
100
79
  else {
@@ -110,8 +89,7 @@ class Curtain {
110
89
  this.debugLog(`Curtain: ${accessory.displayName} Add Battery Service`);
111
90
  (this.batteryService =
112
91
  this.accessory.getService(this.platform.Service.Battery) ||
113
- this.accessory.addService(this.platform.Service.Battery)),
114
- `${accessory.displayName} Battery`;
92
+ this.accessory.addService(this.platform.Service.Battery)), `${accessory.displayName} Battery`;
115
93
  this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`);
116
94
  }
117
95
  else {
@@ -120,19 +98,16 @@ class Curtain {
120
98
  // Update Homekit
121
99
  this.updateHomeKitCharacteristics();
122
100
  // Start an update interval
123
- rxjs
124
- .interval(this.deviceRefreshRate * 1000)
125
- .pipe(operators.skipWhile(() => this.curtainUpdateInProgress))
101
+ (0, rxjs_1.interval)(this.deviceRefreshRate * 1000)
102
+ .pipe((0, operators_1.skipWhile)(() => this.curtainUpdateInProgress))
126
103
  .subscribe(() => {
127
104
  this.refreshStatus();
128
105
  });
129
106
  // update slide progress
130
- rxjs
131
- .interval(this.updateRate * 1000)
132
- .pipe(operators.skipWhile(() => this.curtainUpdateInProgress))
107
+ (0, rxjs_1.interval)(this.updateRate * 1000)
108
+ .pipe((0, operators_1.skipWhile)(() => this.curtainUpdateInProgress))
133
109
  .subscribe(() => {
134
- if (this.PositionState ===
135
- this.platform.Characteristic.PositionState.STOPPED) {
110
+ if (this.PositionState === this.platform.Characteristic.PositionState.STOPPED) {
136
111
  return;
137
112
  }
138
113
  this.debugLog(`Curtain: ${accessory.displayName} Refresh Status When Moving, PositionState: ${this.PositionState}`);
@@ -141,18 +116,22 @@ class Curtain {
141
116
  // Watch for Curtain change events
142
117
  // We put in a debounce of 100ms so we don't make duplicate calls
143
118
  this.doCurtainUpdate
144
- .pipe(operators.tap(() => {
119
+ .pipe((0, operators_1.tap)(() => {
145
120
  this.curtainUpdateInProgress = true;
146
- }), operators.debounceTime(this.platform.config.options.pushRate * 1000))
121
+ }), (0, operators_1.debounceTime)(this.platform.config.options.pushRate * 1000))
147
122
  .subscribe(async () => {
148
123
  try {
149
124
  await this.pushChanges();
150
125
  }
151
126
  catch (e) {
152
127
  this.errorLog(`Curtain: ${this.accessory.displayName} failed pushChanges`);
153
- if (this.deviceLogging.includes("debug")) {
154
- this.errorLog(`Curtain: ${this.accessory.displayName} failed pushChanges,` +
155
- ` Error Message: ${JSON.stringify(e.message)}`);
128
+ if (this.deviceLogging === 'debug') {
129
+ this.errorLog(`Curtain: ${this.accessory.displayName} failed pushChanges,`
130
+ + ` Error Message: ${JSON.stringify(e.message)}`);
131
+ }
132
+ if (this.platform.debugMode) {
133
+ this.errorLog(`Curtain: ${this.accessory.displayName} failed pushChanges,`
134
+ + ` Error: ${JSON.stringify(e)}`);
156
135
  }
157
136
  this.apiError(e);
158
137
  }
@@ -183,13 +162,11 @@ class Curtain {
183
162
  this.setMinMax();
184
163
  if (this.TargetPosition > this.CurrentPosition) {
185
164
  this.debugLog(`Curtain: ${this.accessory.displayName} Closing, CurrentPosition: ${this.CurrentPosition}`);
186
- this.PositionState =
187
- this.platform.Characteristic.PositionState.INCREASING;
165
+ this.PositionState = this.platform.Characteristic.PositionState.INCREASING;
188
166
  }
189
167
  else if (this.TargetPosition < this.CurrentPosition) {
190
168
  this.debugLog(`Curtain: ${this.accessory.displayName} Opening, CurrentPosition: ${this.CurrentPosition}`);
191
- this.PositionState =
192
- this.platform.Characteristic.PositionState.DECREASING;
169
+ this.PositionState = this.platform.Characteristic.PositionState.DECREASING;
193
170
  }
194
171
  else {
195
172
  this.debugLog(`Curtain: ${this.CurrentPosition} Standby, CurrentPosition: ${this.CurrentPosition}`);
@@ -205,8 +182,8 @@ class Curtain {
205
182
  this.debugLog(`Curtain: ${this.accessory.displayName} Stopped`);
206
183
  }
207
184
  }
208
- this.debugLog(`Curtain: ${this.accessory.displayName} CurrentPosition: ${this.CurrentPosition},` +
209
- ` TargetPosition: ${this.TargetPosition}, PositionState: ${this.PositionState},`);
185
+ this.debugLog(`Curtain: ${this.accessory.displayName} CurrentPosition: ${this.CurrentPosition},`
186
+ + ` TargetPosition: ${this.TargetPosition}, PositionState: ${this.PositionState},`);
210
187
  if (!this.device.curtain?.hide_lightsensor) {
211
188
  this.set_minLux = this.minLux();
212
189
  this.set_maxLux = this.maxLux();
@@ -218,44 +195,36 @@ class Curtain {
218
195
  this.debugLog(`Curtain: ${this.accessory.displayName} LightLevel: ${this.lightLevel}`);
219
196
  break;
220
197
  case 2:
221
- this.CurrentAmbientLightLevel =
222
- (this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels;
223
- this.debugLog(`Curtain: ${this.accessory.displayName} LightLevel: ${this.lightLevel},` +
224
- ` Calculation: ${(this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels}`);
198
+ this.CurrentAmbientLightLevel = ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels);
199
+ this.debugLog(`Curtain: ${this.accessory.displayName} LightLevel: ${this.lightLevel},`
200
+ + ` Calculation: ${((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels)}`);
225
201
  break;
226
202
  case 3:
227
- this.CurrentAmbientLightLevel =
228
- ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 2;
203
+ this.CurrentAmbientLightLevel = (((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 2);
229
204
  this.debugLog(`Curtain: ${this.accessory.displayName} LightLevel: ${this.lightLevel}`);
230
205
  break;
231
206
  case 4:
232
- this.CurrentAmbientLightLevel =
233
- ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 3;
207
+ this.CurrentAmbientLightLevel = (((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 3);
234
208
  this.debugLog(`Curtain: ${this.accessory.displayName} LightLevel: ${this.lightLevel}`);
235
209
  break;
236
210
  case 5:
237
- this.CurrentAmbientLightLevel =
238
- ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 4;
211
+ this.CurrentAmbientLightLevel = (((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 4);
239
212
  this.debugLog(`Curtain: ${this.accessory.displayName} LightLevel: ${this.lightLevel}`);
240
213
  break;
241
214
  case 6:
242
- this.CurrentAmbientLightLevel =
243
- ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 5;
215
+ this.CurrentAmbientLightLevel = (((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 5);
244
216
  this.debugLog(`Curtain: ${this.accessory.displayName} LightLevel: ${this.lightLevel}`);
245
217
  break;
246
218
  case 7:
247
- this.CurrentAmbientLightLevel =
248
- ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 6;
219
+ this.CurrentAmbientLightLevel = (((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 6);
249
220
  this.debugLog(`Curtain: ${this.accessory.displayName} LightLevel: ${this.lightLevel}`);
250
221
  break;
251
222
  case 8:
252
- this.CurrentAmbientLightLevel =
253
- ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 7;
223
+ this.CurrentAmbientLightLevel = (((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 7);
254
224
  this.debugLog(`Curtain: ${this.accessory.displayName} LightLevel: ${this.lightLevel}`);
255
225
  break;
256
226
  case 9:
257
- this.CurrentAmbientLightLevel =
258
- ((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 8;
227
+ this.CurrentAmbientLightLevel = (((this.set_maxLux - this.set_minLux) / this.spaceBetweenLevels) * 8);
259
228
  this.debugLog(`Curtain: ${this.accessory.displayName} LightLevel: ${this.lightLevel}`);
260
229
  break;
261
230
  case 10:
@@ -263,18 +232,16 @@ class Curtain {
263
232
  this.CurrentAmbientLightLevel = this.set_maxLux;
264
233
  this.debugLog();
265
234
  }
266
- this.debugLog(`Curtain: ${this.accessory.displayName} LightLevel: ${this.lightLevel},` +
267
- ` CurrentAmbientLightLevel: ${this.CurrentAmbientLightLevel}`);
235
+ this.debugLog(`Curtain: ${this.accessory.displayName} LightLevel: ${this.lightLevel},`
236
+ + ` CurrentAmbientLightLevel: ${this.CurrentAmbientLightLevel}`);
268
237
  }
269
238
  // Battery
270
239
  this.BatteryLevel = Number(this.battery);
271
240
  if (this.BatteryLevel < 10) {
272
- this.StatusLowBattery =
273
- this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
241
+ this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
274
242
  }
275
243
  else {
276
- this.StatusLowBattery =
277
- this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL;
244
+ this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL;
278
245
  }
279
246
  this.debugLog(`Curtain: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}, StatusLowBattery: ${this.StatusLowBattery}`);
280
247
  }
@@ -295,18 +262,15 @@ class Curtain {
295
262
  this.setMinMax();
296
263
  if (this.TargetPosition > this.CurrentPosition) {
297
264
  this.debugLog(`Curtain: ${this.accessory.displayName} Closing, CurrentPosition: ${this.CurrentPosition} `);
298
- this.PositionState =
299
- this.platform.Characteristic.PositionState.INCREASING;
265
+ this.PositionState = this.platform.Characteristic.PositionState.INCREASING;
300
266
  }
301
267
  else if (this.TargetPosition < this.CurrentPosition) {
302
268
  this.debugLog(`Curtain: ${this.accessory.displayName} Opening, CurrentPosition: ${this.CurrentPosition} `);
303
- this.PositionState =
304
- this.platform.Characteristic.PositionState.DECREASING;
269
+ this.PositionState = this.platform.Characteristic.PositionState.DECREASING;
305
270
  }
306
271
  else {
307
272
  this.debugLog(`Curtain: ${this.CurrentPosition} Standby, CurrentPosition: ${this.CurrentPosition}`);
308
- this.PositionState =
309
- this.platform.Characteristic.PositionState.STOPPED;
273
+ this.PositionState = this.platform.Characteristic.PositionState.STOPPED;
310
274
  }
311
275
  }
312
276
  else {
@@ -314,22 +278,21 @@ class Curtain {
314
278
  if (!this.setNewTarget) {
315
279
  /*If Curtain calibration distance is short, there will be an error between the current percentage and the target percentage.*/
316
280
  this.TargetPosition = this.CurrentPosition;
317
- this.PositionState =
318
- this.platform.Characteristic.PositionState.STOPPED;
281
+ this.PositionState = this.platform.Characteristic.PositionState.STOPPED;
319
282
  this.debugLog(`Curtain: ${this.accessory.displayName} Stopped`);
320
283
  }
321
284
  }
322
- this.debugLog(`Curtain: ${this.accessory.displayName} CurrentPosition: ${this.CurrentPosition},` +
323
- ` TargetPosition: ${this.TargetPosition}, PositionState: ${this.PositionState},`);
285
+ this.debugLog(`Curtain: ${this.accessory.displayName} CurrentPosition: ${this.CurrentPosition},`
286
+ + ` TargetPosition: ${this.TargetPosition}, PositionState: ${this.PositionState},`);
324
287
  if (!this.device.curtain?.hide_lightsensor) {
325
288
  this.set_minLux = this.minLux();
326
289
  this.set_maxLux = this.maxLux();
327
290
  // Brightness
328
291
  switch (this.brightness) {
329
- case "dim":
292
+ case 'dim':
330
293
  this.CurrentAmbientLightLevel = this.set_minLux;
331
294
  break;
332
- case "bright":
295
+ case 'bright':
333
296
  default:
334
297
  this.CurrentAmbientLightLevel = this.set_maxLux;
335
298
  }
@@ -349,76 +312,85 @@ class Curtain {
349
312
  this.debugLog(`Curtain: ${this.accessory.displayName} BLE refreshStatus`);
350
313
  const switchbot = await this.platform.connectBLE();
351
314
  // Convert to BLE Address
352
- this.device.bleMac = this.device
353
- .deviceId.match(/.{1,2}/g)
354
- .join(":")
355
- .toLowerCase();
315
+ this.device.bleMac = ((this.device.deviceId.match(/.{1,2}/g)).join(':')).toLowerCase();
356
316
  this.debugLog(`Curtain: ${this.accessory.displayName} BLE Address: ${this.device.bleMac}`);
357
- try {
358
- await switchbot.discover({
359
- model: "c",
360
- quick: false,
361
- });
362
- // Start to monitor advertisement packets
363
- await switchbot.startScan({
364
- model: "c",
317
+ // Start to monitor advertisement packets
318
+ if (switchbot !== false) {
319
+ switchbot.startScan({
320
+ model: 'c',
365
321
  id: this.device.bleMac,
366
- });
367
- // Set an event hander
368
- switchbot.onadvertisement = (ad) => {
369
- this.serviceData = ad.serviceData;
370
- this.calibration = ad.serviceData.calibration;
371
- this.battery = ad.serviceData.battery;
372
- this.position = ad.serviceData.position;
373
- this.lightLevel = ad.serviceData.lightLevel;
374
- this.debugLog(`Curtain: ${this.accessory.displayName} serviceData: ${JSON.stringify(ad.serviceData)}`);
375
- this.debugLog(`Curtain: ${this.accessory.displayName} calibration: ${ad.serviceData.calibration}, ` +
376
- `position: ${ad.serviceData.position}, lightLevel: ${ad.serviceData.lightLevel}, battery: ${ad.serviceData.battery}`);
377
- if (this.serviceData) {
378
- this.connected = true;
379
- this.debugLog(`Curtain: ${this.accessory.displayName} connected: ${this.connected}`);
322
+ }).then(() => {
323
+ // Set an event hander
324
+ switchbot.onadvertisement = (ad) => {
325
+ this.serviceData = ad.serviceData;
326
+ this.calibration = ad.serviceData.calibration;
327
+ this.battery = ad.serviceData.battery;
328
+ this.position = ad.serviceData.position;
329
+ this.lightLevel = ad.serviceData.lightLevel;
330
+ this.debugLog(`Curtain: ${this.accessory.displayName} serviceData: ${JSON.stringify(ad.serviceData)}`);
331
+ this.debugLog(`Curtain: ${this.accessory.displayName} calibration: ${ad.serviceData.calibration}, `
332
+ + `position: ${ad.serviceData.position}, lightLevel: ${ad.serviceData.lightLevel}, battery: ${ad.serviceData.battery}`);
333
+ if (this.serviceData) {
334
+ this.connected = true;
335
+ this.debugLog(`Curtain: ${this.accessory.displayName} connected: ${this.connected}`);
336
+ }
337
+ else {
338
+ this.connected = false;
339
+ this.debugLog(`Curtain: ${this.accessory.displayName} connected: ${this.connected}`);
340
+ }
341
+ };
342
+ // Wait 2 seconds
343
+ return switchbot.wait(this.scanDuration * 1000);
344
+ }).then(async () => {
345
+ // Stop to monitor
346
+ switchbot.stopScan();
347
+ if (this.connected) {
348
+ this.parseStatus();
349
+ this.updateHomeKitCharacteristics();
380
350
  }
381
351
  else {
382
- this.connected = false;
383
- this.debugLog(`Curtain: ${this.accessory.displayName} connected: ${this.connected}`);
352
+ this.errorLog(`Curtain: ${this.accessory.displayName} wasn't able to establish BLE Connection`);
353
+ if (this.platform.config.credentials?.openToken) {
354
+ this.warnLog(`Curtain: ${this.accessory.displayName} Using OpenAPI Connection`);
355
+ this.SwitchToOpenAPI = true;
356
+ await this.openAPIRefreshStatus();
357
+ }
358
+ }
359
+ }).catch(async (e) => {
360
+ this.errorLog(`Curtain: ${this.accessory.displayName} failed refreshStatus with BLE Connection`);
361
+ if (this.deviceLogging === 'debug') {
362
+ this.errorLog(`Curtain: ${this.accessory.displayName} failed refreshStatus with BLE Connection,`
363
+ + ` Error Message: ${JSON.stringify(e.message)}`);
364
+ }
365
+ if (this.platform.debugMode) {
366
+ this.errorLog(`Curtain: ${this.accessory.displayName} failed refreshStatus with BLE Connection,`
367
+ + ` Error: ${JSON.stringify(e)}`);
384
368
  }
385
- };
386
- // Wait 10 seconds
387
- await switchbot.wait(this.scanDuration * 1000);
388
- // Stop to monitor
389
- switchbot.stopScan();
390
- if (this.connected) {
391
- this.parseStatus();
392
- this.updateHomeKitCharacteristics();
393
- }
394
- else {
395
- this.errorLog(`Curtain: ${this.accessory.displayName} wasn't able to establish BLE Connection`);
396
369
  if (this.platform.config.credentials?.openToken) {
397
370
  this.warnLog(`Curtain: ${this.accessory.displayName} Using OpenAPI Connection`);
398
371
  this.SwitchToOpenAPI = true;
399
372
  await this.openAPIRefreshStatus();
400
373
  }
401
- }
374
+ this.apiError(e);
375
+ });
402
376
  }
403
- catch (e) {
404
- this.errorLog(`Curtain: ${this.accessory.displayName} failed refreshStatus with BLE Connection`);
405
- if (this.deviceLogging.includes("debug")) {
406
- this.errorLog(`Curtain: ${this.accessory.displayName} failed refreshStatus with BLE Connection,` +
407
- ` Error Message: ${JSON.stringify(e.message)}`);
408
- }
409
- if (this.platform.config.credentials?.openToken) {
410
- this.warnLog(`Curtain: ${this.accessory.displayName} Using OpenAPI Connection`);
411
- this.SwitchToOpenAPI = true;
412
- await this.openAPIRefreshStatus();
413
- }
414
- this.apiError(e);
377
+ else {
378
+ await this.BLEconnection(switchbot);
379
+ }
380
+ }
381
+ async BLEconnection(switchbot) {
382
+ this.errorLog(`Curtain: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
383
+ if (this.platform.config.credentials?.openToken) {
384
+ this.warnLog(`Curtain: ${this.accessory.displayName} Using OpenAPI Connection`);
385
+ this.SwitchToOpenAPI = true;
386
+ await this.openAPIRefreshStatus();
415
387
  }
416
388
  }
417
389
  async openAPIRefreshStatus() {
418
390
  if (this.platform.config.credentials?.openToken) {
419
391
  this.debugLog(`Curtain: ${this.accessory.displayName} OpenAPI refreshStatus`);
420
392
  try {
421
- this.deviceStatus = (await this.platform.axios.get(`${settings.DeviceURL}/${this.device.deviceId}/status`)).data;
393
+ this.deviceStatus = (await this.platform.axios.get(`${settings_1.DeviceURL}/${this.device.deviceId}/status`)).data;
422
394
  this.debugLog(`Curtain: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(this.deviceStatus)}`);
423
395
  this.slidePosition = this.deviceStatus.body.slidePosition;
424
396
  this.moving = this.deviceStatus.body.moving;
@@ -428,9 +400,13 @@ class Curtain {
428
400
  }
429
401
  catch (e) {
430
402
  this.errorLog(`Curtain: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection`);
431
- if (this.deviceLogging.includes("debug")) {
432
- this.errorLog(`Curtain: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,` +
433
- ` Error Message: ${JSON.stringify(e.message)}`);
403
+ if (this.deviceLogging === 'debug') {
404
+ this.errorLog(`Curtain: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,`
405
+ + ` Error Message: ${JSON.stringify(e.message)}`);
406
+ }
407
+ if (this.platform.debugMode) {
408
+ this.errorLog(`Curtain: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,`
409
+ + ` Error: ${JSON.stringify(e)}`);
434
410
  }
435
411
  this.apiError(e);
436
412
  }
@@ -443,10 +419,9 @@ class Curtain {
443
419
  else {
444
420
  await this.openAPIpushChanges();
445
421
  }
446
- rxjs
447
- .interval(5000)
448
- .pipe(operators.skipWhile(() => this.curtainUpdateInProgress))
449
- .pipe(operators.take(1))
422
+ (0, rxjs_1.interval)(5000)
423
+ .pipe((0, operators_1.skipWhile)(() => this.curtainUpdateInProgress))
424
+ .pipe((0, operators_1.take)(1))
450
425
  .subscribe(() => {
451
426
  this.refreshStatus();
452
427
  });
@@ -456,26 +431,23 @@ class Curtain {
456
431
  this.debugLog(`Curtain: ${this.accessory.displayName} BLE pushChanges`);
457
432
  const switchbot = await this.platform.connectBLE();
458
433
  // Convert to BLE Address
459
- this.device.bleMac = this.device
460
- .deviceId.match(/.{1,2}/g)
461
- .join(":")
462
- .toLowerCase();
434
+ this.device.bleMac = ((this.device.deviceId.match(/.{1,2}/g)).join(':')).toLowerCase();
463
435
  this.debugLog(`Curtain: ${this.accessory.displayName} BLE Address: ${this.device.bleMac}`);
464
436
  if (switchbot !== false) {
465
- switchbot
466
- .discover({ model: "c", quick: true, id: this.device.bleMac })
467
- .then((device_list) => {
437
+ switchbot.discover({ model: 'c', quick: true, id: this.device.bleMac }).then((device_list) => {
468
438
  this.infoLog(`${this.accessory.displayName} Target Position: ${this.TargetPosition}`);
469
439
  return device_list[0].runToPos(100 - Number(this.TargetPosition));
470
- })
471
- .then(() => {
440
+ }).then(() => {
472
441
  this.debugLog(`Curtain: ${this.accessory.displayName} Done.`);
473
- })
474
- .catch(async (e) => {
442
+ }).catch(async (e) => {
475
443
  this.errorLog(`Curtain: ${this.accessory.displayName} failed pushChanges with BLE Connection`);
476
- if (this.deviceLogging.includes("debug")) {
477
- this.errorLog(`Curtain: ${this.accessory.displayName} failed pushChanges with BLE Connection,` +
478
- ` Error Message: ${JSON.stringify(e.message)}`);
444
+ if (this.deviceLogging === 'debug') {
445
+ this.errorLog(`Curtain: ${this.accessory.displayName} failed pushChanges with BLE Connection,`
446
+ + ` Error Message: ${JSON.stringify(e.message)}`);
447
+ }
448
+ if (this.platform.debugMode) {
449
+ this.errorLog(`Curtain: ${this.accessory.displayName} failed pushChanges with BLE Connection,`
450
+ + ` Error: ${JSON.stringify(e)}`);
479
451
  }
480
452
  if (this.platform.config.credentials?.openToken) {
481
453
  this.warnLog(`Curtain: ${this.accessory.displayName} Using OpenAPI Connection`);
@@ -493,8 +465,8 @@ class Curtain {
493
465
  }
494
466
  }
495
467
  else {
496
- this.debugLog(`Curtain: ${this.accessory.displayName} No BLE Changes, CurrentPosition & TargetPosition Are the Same.` +
497
- ` CurrentPosition: ${this.CurrentPosition}, TargetPosition ${this.TargetPosition}`);
468
+ this.debugLog(`Curtain: ${this.accessory.displayName} No BLE Changes, CurrentPosition & TargetPosition Are the Same.`
469
+ + ` CurrentPosition: ${this.CurrentPosition}, TargetPosition ${this.TargetPosition}`);
498
470
  }
499
471
  }
500
472
  async openAPIpushChanges() {
@@ -505,27 +477,31 @@ class Curtain {
505
477
  this.debugLog(`Pushing ${this.TargetPosition}`);
506
478
  const adjustedTargetPosition = 100 - Number(this.TargetPosition);
507
479
  const payload = {
508
- commandType: "command",
509
- command: "setPosition",
480
+ commandType: 'command',
481
+ command: 'setPosition',
510
482
  parameter: `0,ff,${adjustedTargetPosition}`,
511
483
  };
512
- this.infoLog(`Curtain: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
513
- ` parameter: ${payload.parameter}, commandType: ${payload.commandType}`);
484
+ this.infoLog(`Curtain: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},`
485
+ + ` parameter: ${payload.parameter}, commandType: ${payload.commandType}`);
514
486
  // Make the API request
515
- const push = await this.platform.axios.post(`${settings.DeviceURL}/${this.device.deviceId}/commands`, payload);
487
+ const push = (await this.platform.axios.post(`${settings_1.DeviceURL}/${this.device.deviceId}/commands`, payload));
516
488
  this.debugLog(`Curtain: ${this.accessory.displayName} pushchanges: ${JSON.stringify(push.data)}`);
517
489
  this.statusCode(push);
518
490
  }
519
491
  else {
520
- this.debugLog(`Curtain: ${this.accessory.displayName} No OpenAPI Changes, CurrentPosition & TargetPosition Are the Same.` +
521
- ` CurrentPosition: ${this.CurrentPosition}, TargetPosition ${this.TargetPosition}`);
492
+ this.debugLog(`Curtain: ${this.accessory.displayName} No OpenAPI Changes, CurrentPosition & TargetPosition Are the Same.`
493
+ + ` CurrentPosition: ${this.CurrentPosition}, TargetPosition ${this.TargetPosition}`);
522
494
  }
523
495
  }
524
496
  catch (e) {
525
497
  this.errorLog(`Curtain: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
526
- if (this.deviceLogging.includes("debug")) {
527
- this.errorLog(`Curtain: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` +
528
- ` Error Message: ${JSON.stringify(e.message)}`);
498
+ if (this.deviceLogging === 'debug') {
499
+ this.errorLog(`Curtain: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
500
+ + ` Error Message: ${JSON.stringify(e.message)}`);
501
+ }
502
+ if (this.platform.debugMode) {
503
+ this.errorLog(`Curtain: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
504
+ + ` Error: ${JSON.stringify(e)}`);
529
505
  }
530
506
  this.apiError(e);
531
507
  }
@@ -533,8 +509,7 @@ class Curtain {
533
509
  }
534
510
  updateHomeKitCharacteristics() {
535
511
  this.setMinMax();
536
- if (this.CurrentPosition === undefined ||
537
- Number.isNaN(this.CurrentPosition)) {
512
+ if (this.CurrentPosition === undefined || Number.isNaN(this.CurrentPosition)) {
538
513
  this.debugLog(`Curtain: ${this.accessory.displayName} CurrentPosition: ${this.CurrentPosition}`);
539
514
  }
540
515
  else {
@@ -547,8 +522,7 @@ class Curtain {
547
522
  else {
548
523
  this.debugLog(`Curtain: ${this.accessory.displayName} updateCharacteristic PositionState: ${this.PositionState}`);
549
524
  }
550
- if (this.TargetPosition === undefined ||
551
- Number.isNaN(this.TargetPosition)) {
525
+ if (this.TargetPosition === undefined || Number.isNaN(this.TargetPosition)) {
552
526
  this.debugLog(`Curtain: ${this.accessory.displayName} TargetPosition: ${this.TargetPosition}`);
553
527
  }
554
528
  else {
@@ -556,14 +530,13 @@ class Curtain {
556
530
  this.debugLog(`Curtain: ${this.accessory.displayName} updateCharacteristic TargetPosition: ${this.TargetPosition}`);
557
531
  }
558
532
  if (!this.device.curtain?.hide_lightsensor) {
559
- if (this.CurrentAmbientLightLevel === undefined ||
560
- Number.isNaN(this.CurrentAmbientLightLevel)) {
533
+ if (this.CurrentAmbientLightLevel === undefined || Number.isNaN(this.CurrentAmbientLightLevel)) {
561
534
  this.debugLog(`Curtain: ${this.accessory.displayName} CurrentAmbientLightLevel: ${this.CurrentAmbientLightLevel}`);
562
535
  }
563
536
  else {
564
537
  this.lightSensorService?.updateCharacteristic(this.platform.Characteristic.CurrentAmbientLightLevel, this.CurrentAmbientLightLevel);
565
- this.debugLog(`Curtain: ${this.accessory.displayName}` +
566
- ` updateCharacteristic CurrentAmbientLightLevel: ${this.CurrentAmbientLightLevel}`);
538
+ this.debugLog(`Curtain: ${this.accessory.displayName}`
539
+ + ` updateCharacteristic CurrentAmbientLightLevel: ${this.CurrentAmbientLightLevel}`);
567
540
  }
568
541
  }
569
542
  if (this.device.ble) {
@@ -614,8 +587,8 @@ class Curtain {
614
587
  this.errorLog(`Curtain: ${this.accessory.displayName} Hub Device is offline. Hub: ${this.device.hubDeviceId}`);
615
588
  break;
616
589
  case 190:
617
- this.errorLog(`Curtain: ${this.accessory.displayName} Device internal error due to device states not synchronized with server,` +
618
- ` Or command: ${JSON.stringify(push.data)} format is invalid`);
590
+ this.errorLog(`Curtain: ${this.accessory.displayName} Device internal error due to device states not synchronized with server,`
591
+ + ` Or command: ${JSON.stringify(push.data)} format is invalid`);
619
592
  break;
620
593
  case 100:
621
594
  this.debugLog(`Curtain: ${this.accessory.displayName} Command successfully sent.`);
@@ -632,14 +605,12 @@ class Curtain {
632
605
  this.TargetPosition = value;
633
606
  this.setMinMax();
634
607
  if (value > this.CurrentPosition) {
635
- this.PositionState =
636
- this.platform.Characteristic.PositionState.INCREASING;
608
+ this.PositionState = this.platform.Characteristic.PositionState.INCREASING;
637
609
  this.setNewTarget = true;
638
610
  this.debugLog(`Curtain: ${this.accessory.displayName} value: ${value}, CurrentPosition: ${this.CurrentPosition}`);
639
611
  }
640
612
  else if (value < this.CurrentPosition) {
641
- this.PositionState =
642
- this.platform.Characteristic.PositionState.DECREASING;
613
+ this.PositionState = this.platform.Characteristic.PositionState.DECREASING;
643
614
  this.setNewTarget = true;
644
615
  this.debugLog(`Curtain: ${this.accessory.displayName} value: ${value}, CurrentPosition: ${this.CurrentPosition}`);
645
616
  }
@@ -649,13 +620,11 @@ class Curtain {
649
620
  this.debugLog(`Curtain: ${this.accessory.displayName} value: ${value}, CurrentPosition: ${this.CurrentPosition}`);
650
621
  }
651
622
  this.service.setCharacteristic(this.platform.Characteristic.PositionState, this.PositionState);
652
- this.service
653
- .getCharacteristic(this.platform.Characteristic.PositionState)
654
- .updateValue(this.PositionState);
623
+ this.service.getCharacteristic(this.platform.Characteristic.PositionState).updateValue(this.PositionState);
655
624
  /**
656
- * If Curtain movement time is short, the moving flag from backend is always false.
657
- * The minimum time depends on the network control latency.
658
- */
625
+ * If Curtain movement time is short, the moving flag from backend is always false.
626
+ * The minimum time depends on the network control latency.
627
+ */
659
628
  clearTimeout(this.setNewTargetTimer);
660
629
  if (this.setNewTarget) {
661
630
  this.setNewTargetTimer = setTimeout(() => {
@@ -683,16 +652,16 @@ class Curtain {
683
652
  config = device.curtain;
684
653
  }
685
654
  if (device.ble) {
686
- config["ble"] = device.ble;
655
+ config['ble'] = device.ble;
687
656
  }
688
657
  if (device.logging !== undefined) {
689
- config["logging"] = device.logging;
658
+ config['logging'] = device.logging;
690
659
  }
691
660
  if (device.refreshRate !== undefined) {
692
- config["refreshRate"] = device.refreshRate;
661
+ config['refreshRate'] = device.refreshRate;
693
662
  }
694
663
  if (device.scanDuration !== undefined) {
695
- config["scanDuration"] = device.scanDuration;
664
+ config['scanDuration'] = device.scanDuration;
696
665
  }
697
666
  if (Object.entries(config).length !== 0) {
698
667
  this.warnLog(`Curtain: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
@@ -701,13 +670,11 @@ class Curtain {
701
670
  refreshRate(device) {
702
671
  // refreshRate
703
672
  if (device.refreshRate) {
704
- this.deviceRefreshRate = this.accessory.context.refreshRate =
705
- device.refreshRate;
673
+ this.deviceRefreshRate = this.accessory.context.refreshRate = device.refreshRate;
706
674
  this.debugLog(`Curtain: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
707
675
  }
708
676
  else if (this.platform.config.options.refreshRate) {
709
- this.deviceRefreshRate = this.accessory.context.refreshRate =
710
- this.platform.config.options.refreshRate;
677
+ this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options.refreshRate;
711
678
  this.debugLog(`Curtain: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
712
679
  }
713
680
  // updateRate
@@ -722,8 +689,7 @@ class Curtain {
722
689
  }
723
690
  scan(device) {
724
691
  if (device.scanDuration) {
725
- this.scanDuration = this.accessory.context.scanDuration =
726
- device.scanDuration;
692
+ this.scanDuration = this.accessory.context.scanDuration = device.scanDuration;
727
693
  if (device.ble) {
728
694
  this.debugLog(`Curtain: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
729
695
  }
@@ -737,7 +703,7 @@ class Curtain {
737
703
  }
738
704
  logs(device) {
739
705
  if (this.platform.debugMode) {
740
- this.deviceLogging = this.accessory.context.logging = "debugMode";
706
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
741
707
  this.debugLog(`Curtain: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
742
708
  }
743
709
  else if (device.logging) {
@@ -745,12 +711,11 @@ class Curtain {
745
711
  this.debugLog(`Curtain: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
746
712
  }
747
713
  else if (this.platform.config.options?.logging) {
748
- this.deviceLogging = this.accessory.context.logging =
749
- this.platform.config.options?.logging;
714
+ this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
750
715
  this.debugLog(`Curtain: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
751
716
  }
752
717
  else {
753
- this.deviceLogging = this.accessory.context.logging = "standard";
718
+ this.deviceLogging = this.accessory.context.logging = 'standard';
754
719
  this.debugLog(`Curtain: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
755
720
  }
756
721
  }
@@ -782,8 +747,8 @@ class Curtain {
782
747
  return this.set_maxLux;
783
748
  }
784
749
  /**
785
- * Logging for Device
786
- */
750
+ * Logging for Device
751
+ */
787
752
  infoLog(...log) {
788
753
  if (this.enablingDeviceLogging()) {
789
754
  this.platform.log.info(String(...log));
@@ -801,8 +766,8 @@ class Curtain {
801
766
  }
802
767
  debugLog(...log) {
803
768
  if (this.enablingDeviceLogging()) {
804
- if (this.deviceLogging === "debug") {
805
- this.platform.log.info("[DEBUG]", String(...log));
769
+ if (this.deviceLogging === 'debug') {
770
+ this.platform.log.info('[DEBUG]', String(...log));
806
771
  }
807
772
  else {
808
773
  this.platform.log.debug(String(...log));
@@ -810,7 +775,7 @@ class Curtain {
810
775
  }
811
776
  }
812
777
  enablingDeviceLogging() {
813
- return (this.deviceLogging.includes("debug") || this.deviceLogging === "standard");
778
+ return this.deviceLogging === 'debug' || this.deviceLogging === 'standard';
814
779
  }
815
780
  }
816
781
  exports.Curtain = Curtain;