@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.Humidifier = 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
  /**
27
8
  * Platform Accessory
28
9
  * An instance of this class is created for each accessory your platform registers
@@ -39,31 +20,31 @@ class Humidifier {
39
20
  this.refreshRate(device);
40
21
  this.config(device);
41
22
  this.CurrentRelativeHumidity = 0;
42
- this.TargetHumidifierDehumidifierState =
43
- this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER;
44
- this.CurrentHumidifierDehumidifierState =
45
- this.platform.Characteristic.CurrentHumidifierDehumidifierState.INACTIVE;
23
+ this.TargetHumidifierDehumidifierState = this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER;
24
+ this.CurrentHumidifierDehumidifierState = this.platform.Characteristic.CurrentHumidifierDehumidifierState.INACTIVE;
46
25
  this.Active = this.platform.Characteristic.Active.ACTIVE;
47
26
  this.RelativeHumidityHumidifierThreshold = 0;
48
27
  this.CurrentTemperature = 0;
49
28
  this.WaterLevel = 0;
29
+ // Humidifiers Config
30
+ this.debugLog(`Humidifier: ${this.accessory.displayName} Config: (ble: ${device.ble}, offline: ${device.offline}, hide_temperature: `
31
+ + `${device.humidifier?.hide_temperature}, set_minStep: ${device.humidifier?.set_minStep})`);
50
32
  // this is subject we use to track when we need to POST changes to the SwitchBot API
51
- this.doHumidifierUpdate = new rxjs.Subject();
33
+ this.doHumidifierUpdate = new rxjs_1.Subject();
52
34
  this.humidifierUpdateInProgress = false;
53
35
  // Retrieve initial values and updateHomekit
54
36
  this.refreshStatus();
55
37
  // set accessory information
56
38
  accessory
57
39
  .getService(this.platform.Service.AccessoryInformation)
58
- .setCharacteristic(this.platform.Characteristic.Manufacturer, "SwitchBot")
59
- .setCharacteristic(this.platform.Characteristic.Model, "SWITCHBOT-HUMIDIFIER-W0801800")
40
+ .setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
41
+ .setCharacteristic(this.platform.Characteristic.Model, 'SWITCHBOT-HUMIDIFIER-W0801800')
60
42
  .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId);
61
43
  // get the LightBulb service if it exists, otherwise create a new LightBulb service
62
44
  // you can create multiple services for each accessory
63
45
  (this.service =
64
46
  accessory.getService(this.platform.Service.HumidifierDehumidifier) ||
65
- accessory.addService(this.platform.Service.HumidifierDehumidifier)),
66
- `${accessory.displayName} Humidifier`;
47
+ accessory.addService(this.platform.Service.HumidifierDehumidifier)), `${accessory.displayName} Humidifier`;
67
48
  // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
68
49
  // when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
69
50
  // accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Lightbulb, 'NAME', 'USER_DEFINED_SUBTYPE');
@@ -83,9 +64,7 @@ class Humidifier {
83
64
  validValues: [0, 1],
84
65
  })
85
66
  .onSet(this.handleTargetHumidifierDehumidifierStateSet.bind(this));
86
- this.service
87
- .getCharacteristic(this.platform.Characteristic.Active)
88
- .onSet(this.handleActiveSet.bind(this));
67
+ this.service.getCharacteristic(this.platform.Characteristic.Active).onSet(this.handleActiveSet.bind(this));
89
68
  this.service
90
69
  .getCharacteristic(this.platform.Characteristic.RelativeHumidityHumidifierThreshold)
91
70
  .setProps({
@@ -106,8 +85,7 @@ class Humidifier {
106
85
  this.debugLog(`Humidifier: ${accessory.displayName} Add Temperature Sensor Service`);
107
86
  (this.temperatureservice =
108
87
  this.accessory.getService(this.platform.Service.TemperatureSensor) ||
109
- this.accessory.addService(this.platform.Service.TemperatureSensor)),
110
- `${accessory.displayName} Temperature Sensor`;
88
+ this.accessory.addService(this.platform.Service.TemperatureSensor)), `${accessory.displayName} Temperature Sensor`;
111
89
  this.temperatureservice.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Temperature Sensor`);
112
90
  this.temperatureservice
113
91
  .getCharacteristic(this.platform.Characteristic.CurrentTemperature)
@@ -127,27 +105,30 @@ class Humidifier {
127
105
  // Retrieve initial values and updateHomekit
128
106
  this.updateHomeKitCharacteristics();
129
107
  // Start an update interval
130
- rxjs
131
- .interval(this.deviceRefreshRate * 1000)
132
- .pipe(operators.skipWhile(() => this.humidifierUpdateInProgress))
108
+ (0, rxjs_1.interval)(this.deviceRefreshRate * 1000)
109
+ .pipe((0, operators_1.skipWhile)(() => this.humidifierUpdateInProgress))
133
110
  .subscribe(() => {
134
111
  this.refreshStatus();
135
112
  });
136
113
  // Watch for Humidifier change events
137
114
  // We put in a debounce of 100ms so we don't make duplicate calls
138
115
  this.doHumidifierUpdate
139
- .pipe(operators.tap(() => {
116
+ .pipe((0, operators_1.tap)(() => {
140
117
  this.humidifierUpdateInProgress = true;
141
- }), operators.debounceTime(this.platform.config.options.pushRate * 1000))
118
+ }), (0, operators_1.debounceTime)(this.platform.config.options.pushRate * 1000))
142
119
  .subscribe(async () => {
143
120
  try {
144
121
  await this.pushChanges();
145
122
  }
146
123
  catch (e) {
147
124
  this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges`);
148
- if (this.deviceLogging.includes("debug")) {
149
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges,` +
150
- ` Error Message: ${JSON.stringify(e.message)}`);
125
+ if (this.deviceLogging === 'debug') {
126
+ this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges,`
127
+ + ` Error Message: ${JSON.stringify(e.message)}`);
128
+ }
129
+ if (this.platform.debugMode) {
130
+ this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges,`
131
+ + ` Error: ${JSON.stringify(e)}`);
151
132
  }
152
133
  this.apiError(e);
153
134
  }
@@ -193,44 +174,35 @@ class Humidifier {
193
174
  // Target Humidifier Dehumidifier State
194
175
  switch (this.auto) {
195
176
  case true:
196
- this.TargetHumidifierDehumidifierState =
197
- this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER_OR_DEHUMIDIFIER;
198
- this.CurrentHumidifierDehumidifierState =
199
- this.platform.Characteristic.CurrentHumidifierDehumidifierState.HUMIDIFYING;
200
- this.RelativeHumidityHumidifierThreshold =
201
- this.CurrentRelativeHumidity;
177
+ this.TargetHumidifierDehumidifierState = this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER_OR_DEHUMIDIFIER;
178
+ this.CurrentHumidifierDehumidifierState = this.platform.Characteristic.CurrentHumidifierDehumidifierState.HUMIDIFYING;
179
+ this.RelativeHumidityHumidifierThreshold = this.CurrentRelativeHumidity;
202
180
  break;
203
181
  default:
204
- this.TargetHumidifierDehumidifierState =
205
- this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER;
182
+ this.TargetHumidifierDehumidifierState = this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER;
206
183
  if (this.nebulizationEfficiency > 100) {
207
184
  this.RelativeHumidityHumidifierThreshold = 100;
208
185
  }
209
186
  else {
210
- this.RelativeHumidityHumidifierThreshold =
211
- this.nebulizationEfficiency;
187
+ this.RelativeHumidityHumidifierThreshold = this.nebulizationEfficiency;
212
188
  }
213
- if (this.CurrentRelativeHumidity >
214
- this.RelativeHumidityHumidifierThreshold) {
215
- this.CurrentHumidifierDehumidifierState =
216
- this.platform.Characteristic.CurrentHumidifierDehumidifierState.IDLE;
189
+ if (this.CurrentRelativeHumidity > this.RelativeHumidityHumidifierThreshold) {
190
+ this.CurrentHumidifierDehumidifierState = this.platform.Characteristic.CurrentHumidifierDehumidifierState.IDLE;
217
191
  }
218
192
  else if (this.Active === this.platform.Characteristic.Active.INACTIVE) {
219
- this.CurrentHumidifierDehumidifierState =
220
- this.platform.Characteristic.CurrentHumidifierDehumidifierState.INACTIVE;
193
+ this.CurrentHumidifierDehumidifierState = this.platform.Characteristic.CurrentHumidifierDehumidifierState.INACTIVE;
221
194
  }
222
195
  else {
223
- this.CurrentHumidifierDehumidifierState =
224
- this.platform.Characteristic.CurrentHumidifierDehumidifierState.HUMIDIFYING;
196
+ this.CurrentHumidifierDehumidifierState = this.platform.Characteristic.CurrentHumidifierDehumidifierState.HUMIDIFYING;
225
197
  }
226
198
  }
227
199
  this.debugLog(`Humidifier: ${this.accessory.displayName} TargetHumidifierDehumidifierState: ${this.TargetHumidifierDehumidifierState}`);
228
- this.debugLog(`Humidifier: ${this.accessory.displayName}` +
229
- ` RelativeHumidityHumidifierThreshold: ${this.RelativeHumidityHumidifierThreshold}`);
200
+ this.debugLog(`Humidifier: ${this.accessory.displayName}`
201
+ + ` RelativeHumidityHumidifierThreshold: ${this.RelativeHumidityHumidifierThreshold}`);
230
202
  this.debugLog(`Humidifier: ${this.accessory.displayName} CurrentHumidifierDehumidifierState: ${this.CurrentHumidifierDehumidifierState}`);
231
203
  // Active
232
204
  switch (this.power) {
233
- case "on":
205
+ case 'on':
234
206
  this.Active = this.platform.Characteristic.Active.ACTIVE;
235
207
  break;
236
208
  default:
@@ -262,84 +234,85 @@ class Humidifier {
262
234
  this.debugLog(`Humidifier: ${this.accessory.displayName} BLE refreshStatus`);
263
235
  const switchbot = await this.platform.connectBLE();
264
236
  // Convert to BLE Address
265
- this.device.bleMac = this.device
266
- .deviceId.match(/.{1,2}/g)
267
- .join(":")
268
- .toLowerCase();
269
- this.debugLog(`Humidifier: ${this.accessory.displayName} BLE Address: ${this.device.bleMac}`);
270
- try {
271
- await switchbot.discover({
272
- model: "e",
273
- quick: false,
274
- });
275
- // Start to monitor advertisement packets
276
- await switchbot.startScan({
277
- model: "e",
237
+ this.device.bleMac = ((this.device.deviceId.match(/.{1,2}/g)).join(':')).toLowerCase();
238
+ this.debugLog(`Curtain: ${this.accessory.displayName} BLE Address: ${this.device.bleMac}`);
239
+ // Start to monitor advertisement packets
240
+ if (switchbot !== false) {
241
+ switchbot.startScan({
242
+ model: 'e',
278
243
  id: this.device.bleMac,
279
- });
280
- // Set an event hander
281
- switchbot.onadvertisement = (ad) => {
282
- this.serviceData = ad.serviceData;
283
- this.autoMode = ad.serviceData.autoMode;
284
- this.onState = ad.serviceData.onState;
285
- this.percentage = ad.serviceData.percentage;
286
- this.debugLog(`Humidifier: ${this.accessory.displayName} serviceData: ${JSON.stringify(ad.serviceData)}`);
287
- this.debugLog(`Humidifier: ${this.accessory.displayName} model: ${ad.serviceData.model}, modelName: ${ad.serviceData.modelName},` +
288
- `autoMode: ${ad.serviceData.autoMode}, onState: ${ad.serviceData.onState}, percentage: ${ad.serviceData.percentage}`);
289
- if (this.serviceData) {
290
- this.connected = true;
291
- this.debugLog(`Humidifier: ${this.accessory.displayName} connected: ${this.connected}`);
244
+ }).then(() => {
245
+ // Set an event hander
246
+ switchbot.onadvertisement = (ad) => {
247
+ this.serviceData = ad.serviceData;
248
+ this.autoMode = ad.serviceData.autoMode;
249
+ this.onState = ad.serviceData.onState;
250
+ this.percentage = ad.serviceData.percentage;
251
+ this.debugLog(`Humidifier: ${this.accessory.displayName} serviceData: ${JSON.stringify(ad.serviceData)}`);
252
+ this.debugLog(`Humidifier: ${this.accessory.displayName} model: ${ad.serviceData.model}, modelName: ${ad.serviceData.modelName},`
253
+ + `autoMode: ${ad.serviceData.autoMode}, onState: ${ad.serviceData.onState}, percentage: ${ad.serviceData.percentage}`);
254
+ if (this.serviceData) {
255
+ this.connected = true;
256
+ this.debugLog(`Humidifier: ${this.accessory.displayName} connected: ${this.connected}`);
257
+ }
258
+ else {
259
+ this.connected = false;
260
+ this.debugLog(`Humidifier: ${this.accessory.displayName} connected: ${this.connected}`);
261
+ }
262
+ };
263
+ // Wait 2 seconds
264
+ return switchbot.wait(this.scanDuration * 1000);
265
+ }).then(async () => {
266
+ // Stop to monitor
267
+ switchbot.stopScan();
268
+ if (this.connected) {
269
+ this.parseStatus();
270
+ this.updateHomeKitCharacteristics();
292
271
  }
293
272
  else {
294
- this.connected = false;
295
- this.debugLog(`Humidifier: ${this.accessory.displayName} connected: ${this.connected}`);
273
+ await this.BLEconnection(switchbot);
274
+ }
275
+ }).catch(async (e) => {
276
+ this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with BLE Connection`);
277
+ if (this.deviceLogging === 'debug') {
278
+ this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with BLE Connection,`
279
+ + ` Error Message: ${JSON.stringify(e.message)}`);
280
+ }
281
+ if (this.platform.debugMode) {
282
+ this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with BLE Connection,`
283
+ + ` Error: ${JSON.stringify(e)}`);
296
284
  }
297
- };
298
- // Wait 2 seconds
299
- await switchbot.wait(this.scanDuration * 1000);
300
- // Stop to monitor
301
- switchbot.stopScan();
302
- if (this.connected) {
303
- this.parseStatus();
304
- this.updateHomeKitCharacteristics();
305
- }
306
- else {
307
- this.errorLog(`Humidifier: ${this.accessory.displayName} wasn't able to establish BLE Connection`);
308
285
  if (this.platform.config.credentials?.openToken) {
309
286
  this.warnLog(`Humidifier: ${this.accessory.displayName} Using OpenAPI Connection`);
310
- this.SwitchToOpenAPI = true;
311
287
  await this.openAPIRefreshStatus();
312
288
  }
313
- }
289
+ this.apiError(e);
290
+ });
314
291
  }
315
- catch (e) {
316
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with BLE Connection`);
317
- if (this.deviceLogging.includes("debug")) {
318
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with BLE Connection,` +
319
- ` Error Message: ${JSON.stringify(e.message)}`);
320
- }
321
- if (this.platform.config.credentials?.openToken) {
322
- this.warnLog(`Humidifier: ${this.accessory.displayName} Using OpenAPI Connection`);
323
- this.SwitchToOpenAPI = true;
324
- await this.openAPIRefreshStatus();
325
- }
326
- this.apiError(e);
292
+ else {
293
+ await this.BLEconnection(switchbot);
294
+ }
295
+ }
296
+ async BLEconnection(switchbot) {
297
+ this.errorLog(`Humidifier: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${switchbot}`);
298
+ if (this.platform.config.credentials?.openToken) {
299
+ this.warnLog(`Humidifier: ${this.accessory.displayName} Using OpenAPI Connection`);
300
+ await this.openAPIRefreshStatus();
327
301
  }
328
302
  }
329
303
  async openAPIRefreshStatus() {
330
304
  if (this.platform.config.credentials?.openToken) {
331
305
  this.debugLog(`Humidifier: ${this.accessory.displayName} OpenAPI refreshStatus`);
332
306
  try {
333
- this.deviceStatus = (await this.platform.axios.get(`${settings.DeviceURL}/${this.device.deviceId}/status`)).data;
334
- if (this.deviceStatus.message === "success") {
307
+ this.deviceStatus = (await this.platform.axios.get(`${settings_1.DeviceURL}/${this.device.deviceId}/status`)).data;
308
+ if (this.deviceStatus.message === 'success') {
335
309
  this.debugLog(`Humidifier: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(this.deviceStatus)}`);
336
310
  this.auto = this.deviceStatus.body.auto;
337
311
  this.power = this.deviceStatus.body.power;
338
312
  this.lackWater = this.deviceStatus.body.lackWater;
339
313
  this.humidity = this.deviceStatus.body.humidity;
340
314
  this.temperature = this.deviceStatus.body.temperature;
341
- this.nebulizationEfficiency =
342
- this.deviceStatus.body.nebulizationEfficiency;
315
+ this.nebulizationEfficiency = this.deviceStatus.body.nebulizationEfficiency;
343
316
  this.parseStatus();
344
317
  this.updateHomeKitCharacteristics();
345
318
  }
@@ -349,9 +322,13 @@ class Humidifier {
349
322
  }
350
323
  catch (e) {
351
324
  this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection`);
352
- if (this.deviceLogging.includes("debug")) {
353
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,` +
354
- ` Error Message: ${JSON.stringify(e.message)}`);
325
+ if (this.deviceLogging === 'debug') {
326
+ this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,`
327
+ + ` Error Message: ${JSON.stringify(e.message)}`);
328
+ }
329
+ if (this.platform.debugMode) {
330
+ this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,`
331
+ + ` Error: ${JSON.stringify(e)}`);
355
332
  }
356
333
  this.apiError(e);
357
334
  }
@@ -366,10 +343,9 @@ class Humidifier {
366
343
  //} else {
367
344
  await this.openAPIpushChanges();
368
345
  //}
369
- rxjs
370
- .interval(5000)
371
- .pipe(operators.skipWhile(() => this.humidifierUpdateInProgress))
372
- .pipe(operators.take(1))
346
+ (0, rxjs_1.interval)(5000)
347
+ .pipe((0, operators_1.skipWhile)(() => this.humidifierUpdateInProgress))
348
+ .pipe((0, operators_1.take)(1))
373
349
  .subscribe(() => {
374
350
  this.refreshStatus();
375
351
  });
@@ -378,26 +354,23 @@ class Humidifier {
378
354
  this.debugLog(`Humidifier: ${this.accessory.displayName} BLE pushChanges`);
379
355
  const switchbot = await this.platform.connectBLE();
380
356
  // Convert to BLE Address
381
- this.device.bleMac = this.device
382
- .deviceId.match(/.{1,2}/g)
383
- .join(":")
384
- .toLowerCase();
385
- this.debugLog(`Humidifier: ${this.accessory.displayName} BLE Address: ${this.device.bleMac}`);
357
+ this.device.bleMac = ((this.device.deviceId.match(/.{1,2}/g)).join(':')).toLowerCase();
358
+ this.debugLog(`Curtain: ${this.accessory.displayName} BLE Address: ${this.device.bleMac}`);
386
359
  if (switchbot !== false) {
387
- switchbot
388
- .discover({ model: "e", quick: true, id: this.device.bleMac })
389
- .then((device_list) => {
360
+ switchbot.discover({ model: 'e', quick: true, id: this.device.bleMac }).then((device_list) => {
390
361
  this.infoLog(`${this.accessory.displayName} Target Position: ${this.Active}`);
391
362
  return device_list[0].percentage(this.RelativeHumidityHumidifierThreshold);
392
- })
393
- .then(() => {
363
+ }).then(() => {
394
364
  this.debugLog(`Humidifier: ${this.accessory.displayName} Done.`);
395
- })
396
- .catch(async (e) => {
365
+ }).catch(async (e) => {
397
366
  this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges with BLE Connection`);
398
- if (this.deviceLogging.includes("debug")) {
399
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges with BLE Connection,` +
400
- ` Error Message: ${JSON.stringify(e.message)}`);
367
+ if (this.deviceLogging === 'debug') {
368
+ this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges with BLE Connection,`
369
+ + ` Error Message: ${JSON.stringify(e.message)}`);
370
+ }
371
+ if (this.platform.debugMode) {
372
+ this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges with BLE Connection,`
373
+ + ` Error: ${JSON.stringify(e)}`);
401
374
  }
402
375
  if (this.platform.config.credentials?.openToken) {
403
376
  this.warnLog(`Humidifier: ${this.accessory.displayName} Using OpenAPI Connection`);
@@ -418,35 +391,37 @@ class Humidifier {
418
391
  if (this.platform.config.credentials?.openToken) {
419
392
  this.debugLog(`Humidifier: ${this.accessory.displayName} OpenAPI pushChanges`);
420
393
  if (this.TargetHumidifierDehumidifierState ===
421
- this.platform.Characteristic.TargetHumidifierDehumidifierState
422
- .HUMIDIFIER &&
394
+ this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER &&
423
395
  this.Active === this.platform.Characteristic.Active.ACTIVE) {
424
396
  try {
425
397
  this.debugLog(`Pushing Manual: ${this.RelativeHumidityHumidifierThreshold}!`);
426
398
  const payload = {
427
- commandType: "command",
428
- command: "setMode",
399
+ commandType: 'command',
400
+ command: 'setMode',
429
401
  parameter: `${this.RelativeHumidityHumidifierThreshold}`,
430
402
  };
431
- this.infoLog(`Humidifier: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
432
- ` parameter: ${payload.parameter}, commandType: ${payload.commandType}`);
403
+ this.infoLog(`Humidifier: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},`
404
+ + ` parameter: ${payload.parameter}, commandType: ${payload.commandType}`);
433
405
  // Make the API request
434
- const push = await this.platform.axios.post(`${settings.DeviceURL}/${this.device.deviceId}/commands`, payload);
406
+ const push = (await this.platform.axios.post(`${settings_1.DeviceURL}/${this.device.deviceId}/commands`, payload));
435
407
  this.debugLog(`Humidifier: ${this.accessory.displayName} pushChanges: ${JSON.stringify(push.data)}`);
436
408
  this.statusCode(push);
437
409
  }
438
410
  catch (e) {
439
411
  this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
440
- if (this.deviceLogging.includes("debug")) {
441
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` +
442
- ` Error Message: ${JSON.stringify(e.message)}`);
412
+ if (this.deviceLogging === 'debug') {
413
+ this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
414
+ + ` Error Message: ${JSON.stringify(e.message)}`);
415
+ }
416
+ if (this.platform.debugMode) {
417
+ this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
418
+ + ` Error: ${JSON.stringify(e)}`);
443
419
  }
444
420
  this.apiError(e);
445
421
  }
446
422
  }
447
423
  else if (this.TargetHumidifierDehumidifierState ===
448
- this.platform.Characteristic.TargetHumidifierDehumidifierState
449
- .HUMIDIFIER_OR_DEHUMIDIFIER &&
424
+ this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER_OR_DEHUMIDIFIER &&
450
425
  this.Active === this.platform.Characteristic.Active.ACTIVE) {
451
426
  await this.pushAutoChanges();
452
427
  }
@@ -461,28 +436,31 @@ class Humidifier {
461
436
  async pushAutoChanges() {
462
437
  try {
463
438
  if (this.TargetHumidifierDehumidifierState ===
464
- this.platform.Characteristic.TargetHumidifierDehumidifierState
465
- .HUMIDIFIER_OR_DEHUMIDIFIER &&
439
+ this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER_OR_DEHUMIDIFIER &&
466
440
  this.Active === this.platform.Characteristic.Active.ACTIVE) {
467
- this.debugLog("Pushing Auto!");
441
+ this.debugLog('Pushing Auto!');
468
442
  const payload = {
469
- commandType: "command",
470
- command: "setMode",
471
- parameter: "auto",
443
+ commandType: 'command',
444
+ command: 'setMode',
445
+ parameter: 'auto',
472
446
  };
473
- this.infoLog(`Humidifier: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
474
- ` parameter: ${payload.parameter}, commandType: ${payload.commandType}`);
447
+ this.infoLog(`Humidifier: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},`
448
+ + ` parameter: ${payload.parameter}, commandType: ${payload.commandType}`);
475
449
  // Make the API request
476
- const push = await this.platform.axios.post(`${settings.DeviceURL}/${this.device.deviceId}/commands`, payload);
450
+ const push = (await this.platform.axios.post(`${settings_1.DeviceURL}/${this.device.deviceId}/commands`, payload));
477
451
  this.debugLog(`Humidifier: ${this.accessory.displayName} pushAutoChanges: ${JSON.stringify(push.data)}`);
478
452
  this.statusCode(push);
479
453
  }
480
454
  }
481
455
  catch (e) {
482
456
  this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushAutoChanges with OpenAPI Connection`);
483
- if (this.deviceLogging.includes("debug")) {
484
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushAutoChanges with OpenAPI Connection,` +
485
- ` Error Message: ${JSON.stringify(e.message)}`);
457
+ if (this.deviceLogging === 'debug') {
458
+ this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushAutoChanges with OpenAPI Connection,`
459
+ + ` Error Message: ${JSON.stringify(e.message)}`);
460
+ }
461
+ if (this.platform.debugMode) {
462
+ this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushAutoChanges with OpenAPI Connection,`
463
+ + ` Error: ${JSON.stringify(e)}`);
486
464
  }
487
465
  this.apiError(e);
488
466
  }
@@ -493,25 +471,29 @@ class Humidifier {
493
471
  async pushActiveChanges() {
494
472
  try {
495
473
  if (this.Active === this.platform.Characteristic.Active.INACTIVE) {
496
- this.debugLog("Pushing Off!");
474
+ this.debugLog('Pushing Off!');
497
475
  const payload = {
498
- commandType: "command",
499
- command: "turnOff",
500
- parameter: "default",
476
+ commandType: 'command',
477
+ command: 'turnOff',
478
+ parameter: 'default',
501
479
  };
502
- this.infoLog(`Humidifier: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},` +
503
- ` parameter: ${payload.parameter}, commandType: ${payload.commandType}`);
480
+ this.infoLog(`Humidifier: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},`
481
+ + ` parameter: ${payload.parameter}, commandType: ${payload.commandType}`);
504
482
  // Make the API request
505
- const push = await this.platform.axios.post(`${settings.DeviceURL}/${this.device.deviceId}/commands`, payload);
483
+ const push = (await this.platform.axios.post(`${settings_1.DeviceURL}/${this.device.deviceId}/commands`, payload));
506
484
  this.debugLog(`Humidifier: ${this.accessory.displayName} pushActiveChanges: ${JSON.stringify(push.data)}`);
507
485
  this.statusCode(push);
508
486
  }
509
487
  }
510
488
  catch (e) {
511
489
  this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushActiveChanges with OpenAPI Connection`);
512
- if (this.deviceLogging.includes("debug")) {
513
- this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushActiveChanges with OpenAPI Connection,` +
514
- ` Error Message: ${JSON.stringify(e.message)}`);
490
+ if (this.deviceLogging === 'debug') {
491
+ this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushActiveChanges with OpenAPI Connection,`
492
+ + ` Error Message: ${JSON.stringify(e.message)}`);
493
+ }
494
+ if (this.platform.debugMode) {
495
+ this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushActiveChanges with OpenAPI Connection,`
496
+ + ` Error: ${JSON.stringify(e)}`);
515
497
  }
516
498
  this.apiError(e);
517
499
  }
@@ -525,8 +507,8 @@ class Humidifier {
525
507
  }
526
508
  else {
527
509
  this.service.updateCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity, this.CurrentRelativeHumidity);
528
- this.debugLog(`Humidifier: ${this.accessory.displayName}` +
529
- ` updateCharacteristic CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
510
+ this.debugLog(`Humidifier: ${this.accessory.displayName}`
511
+ + ` updateCharacteristic CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
530
512
  }
531
513
  if (!this.device.ble) {
532
514
  if (this.WaterLevel === undefined) {
@@ -542,16 +524,16 @@ class Humidifier {
542
524
  }
543
525
  else {
544
526
  this.service.updateCharacteristic(this.platform.Characteristic.CurrentHumidifierDehumidifierState, this.CurrentHumidifierDehumidifierState);
545
- this.debugLog(`Humidifier: ${this.accessory.displayName}` +
546
- ` updateCharacteristic CurrentHumidifierDehumidifierState: ${this.CurrentHumidifierDehumidifierState}`);
527
+ this.debugLog(`Humidifier: ${this.accessory.displayName}`
528
+ + ` updateCharacteristic CurrentHumidifierDehumidifierState: ${this.CurrentHumidifierDehumidifierState}`);
547
529
  }
548
530
  if (this.TargetHumidifierDehumidifierState === undefined) {
549
531
  this.debugLog(`Humidifier: ${this.accessory.displayName} TargetHumidifierDehumidifierState: ${this.TargetHumidifierDehumidifierState}`);
550
532
  }
551
533
  else {
552
534
  this.service.updateCharacteristic(this.platform.Characteristic.TargetHumidifierDehumidifierState, this.TargetHumidifierDehumidifierState);
553
- this.debugLog(`Humidifier: ${this.accessory.displayName}` +
554
- ` updateCharacteristic TargetHumidifierDehumidifierState: ${this.TargetHumidifierDehumidifierState}`);
535
+ this.debugLog(`Humidifier: ${this.accessory.displayName}`
536
+ + ` updateCharacteristic TargetHumidifierDehumidifierState: ${this.TargetHumidifierDehumidifierState}`);
555
537
  }
556
538
  if (this.Active === undefined) {
557
539
  this.debugLog(`Humidifier: ${this.accessory.displayName} Active: ${this.Active}`);
@@ -561,13 +543,13 @@ class Humidifier {
561
543
  this.debugLog(`Humidifier: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
562
544
  }
563
545
  if (this.RelativeHumidityHumidifierThreshold === undefined) {
564
- this.debugLog(`Humidifier: ${this.accessory.displayName}` +
565
- ` RelativeHumidityHumidifierThreshold: ${this.RelativeHumidityHumidifierThreshold}`);
546
+ this.debugLog(`Humidifier: ${this.accessory.displayName}`
547
+ + ` RelativeHumidityHumidifierThreshold: ${this.RelativeHumidityHumidifierThreshold}`);
566
548
  }
567
549
  else {
568
550
  this.service.updateCharacteristic(this.platform.Characteristic.RelativeHumidityHumidifierThreshold, this.RelativeHumidityHumidifierThreshold);
569
- this.debugLog(`Humidifier: ${this.accessory.displayName}` +
570
- ` updateCharacteristic RelativeHumidityHumidifierThreshold: ${this.RelativeHumidityHumidifierThreshold}`);
551
+ this.debugLog(`Humidifier: ${this.accessory.displayName}`
552
+ + ` updateCharacteristic RelativeHumidityHumidifierThreshold: ${this.RelativeHumidityHumidifierThreshold}`);
571
553
  }
572
554
  if (!this.device.humidifier?.hide_temperature && !this.device.ble) {
573
555
  if (this.CurrentTemperature === undefined) {
@@ -613,8 +595,8 @@ class Humidifier {
613
595
  this.offlineOff();
614
596
  break;
615
597
  case 190:
616
- this.errorLog(`Humidifier: ${this.accessory.displayName} Device internal error due to device states not synchronized with server,` +
617
- ` Or command: ${JSON.stringify(push.data)} format is invalid`);
598
+ this.errorLog(`Humidifier: ${this.accessory.displayName} Device internal error due to device states not synchronized with server,`
599
+ + ` Or command: ${JSON.stringify(push.data)} format is invalid`);
618
600
  break;
619
601
  case 100:
620
602
  this.debugLog(`Humidifier: ${this.accessory.displayName} Command successfully sent.`);
@@ -626,9 +608,7 @@ class Humidifier {
626
608
  offlineOff() {
627
609
  if (this.device.offline) {
628
610
  this.Active = this.platform.Characteristic.Active.INACTIVE;
629
- this.service
630
- .getCharacteristic(this.platform.Characteristic.Active)
631
- .updateValue(this.Active);
611
+ this.service.getCharacteristic(this.platform.Characteristic.Active).updateValue(this.Active);
632
612
  }
633
613
  }
634
614
  /**
@@ -655,8 +635,7 @@ class Humidifier {
655
635
  this.RelativeHumidityHumidifierThreshold = value;
656
636
  if (this.Active === this.platform.Characteristic.Active.INACTIVE) {
657
637
  this.Active = this.platform.Characteristic.Active.ACTIVE;
658
- this.CurrentHumidifierDehumidifierState =
659
- this.platform.Characteristic.CurrentHumidifierDehumidifierState.IDLE;
638
+ this.CurrentHumidifierDehumidifierState = this.platform.Characteristic.CurrentHumidifierDehumidifierState.IDLE;
660
639
  }
661
640
  this.doHumidifierUpdate.next();
662
641
  }
@@ -666,16 +645,16 @@ class Humidifier {
666
645
  config = device.humidifier;
667
646
  }
668
647
  if (device.ble !== undefined) {
669
- config["ble"] = device.ble;
648
+ config['ble'] = device.ble;
670
649
  }
671
650
  if (device.logging !== undefined) {
672
- config["logging"] = device.logging;
651
+ config['logging'] = device.logging;
673
652
  }
674
653
  if (device.refreshRate !== undefined) {
675
- config["refreshRate"] = device.refreshRate;
654
+ config['refreshRate'] = device.refreshRate;
676
655
  }
677
656
  if (device.scanDuration !== undefined) {
678
- config["scanDuration"] = device.scanDuration;
657
+ config['scanDuration'] = device.scanDuration;
679
658
  }
680
659
  if (Object.entries(config).length !== 0) {
681
660
  this.warnLog(`Humidifier: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
@@ -683,20 +662,17 @@ class Humidifier {
683
662
  }
684
663
  refreshRate(device) {
685
664
  if (device.refreshRate) {
686
- this.deviceRefreshRate = this.accessory.context.refreshRate =
687
- device.refreshRate;
665
+ this.deviceRefreshRate = this.accessory.context.refreshRate = device.refreshRate;
688
666
  this.debugLog(`Humidifier: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
689
667
  }
690
668
  else if (this.platform.config.options.refreshRate) {
691
- this.deviceRefreshRate = this.accessory.context.refreshRate =
692
- this.platform.config.options.refreshRate;
669
+ this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options.refreshRate;
693
670
  this.debugLog(`Humidifier: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
694
671
  }
695
672
  }
696
673
  scan(device) {
697
674
  if (device.scanDuration) {
698
- this.scanDuration = this.accessory.context.scanDuration =
699
- device.scanDuration;
675
+ this.scanDuration = this.accessory.context.scanDuration = device.scanDuration;
700
676
  if (device.ble) {
701
677
  this.debugLog(`Humidifier: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
702
678
  }
@@ -710,7 +686,7 @@ class Humidifier {
710
686
  }
711
687
  logs(device) {
712
688
  if (this.platform.debugMode) {
713
- this.deviceLogging = this.accessory.context.logging = "debugMode";
689
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
714
690
  this.debugLog(`Humidifier: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
715
691
  }
716
692
  else if (device.logging) {
@@ -718,12 +694,11 @@ class Humidifier {
718
694
  this.debugLog(`Humidifier: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
719
695
  }
720
696
  else if (this.platform.config.options?.logging) {
721
- this.deviceLogging = this.accessory.context.logging =
722
- this.platform.config.options?.logging;
697
+ this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
723
698
  this.debugLog(`Humidifier: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
724
699
  }
725
700
  else {
726
- this.deviceLogging = this.accessory.context.logging = "standard";
701
+ this.deviceLogging = this.accessory.context.logging = 'standard';
727
702
  this.debugLog(`Humidifier: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
728
703
  }
729
704
  }
@@ -737,8 +712,8 @@ class Humidifier {
737
712
  return this.set_minStep;
738
713
  }
739
714
  /**
740
- * Logging for Device
741
- */
715
+ * Logging for Device
716
+ */
742
717
  infoLog(...log) {
743
718
  if (this.enablingDeviceLogging()) {
744
719
  this.platform.log.info(String(...log));
@@ -756,8 +731,8 @@ class Humidifier {
756
731
  }
757
732
  debugLog(...log) {
758
733
  if (this.enablingDeviceLogging()) {
759
- if (this.deviceLogging === "debug") {
760
- this.platform.log.info("[DEBUG]", String(...log));
734
+ if (this.deviceLogging === 'debug') {
735
+ this.platform.log.info('[DEBUG]', String(...log));
761
736
  }
762
737
  else {
763
738
  this.platform.log.debug(String(...log));
@@ -765,7 +740,7 @@ class Humidifier {
765
740
  }
766
741
  }
767
742
  enablingDeviceLogging() {
768
- return (this.deviceLogging.includes("debug") || this.deviceLogging === "standard");
743
+ return this.deviceLogging === 'debug' || this.deviceLogging === 'standard';
769
744
  }
770
745
  }
771
746
  exports.Humidifier = Humidifier;