@switchbot/homebridge-switchbot 3.7.1-beta.20 → 3.7.1-beta.22

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.
@@ -593,6 +593,14 @@
593
593
  "condition": {
594
594
  "functionBody": "return (model.options && model.options.devices && !model.options.devices[arrayIndices].hide_device && model.options.devices[arrayIndices].configDeviceType === 'Water Detector' && model.options.devices[arrayIndices].deviceId);"
595
595
  }
596
+ },
597
+ "dry": {
598
+ "title": "Water Detector's Dry Alert",
599
+ "type": "boolean",
600
+ "description": "If true, the Water Detector will send an alert when it is dry.",
601
+ "condition": {
602
+ "functionBody": "return (model.options && model.options.devices && !model.options.devices[arrayIndices].hide_device && model.options.devices[arrayIndices].configDeviceType === 'Water Detector' && model.options.devices[arrayIndices].deviceId);"
603
+ }
596
604
  }
597
605
  }
598
606
  },
@@ -1862,6 +1870,7 @@
1862
1870
  "options.devices[].hub.hide_humidity",
1863
1871
  "options.devices[].hub.hide_lightsensor",
1864
1872
  "options.devices[].waterdetector.hide_leak",
1873
+ "options.devices[].waterdetector.dry",
1865
1874
  "options.devices[].humidifier.set_minStep",
1866
1875
  "options.devices[].humidifier.hide_temperature",
1867
1876
  "options.devices[].curtain.set_minStep",
