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