@@ -1 +1 @@
1
- {"version":3,"file":"bot-old.d.ts","sourceRoot":"","sources":["../../src/device/bot-old.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,mBAAmB,EAAE,GAAG,EAAE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAC5E,OAAO,KAAK,EAAE,cAAc,IAAI,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAChF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,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G,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAQlC,QAAQ,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IAU7B,qBAAqB,IAAI,OAAO;CAGjC"}
@@ -105,8 +105,7 @@ export class Bot {
105
105
  this.removeWindowCoveringService(accessory);
106
106
  this.removeStatefulProgrammableSwitchService(accessory);
107
107
  // Add switchService
108
- this.switchService = (accessory.getService(this.hap.Service.Switch)
109
- || accessory.addService(this.hap.Service.Switch));
108
+ this.switchService = (accessory.getService(this.hap.Service.Switch) || accessory.addService(this.hap.Service.Switch));
110
109
  this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Switch`);
111
110
  this.switchService.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
112
111
  if (!this.switchService.testCharacteristic(this.hap.Characteristic.ConfiguredName)) {
@@ -125,8 +124,7 @@ export class Bot {
125
124
  this.removeWindowCoveringService(accessory);
126
125
  this.removeStatefulProgrammableSwitchService(accessory);
127
126
  // Add garageDoorService
128
- this.garageDoorService = (accessory.getService(this.hap.Service.GarageDoorOpener)
129
- || accessory.addService(this.hap.Service.GarageDoorOpener));
127
+ this.garageDoorService = (accessory.getService(this.hap.Service.GarageDoorOpener) || accessory.addService(this.hap.Service.GarageDoorOpener));
130
128
  this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Garage Door Opener`);
131
129
  this.garageDoorService.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
132
130
  if (!this.garageDoorService.testCharacteristic(this.hap.Characteristic.ConfiguredName)) {
@@ -146,8 +144,7 @@ export class Bot {
146
144
  this.removeWindowCoveringService(accessory);
147
145
  this.removeStatefulProgrammableSwitchService(accessory);
148
146
  // Add doorService
149
- this.doorService = accessory.getService(this.hap.Service.Door)
150
- || accessory.addService(this.hap.Service.Door);
147
+ this.doorService = accessory.getService(this.hap.Service.Door) || accessory.addService(this.hap.Service.Door);
151
148
  this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Door`);
152
149
  this.doorService.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
153
150
  if (!this.doorService.testCharacteristic(this.hap.Characteristic.ConfiguredName)) {
@@ -175,8 +172,7 @@ export class Bot {
175
172
  this.removeWindowCoveringService(accessory);
176
173
  this.removeStatefulProgrammableSwitchService(accessory);
177
174
  // Add windowService
178
- this.windowService = accessory.getService(this.hap.Service.Window)
179
- || accessory.addService(this.hap.Service.Window);
175
+ this.windowService = accessory.getService(this.hap.Service.Window) || accessory.addService(this.hap.Service.Window);
180
176
  this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Window`);
181
177
  this.windowService.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
182
178
  if (!this.windowService.testCharacteristic(this.hap.Characteristic.ConfiguredName)) {
@@ -204,8 +200,7 @@ export class Bot {
204
200
  this.removeGarageDoorService(accessory);
205
201
  this.removeStatefulProgrammableSwitchService(accessory);
206
202
  // Add windowCoveringService
207
- this.windowCoveringService = accessory.getService(this.hap.Service.WindowCovering)
208
- || accessory.addService(this.hap.Service.WindowCovering);
203
+ this.windowCoveringService = accessory.getService(this.hap.Service.WindowCovering) || accessory.addService(this.hap.Service.WindowCovering);
209
204
  this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Window Covering`);
210
205
  this.windowCoveringService.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
211
206
  if (!this.windowCoveringService.testCharacteristic(this.hap.Characteristic.ConfiguredName)) {
@@ -233,8 +228,7 @@ export class Bot {
233
228
  this.removeWindowCoveringService(accessory);
234
229
  this.removeStatefulProgrammableSwitchService(accessory);
235
230
  // Add lockService
236
- this.lockService = accessory.getService(this.hap.Service.LockMechanism)
237
- || accessory.addService(this.hap.Service.LockMechanism);
231
+ this.lockService = accessory.getService(this.hap.Service.LockMechanism) || accessory.addService(this.hap.Service.LockMechanism);
238
232
  this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Lock`);
239
233
  this.lockService.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
240
234
  if (!this.lockService.testCharacteristic(this.hap.Characteristic.ConfiguredName)) {
@@ -253,8 +247,7 @@ export class Bot {
253
247
  this.removeWindowCoveringService(accessory);
254
248
  this.removeStatefulProgrammableSwitchService(accessory);
255
249
  // Add faucetService
256
- this.faucetService = accessory.getService(this.hap.Service.Faucet)
257
- || accessory.addService(this.hap.Service.Faucet);
250
+ this.faucetService = accessory.getService(this.hap.Service.Faucet) || accessory.addService(this.hap.Service.Faucet);
258
251
  this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Faucet`);
259
252
  this.faucetService.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
260
253
  if (!this.faucetService.testCharacteristic(this.hap.Characteristic.ConfiguredName)) {
@@ -273,8 +266,7 @@ export class Bot {
273
266
  this.removeWindowCoveringService(accessory);
274
267
  this.removeStatefulProgrammableSwitchService(accessory);
275
268
  // Add fanService
276
- this.fanService = accessory.getService(this.hap.Service.Fan)
277
- || accessory.addService(this.hap.Service.Fan);
269
+ this.fanService = accessory.getService(this.hap.Service.Fan) || accessory.addService(this.hap.Service.Fan);
278
270
  this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Fan`);
279
271
  this.fanService.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
280
272
  if (!this.fanService.testCharacteristic(this.hap.Characteristic.ConfiguredName)) {
@@ -293,8 +285,7 @@ export class Bot {
293
285
  this.removeGarageDoorService(accessory);
294
286
  this.removeWindowCoveringService(accessory);
295
287
  // Add statefulProgrammableSwitchService
296
- this.statefulProgrammableSwitchService = (accessory.getService(this.hap.Service.StatefulProgrammableSwitch)
297
- || accessory.addService(this.hap.Service.StatefulProgrammableSwitch));
288
+ this.statefulProgrammableSwitchService = (accessory.getService(this.hap.Service.StatefulProgrammableSwitch) || accessory.addService(this.hap.Service.StatefulProgrammableSwitch));
298
289
  this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Stateful Programmable Switch`);
299
290
  this.statefulProgrammableSwitchService.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
300
291
  if (!this.statefulProgrammableSwitchService.testCharacteristic(this.hap.Characteristic.ConfiguredName)) {
@@ -315,8 +306,7 @@ export class Bot {
315
306
  this.removeWindowCoveringService(accessory);
316
307
  this.removeStatefulProgrammableSwitchService(accessory);
317
308
  // Add outletService
318
- this.outletService = (accessory.getService(this.hap.Service.Outlet)
319
- || accessory.addService(this.hap.Service.Outlet));
309
+ this.outletService = (accessory.getService(this.hap.Service.Outlet) || accessory.addService(this.hap.Service.Outlet));
320
310
  this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Outlet`);
321
311
  this.outletService.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
322
312
  if (!this.outletService.testCharacteristic(this.hap.Characteristic.ConfiguredName)) {
@@ -325,8 +315,7 @@ export class Bot {
325
315
  this.outletService.getCharacteristic(this.hap.Characteristic.On).onSet(this.OnSet.bind(this));
326
316
  }
327
317
  // batteryService
328
- this.batteryService = (this.accessory.getService(this.hap.Service.Battery)
329
- || accessory.addService(this.hap.Service.Battery));
318
+ this.batteryService = (this.accessory.getService(this.hap.Service.Battery) || accessory.addService(this.hap.Service.Battery));
330
319
  this.batteryService.setCharacteristic(this.hap.Characteristic.Name, `${accessory.displayName} Battery`);
331
320
  if (!this.batteryService.testCharacteristic(this.hap.Characteristic.ConfiguredName)) {
332
321
  this.batteryService.addCharacteristic(this.hap.Characteristic.ConfiguredName, `${accessory.displayName} Battery`);
@@ -348,18 +337,14 @@ export class Bot {
348
337
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} received Webhook: ${JSON.stringify(context)}`);
349
338
  const { power, battery, deviceMode } = context;
350
339
  const { On, BatteryLevel, botMode } = this;
351
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
352
- + '(power, battery, deviceMode) = '
353
- + `Webhook:(${power}, ${battery}, ${deviceMode}), `
354
- + `current:(${On}, ${BatteryLevel}, ${botMode})`);
340
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} (power, battery, deviceMode) = Webhook:(${power}, ${battery}, ${deviceMode}), current:(${On}, ${BatteryLevel}, ${botMode})`);
355
341
  this.On = power;
356
342
  this.BatteryLevel = battery;
357
343
  this.botMode = deviceMode;
358
344
  this.updateHomeKitCharacteristics();
359
345
  }
360
346
  catch (e) {
361
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
362
- + `failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e}`);
347
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e}`);
363
348
  }
364
349
  };
365
350
  }
@@ -433,8 +418,7 @@ export class Bot {
433
418
  if (Number.isNaN(this.BatteryLevel)) {
434
419
  this.BatteryLevel = 100;
435
420
  }
436
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},`
437
- + ` StatusLowBattery: ${this.StatusLowBattery}`);
421
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}, StatusLowBattery: ${this.StatusLowBattery}`);
438
422
  }
439
423
  async openAPIparseStatus() {
440
424
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIparseStatus`);
@@ -460,8 +444,7 @@ export class Bot {
460
444
  if (Number.isNaN(this.BatteryLevel)) {
461
445
  this.BatteryLevel = 100;
462
446
  }
463
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},`
464
- + ` StatusLowBattery: ${this.StatusLowBattery}`);
447
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}, StatusLowBattery: ${this.StatusLowBattery}`);
465
448
  // FirmwareRevision
466
449
  this.FirmwareRevision = this.OpenAPI_FirmwareRevision;
467
450
  this.accessory.context.FirmwareRevision = this.FirmwareRevision;
@@ -585,8 +568,7 @@ export class Bot {
585
568
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
586
569
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
587
570
  if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
588
- this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
589
- + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
571
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
590
572
  this.OpenAPI_On = deviceStatus.body.power;
591
573
  this.OpenAPI_BatteryLevel = deviceStatus.body.battery;
592
574
  this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
@@ -754,8 +736,7 @@ export class Bot {
754
736
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
755
737
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
756
738
  if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
757
- this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
758
- + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
739
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
759
740
  }
760
741
  else {
761
742
  this.statusCode(statusCode);
@@ -1160,8 +1141,7 @@ export class Bot {
1160
1141
  }
1161
1142
  }
1162
1143
  async BLERefreshConnection(switchbot) {
1163
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot:`
1164
- + ` ${JSON.stringify(switchbot)}`);
1144
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} wasn't able to establish BLE Connection, node-switchbot: ${JSON.stringify(switchbot)}`);
1165
1145
  if (this.platform.config.credentials?.token && this.device.connectionType === 'BLE/OpenAPI') {
1166
1146
  this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} Using OpenAPI Connection to Refresh Status`);
1167
1147
  await this.openAPIRefreshStatus();
@@ -1247,13 +1227,11 @@ export class Bot {
1247
1227
  this.offlineOff();
1248
1228
  break;
1249
1229
  case 171:
1250
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Hub Device is offline, statusCode: ${statusCode}. `
1251
- + `Hub: ${this.device.hubDeviceId}`);
1230
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Hub Device is offline, statusCode: ${statusCode}. Hub: ${this.device.hubDeviceId}`);
1252
1231
  this.offlineOff();
1253
1232
  break;
1254
1233
  case 190:
1255
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Device internal error due to device states not synchronized with server,`
1256
- + ` Or command format is invalid, statusCode: ${statusCode}`);
1234
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Device internal error due to device states not synchronized with server, Or command format is invalid, statusCode: ${statusCode}`);
1257
1235
  break;
1258
1236
  case 100:
1259
1237
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Command successfully sent, statusCode: ${statusCode}`);
@@ -1262,44 +1240,34 @@ export class Bot {
1262
1240
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Request successful, statusCode: ${statusCode}`);
1263
1241
  break;
1264
1242
  case 400:
1265
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Bad Request, The client has issued an invalid request. `
1266
- + `This is commonly used to specify validation errors in a request payload, statusCode: ${statusCode}`);
1243
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Bad Request, The client has issued an invalid request. This is commonly used to specify validation errors in a request payload, statusCode: ${statusCode}`);
1267
1244
  break;
1268
1245
  case 401:
1269
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Unauthorized, Authorization for the API is required, `
1270
- + `but the request has not been authenticated, statusCode: ${statusCode}`);
1246
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Unauthorized, Authorization for the API is required, but the request has not been authenticated, statusCode: ${statusCode}`);
1271
1247
  break;
1272
1248
  case 403:
1273
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Forbidden, The request has been authenticated but does not `
1274
- + `have appropriate permissions, or a requested resource is not found, statusCode: ${statusCode}`);
1249
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Forbidden, The request has been authenticated but does not have appropriate permissions, or a requested resource is not found, statusCode: ${statusCode}`);
1275
1250
  break;
1276
1251
  case 404:
1277
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Not Found, Specifies the requested path does not exist, `
1278
- + `statusCode: ${statusCode}`);
1252
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Not Found, Specifies the requested path does not exist, statusCode: ${statusCode}`);
1279
1253
  break;
1280
1254
  case 406:
1281
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Not Acceptable, The client has requested a MIME type via `
1282
- + `the Accept header for a value not supported by the server, statusCode: ${statusCode}`);
1255
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Not Acceptable, The client has requested a MIME type via the Accept header for a value not supported by the server, statusCode: ${statusCode}`);
1283
1256
  break;
1284
1257
  case 415:
1285
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Unsupported Media Type, The client has defined a contentType `
1286
- + `header that is not supported by the server, statusCode: ${statusCode}`);
1258
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Unsupported Media Type, The client has defined a contentType header that is not supported by the server, statusCode: ${statusCode}`);
1287
1259
  break;
1288
1260
  case 422:
1289
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Unprocessable Entity, The client has made a valid request, `
1290
- + `but the server cannot process it. This is often used for APIs for which certain limits have been exceeded, statusCode: ${statusCode}`);
1261
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Unprocessable Entity, The client has made a valid request, but the server cannot process it. This is often used for APIs for which certain limits have been exceeded, statusCode: ${statusCode}`);
1291
1262
  break;
1292
1263
  case 429:
1293
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Too Many Requests, The client has exceeded the number of `
1294
- + `requests allowed for a given time window, statusCode: ${statusCode}`);
1264
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Too Many Requests, The client has exceeded the number of requests allowed for a given time window, statusCode: ${statusCode}`);
1295
1265
  break;
1296
1266
  case 500:
1297
- this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Internal Server Error, An unexpected error on the SmartThings `
1298
- + `servers has occurred. These errors should be rare, statusCode: ${statusCode}`);
1267
+ this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Internal Server Error, An unexpected error on the SmartThings servers has occurred. These errors should be rare, statusCode: ${statusCode}`);
1299
1268
  break;
1300
1269
  default:
1301
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Unknown statusCode: `
1302
- + `${statusCode}, Submit Bugs Here: ' + 'https://tinyurl.com/SwitchBotBug`);
1270
+ this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Unknown statusCode: ${statusCode}, Submit Bugs Here: https://tinyurl.com/SwitchBotBug`);
1303
1271
  }
1304
1272
  }
1305
1273
  async offlineOff() {