@switchbot/homebridge-switchbot 3.7.1-beta.3 → 3.7.1-beta.4

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 (78) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/device/blindtilt.d.ts.map +1 -1
  3. package/dist/device/blindtilt.js +25 -6
  4. package/dist/device/blindtilt.js.map +1 -1
  5. package/dist/device/bot.d.ts.map +1 -1
  6. package/dist/device/bot.js +25 -6
  7. package/dist/device/bot.js.map +1 -1
  8. package/dist/device/ceilinglight.d.ts.map +1 -1
  9. package/dist/device/ceilinglight.js +25 -6
  10. package/dist/device/ceilinglight.js.map +1 -1
  11. package/dist/device/colorbulb.d.ts.map +1 -1
  12. package/dist/device/colorbulb.js +25 -6
  13. package/dist/device/colorbulb.js.map +1 -1
  14. package/dist/device/contact.d.ts.map +1 -1
  15. package/dist/device/contact.js +25 -6
  16. package/dist/device/contact.js.map +1 -1
  17. package/dist/device/curtain.d.ts.map +1 -1
  18. package/dist/device/curtain.js +25 -6
  19. package/dist/device/curtain.js.map +1 -1
  20. package/dist/device/fan.d.ts.map +1 -1
  21. package/dist/device/fan.js +25 -6
  22. package/dist/device/fan.js.map +1 -1
  23. package/dist/device/hub.d.ts.map +1 -1
  24. package/dist/device/hub.js +25 -6
  25. package/dist/device/hub.js.map +1 -1
  26. package/dist/device/humidifier.d.ts.map +1 -1
  27. package/dist/device/humidifier.js +25 -6
  28. package/dist/device/humidifier.js.map +1 -1
  29. package/dist/device/iosensor.d.ts.map +1 -1
  30. package/dist/device/iosensor.js +25 -6
  31. package/dist/device/iosensor.js.map +1 -1
  32. package/dist/device/lightstrip.d.ts.map +1 -1
  33. package/dist/device/lightstrip.js +25 -6
  34. package/dist/device/lightstrip.js.map +1 -1
  35. package/dist/device/lock.d.ts.map +1 -1
  36. package/dist/device/lock.js +25 -6
  37. package/dist/device/lock.js.map +1 -1
  38. package/dist/device/meter.d.ts.map +1 -1
  39. package/dist/device/meter.js +25 -6
  40. package/dist/device/meter.js.map +1 -1
  41. package/dist/device/meterplus.d.ts.map +1 -1
  42. package/dist/device/meterplus.js +25 -6
  43. package/dist/device/meterplus.js.map +1 -1
  44. package/dist/device/motion.d.ts.map +1 -1
  45. package/dist/device/motion.js +25 -6
  46. package/dist/device/motion.js.map +1 -1
  47. package/dist/device/plug.d.ts.map +1 -1
  48. package/dist/device/plug.js +25 -6
  49. package/dist/device/plug.js.map +1 -1
  50. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  51. package/dist/device/robotvacuumcleaner.js +25 -6
  52. package/dist/device/robotvacuumcleaner.js.map +1 -1
  53. package/dist/device/waterdetector.d.ts.map +1 -1
  54. package/dist/device/waterdetector.js +25 -6
  55. package/dist/device/waterdetector.js.map +1 -1
  56. package/dist/platform.d.ts.map +1 -1
  57. package/dist/platform.js +22 -3
  58. package/dist/platform.js.map +1 -1
  59. package/package.json +6 -6
  60. package/src/device/blindtilt.ts +22 -6
  61. package/src/device/bot.ts +22 -6
  62. package/src/device/ceilinglight.ts +22 -6
  63. package/src/device/colorbulb.ts +22 -6
  64. package/src/device/contact.ts +22 -6
  65. package/src/device/curtain.ts +23 -6
  66. package/src/device/fan.ts +22 -6
  67. package/src/device/hub.ts +22 -6
  68. package/src/device/humidifier.ts +22 -6
  69. package/src/device/iosensor.ts +22 -6
  70. package/src/device/lightstrip.ts +22 -6
  71. package/src/device/lock.ts +22 -6
  72. package/src/device/meter.ts +22 -6
  73. package/src/device/meterplus.ts +22 -6
  74. package/src/device/motion.ts +22 -6
  75. package/src/device/plug.ts +22 -6
  76. package/src/device/robotvacuumcleaner.ts +22 -6
  77. package/src/device/waterdetector.ts +22 -6
  78. package/src/platform.ts +19 -3
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "SwitchBot",
3
3
  "name": "@switchbot/homebridge-switchbot",
4
- "version": "3.7.1-beta.3",
4
+ "version": "3.7.1-beta.4",
5
5
  "description": "The SwitchBot plugin allows you to access your SwitchBot device(s) from HomeKit.",
6
6
  "author": {
7
7
  "name": "SwitchBot",
@@ -90,11 +90,11 @@
90
90
  "node-switchbot": "2.3.0"
91
91
  },
92
92
  "devDependencies": {
93
- "@eslint/js": "^9.7.0",
94
- "@stylistic/eslint-plugin": "^2.3.0",
93
+ "@eslint/js": "^9.8.0",
94
+ "@stylistic/eslint-plugin": "^2.4.0",
95
95
  "@types/eslint__js": "^8.42.3",
96
- "@types/node": "^20.14.11",
97
- "eslint": "^9.7.0",
96
+ "@types/node": "^20.14.12",
97
+ "eslint": "^9.8.0",
98
98
  "globals": "^15.8.0",
99
99
  "homebridge": "^2.0.0-beta.0",
100
100
  "homebridge-config-ui-x": "4.56.4",
@@ -104,6 +104,6 @@
104
104
  "ts-node": "^10.9.2",
105
105
  "typedoc": "^0.26.5",
106
106
  "typescript": "^5.5.4",
107
- "typescript-eslint": "^8.0.0-alpha.51"
107
+ "typescript-eslint": "^8.0.0-alpha.54"
108
108
  }
109
109
  }
@@ -4,6 +4,10 @@
4
4
  */
5
5
  import { deviceBase } from './device.js';
6
6
  import { BlindTiltMappingMode } from '../utils.js';
7
+ /*
8
+ * For Testing Locally:
9
+ * import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
10
+ */
7
11
  import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
8
12
  import { Subject, debounceTime, interval, skipWhile, take, tap } from 'rxjs';
9
13
 
@@ -192,16 +196,28 @@ export class BlindTilt extends deviceBase {
192
196
  }
193
197
 
194
198
  // Retrieve initial values and updateHomekit
195
- this.debugLog('Retrieve initial values and update Homekit');
196
- this.refreshStatus();
199
+ try {
200
+ this.debugLog('Retrieve initial values and update Homekit');
201
+ this.refreshStatus();
202
+ } catch (e: any) {
203
+ this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
204
+ }
197
205
 
198
206
  //regisiter webhook event handler if enabled
199
- this.debugLog('Registering Webhook Event Handler');
200
- this.registerWebhook();
207
+ try {
208
+ this.debugLog('Registering Webhook Event Handler');
209
+ this.registerWebhook();
210
+ } catch (e: any) {
211
+ this.errorLog(`failed to registerWebhook, Error: ${e}`);
212
+ }
201
213
 
202
214
  //regisiter platform BLE event handler if enabled
203
- this.debugLog('Registering Platform BLE Event Handler');
204
- this.registerPlatformBLE();
215
+ try {
216
+ this.debugLog('Registering Platform BLE Event Handler');
217
+ this.registerPlatformBLE();
218
+ } catch (e: any) {
219
+ this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
220
+ }
205
221
 
206
222
  // Start an update interval
207
223
  interval(this.deviceRefreshRate * 1000)
package/src/device/bot.ts CHANGED
@@ -3,6 +3,10 @@
3
3
  * bot.ts: @switchbot/homebridge-switchbot.
4
4
  */
5
5
  import { deviceBase } from './device.js';
6
+ /*
7
+ * For Testing Locally:
8
+ * import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
9
+ */
6
10
  import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
7
11
  import { Subject, debounceTime, interval, skipWhile, take, tap } from 'rxjs';
8
12
 
@@ -424,16 +428,28 @@ export class Bot extends deviceBase {
424
428
  }
425
429
 
426
430
  // Retrieve initial values and updateHomekit
427
- this.debugLog('Retrieve initial values and update Homekit');
428
- this.refreshStatus();
431
+ try {
432
+ this.debugLog('Retrieve initial values and update Homekit');
433
+ this.refreshStatus();
434
+ } catch (e: any) {
435
+ this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
436
+ }
429
437
 
430
438
  //regisiter webhook event handler if enabled
431
- this.debugLog('Registering Webhook Event Handler');
432
- this.registerWebhook();
439
+ try {
440
+ this.debugLog('Registering Webhook Event Handler');
441
+ this.registerWebhook();
442
+ } catch (e: any) {
443
+ this.errorLog(`failed to registerWebhook, Error: ${e}`);
444
+ }
433
445
 
434
446
  //regisiter platform BLE event handler if enabled
435
- this.debugLog('Registering Platform BLE Event Handler');
436
- this.registerPlatformBLE();
447
+ try {
448
+ this.debugLog('Registering Platform BLE Event Handler');
449
+ this.registerPlatformBLE();
450
+ } catch (e: any) {
451
+ this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
452
+ }
437
453
 
438
454
  // Start an update interval
439
455
  interval(this.deviceRefreshRate * 1000)
@@ -4,6 +4,10 @@
4
4
  */
5
5
  import { deviceBase } from './device.js';
6
6
  import { hs2rgb, m2hs } from '../utils.js';
7
+ /*
8
+ * For Testing Locally:
9
+ * import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
10
+ */
7
11
  import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
8
12
  import { Subject, debounceTime, interval, skipWhile, take, tap } from 'rxjs';
9
13
 
@@ -161,16 +165,28 @@ export class CeilingLight extends deviceBase {
161
165
  .onSet(this.SaturationSet.bind(this));
162
166
 
163
167
  // Retrieve initial values and updateHomekit
164
- this.debugLog('Retrieve initial values and update Homekit');
165
- this.refreshStatus();
168
+ try {
169
+ this.debugLog('Retrieve initial values and update Homekit');
170
+ this.refreshStatus();
171
+ } catch (e: any) {
172
+ this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
173
+ }
166
174
 
167
175
  //regisiter webhook event handler if enabled
168
- this.debugLog('Registering Webhook Event Handler');
169
- this.registerWebhook();
176
+ try {
177
+ this.debugLog('Registering Webhook Event Handler');
178
+ this.registerWebhook();
179
+ } catch (e: any) {
180
+ this.errorLog(`failed to registerWebhook, Error: ${e}`);
181
+ }
170
182
 
171
183
  //regisiter platform BLE event handler if enabled
172
- this.debugLog('Registering Platform BLE Event Handler');
173
- this.registerPlatformBLE();
184
+ try {
185
+ this.debugLog('Registering Platform BLE Event Handler');
186
+ this.registerPlatformBLE();
187
+ } catch (e: any) {
188
+ this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
189
+ }
174
190
 
175
191
  // Start an update interval
176
192
  interval(this.deviceRefreshRate * 1000)
@@ -4,6 +4,10 @@
4
4
  */
5
5
  import { deviceBase } from './device.js';
6
6
  import { hs2rgb, rgb2hs, m2hs } from '../utils.js';
7
+ /*
8
+ * For Testing Locally:
9
+ * import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
10
+ */
7
11
  import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
8
12
  import { Subject, debounceTime, interval, skipWhile, take, tap } from 'rxjs';
9
13
 
@@ -157,16 +161,28 @@ export class ColorBulb extends deviceBase {
157
161
  .onSet(this.SaturationSet.bind(this));
158
162
 
159
163
  // Retrieve initial values and updateHomekit
160
- this.debugLog('Retrieve initial values and update Homekit');
161
- this.refreshStatus();
164
+ try {
165
+ this.debugLog('Retrieve initial values and update Homekit');
166
+ this.refreshStatus();
167
+ } catch (e: any) {
168
+ this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
169
+ }
162
170
 
163
171
  //regisiter webhook event handler if enabled
164
- this.debugLog('Registering Webhook Event Handler');
165
- this.registerWebhook();
172
+ try {
173
+ this.debugLog('Registering Webhook Event Handler');
174
+ this.registerWebhook();
175
+ } catch (e: any) {
176
+ this.errorLog(`failed to registerWebhook, Error: ${e}`);
177
+ }
166
178
 
167
179
  //regisiter platform BLE event handler if enabled
168
- this.debugLog('Registering Platform BLE Event Handler');
169
- this.registerPlatformBLE();
180
+ try {
181
+ this.debugLog('Registering Platform BLE Event Handler');
182
+ this.registerPlatformBLE();
183
+ } catch (e: any) {
184
+ this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
185
+ }
170
186
 
171
187
  // Start an update interval
172
188
  interval(this.deviceRefreshRate * 1000)
@@ -4,6 +4,10 @@
4
4
  */
5
5
  import { deviceBase } from './device.js';
6
6
  import { Subject, interval, skipWhile } from 'rxjs';
7
+ /*
8
+ * For Testing Locally:
9
+ * import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
10
+ */
7
11
  import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
8
12
 
9
13
  import type { devicesConfig } from '../settings.js';
@@ -169,16 +173,28 @@ export class Contact extends deviceBase {
169
173
  }
170
174
 
171
175
  // Retrieve initial values and updateHomekit
172
- this.debugLog('Retrieve initial values and update Homekit');
173
- this.refreshStatus();
176
+ try {
177
+ this.debugLog('Retrieve initial values and update Homekit');
178
+ this.refreshStatus();
179
+ } catch (e: any) {
180
+ this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
181
+ }
174
182
 
175
183
  //regisiter webhook event handler if enabled
176
- this.debugLog('Registering Webhook Event Handler');
177
- this.registerWebhook();
184
+ try {
185
+ this.debugLog('Registering Webhook Event Handler');
186
+ this.registerWebhook();
187
+ } catch (e: any) {
188
+ this.errorLog(`failed to registerWebhook, Error: ${e}`);
189
+ }
178
190
 
179
191
  //regisiter platform BLE event handler if enabled
180
- this.debugLog('Registering Platform BLE Event Handler');
181
- this.registerPlatformBLE();
192
+ try {
193
+ this.debugLog('Registering Platform BLE Event Handler');
194
+ this.registerPlatformBLE();
195
+ } catch (e: any) {
196
+ this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
197
+ }
182
198
 
183
199
  // Start an update interval
184
200
  interval(this.deviceRefreshRate * 1000)
@@ -4,7 +4,12 @@
4
4
  */
5
5
  import { hostname } from 'os';
6
6
  import { deviceBase } from './device.js';
7
+ /*
8
+ * For Testing Locally:
9
+ * import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
10
+ */
7
11
  import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
12
+
8
13
  import { Subject, debounceTime, interval, skipWhile, take, tap } from 'rxjs';
9
14
 
10
15
  import type { devicesConfig } from '../settings.js';
@@ -188,16 +193,28 @@ export class Curtain extends deviceBase {
188
193
  }
189
194
 
190
195
  // Retrieve initial values and updateHomekit
191
- this.debugLog('Retrieve initial values and update Homekit');
192
- this.refreshStatus();
196
+ try {
197
+ this.debugLog('Retrieve initial values and update Homekit');
198
+ this.refreshStatus();
199
+ } catch (e: any) {
200
+ this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
201
+ }
193
202
 
194
203
  //regisiter webhook event handler if enabled
195
- this.debugLog('Registering Webhook Event Handler');
196
- this.registerWebhook();
204
+ try {
205
+ this.debugLog('Registering Webhook Event Handler');
206
+ this.registerWebhook();
207
+ } catch (e: any) {
208
+ this.errorLog(`failed to registerWebhook, Error: ${e}`);
209
+ }
197
210
 
198
211
  //regisiter platform BLE event handler if enabled
199
- this.debugLog('Registering Platform BLE Event Handler');
200
- this.registerPlatformBLE();
212
+ try {
213
+ this.debugLog('Registering Platform BLE Event Handler');
214
+ this.registerPlatformBLE();
215
+ } catch (e: any) {
216
+ this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
217
+ }
201
218
 
202
219
  // History
203
220
  this.history();
package/src/device/fan.ts CHANGED
@@ -3,6 +3,10 @@
3
3
  * plug.ts: @switchbot/homebridge-switchbot.
4
4
  */
5
5
  import { deviceBase } from './device.js';
6
+ /*
7
+ * For Testing Locally:
8
+ * import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
9
+ */
6
10
  import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
7
11
  import { Subject, debounceTime, interval, skipWhile, take, tap } from 'rxjs';
8
12
 
@@ -161,16 +165,28 @@ export class Fan extends deviceBase {
161
165
  .onSet(this.BrightnessSet.bind(this));
162
166
 
163
167
  // Retrieve initial values and updateHomekit
164
- this.debugLog('Retrieve initial values and update Homekit');
165
- this.refreshStatus();
168
+ try {
169
+ this.debugLog('Retrieve initial values and update Homekit');
170
+ this.refreshStatus();
171
+ } catch (e: any) {
172
+ this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
173
+ }
166
174
 
167
175
  //regisiter webhook event handler if enabled
168
- this.debugLog('Registering Webhook Event Handler');
169
- this.registerWebhook();
176
+ try {
177
+ this.debugLog('Registering Webhook Event Handler');
178
+ this.registerWebhook();
179
+ } catch (e: any) {
180
+ this.errorLog(`failed to registerWebhook, Error: ${e}`);
181
+ }
170
182
 
171
183
  //regisiter platform BLE event handler if enabled
172
- this.debugLog('Registering Platform BLE Event Handler');
173
- this.registerPlatformBLE();
184
+ try {
185
+ this.debugLog('Registering Platform BLE Event Handler');
186
+ this.registerPlatformBLE();
187
+ } catch (e: any) {
188
+ this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
189
+ }
174
190
 
175
191
  // Start an update interval
176
192
  interval(this.deviceRefreshRate * 1000)
package/src/device/hub.ts CHANGED
@@ -6,6 +6,10 @@ import { Units } from 'homebridge';
6
6
  import { deviceBase } from './device.js';
7
7
  import { Subject, interval, skipWhile} from 'rxjs';
8
8
  import { validHumidity, convertUnits } from '../utils.js';
9
+ /*
10
+ * For Testing Locally:
11
+ * import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
12
+ */
9
13
  import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
10
14
 
11
15
  import type { devicesConfig } from '../settings.js';
@@ -151,16 +155,28 @@ export class Hub extends deviceBase {
151
155
  }
152
156
 
153
157
  // Retrieve initial values and updateHomekit
154
- this.debugLog('Retrieve initial values and update Homekit');
155
- this.refreshStatus();
158
+ try {
159
+ this.debugLog('Retrieve initial values and update Homekit');
160
+ this.refreshStatus();
161
+ } catch (e: any) {
162
+ this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
163
+ }
156
164
 
157
165
  //regisiter webhook event handler if enabled
158
- this.debugLog('Registering Webhook Event Handler');
159
- this.registerWebhook();
166
+ try {
167
+ this.debugLog('Registering Webhook Event Handler');
168
+ this.registerWebhook();
169
+ } catch (e: any) {
170
+ this.errorLog(`failed to registerWebhook, Error: ${e}`);
171
+ }
160
172
 
161
173
  //regisiter platform BLE event handler if enabled
162
- this.debugLog('Registering Platform BLE Event Handler');
163
- this.registerPlatformBLE();
174
+ try {
175
+ this.debugLog('Registering Platform BLE Event Handler');
176
+ this.registerPlatformBLE();
177
+ } catch (e: any) {
178
+ this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
179
+ }
164
180
 
165
181
  // Start an update interval
166
182
  interval(this.deviceRefreshRate * 1000)
@@ -4,6 +4,10 @@
4
4
  */
5
5
  import { deviceBase } from './device.js';
6
6
  import { convertUnits, validHumidity } from '../utils.js';
7
+ /*
8
+ * For Testing Locally:
9
+ * import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
10
+ */
7
11
  import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
8
12
  import { Subject, debounceTime, interval, skipWhile, take, tap } from 'rxjs';
9
13
 
@@ -151,16 +155,28 @@ export class Humidifier extends deviceBase {
151
155
  }
152
156
 
153
157
  // Retrieve initial values and updateHomekit
154
- this.debugLog('Retrieve initial values and update Homekit');
155
- this.refreshStatus();
158
+ try {
159
+ this.debugLog('Retrieve initial values and update Homekit');
160
+ this.refreshStatus();
161
+ } catch (e: any) {
162
+ this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
163
+ }
156
164
 
157
165
  //regisiter webhook event handler if enabled
158
- this.debugLog('Registering Webhook Event Handler');
159
- this.registerWebhook();
166
+ try {
167
+ this.debugLog('Registering Webhook Event Handler');
168
+ this.registerWebhook();
169
+ } catch (e: any) {
170
+ this.errorLog(`failed to registerWebhook, Error: ${e}`);
171
+ }
160
172
 
161
173
  //regisiter platform BLE event handler if enabled
162
- this.debugLog('Registering Platform BLE Event Handler');
163
- this.registerPlatformBLE();
174
+ try {
175
+ this.debugLog('Registering Platform BLE Event Handler');
176
+ this.registerPlatformBLE();
177
+ } catch (e: any) {
178
+ this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
179
+ }
164
180
 
165
181
  // Start an update interval
166
182
  interval(this.deviceRefreshRate * 1000)
@@ -6,6 +6,10 @@ import { Units } from 'homebridge';
6
6
  import { deviceBase } from './device.js';
7
7
  import { Subject, interval, skipWhile } from 'rxjs';
8
8
  import { convertUnits, validHumidity } from '../utils.js';
9
+ /*
10
+ * For Testing Locally:
11
+ * import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
12
+ */
9
13
  import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
10
14
 
11
15
  import type { devicesConfig } from '../settings.js';
@@ -155,16 +159,28 @@ export class IOSensor extends deviceBase {
155
159
  }
156
160
 
157
161
  // Retrieve initial values and updateHomekit
158
- this.debugLog('Retrieve initial values and update Homekit');
159
- this.refreshStatus();
162
+ try {
163
+ this.debugLog('Retrieve initial values and update Homekit');
164
+ this.refreshStatus();
165
+ } catch (e: any) {
166
+ this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
167
+ }
160
168
 
161
169
  //regisiter webhook event handler if enabled
162
- this.debugLog('Registering Webhook Event Handler');
163
- this.registerWebhook();
170
+ try {
171
+ this.debugLog('Registering Webhook Event Handler');
172
+ this.registerWebhook();
173
+ } catch (e: any) {
174
+ this.errorLog(`failed to registerWebhook, Error: ${e}`);
175
+ }
164
176
 
165
177
  //regisiter platform BLE event handler if enabled
166
- this.debugLog('Registering Platform BLE Event Handler');
167
- this.registerPlatformBLE();
178
+ try {
179
+ this.debugLog('Registering Platform BLE Event Handler');
180
+ this.registerPlatformBLE();
181
+ } catch (e: any) {
182
+ this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
183
+ }
168
184
 
169
185
  // Start an update interval
170
186
  interval(this.deviceRefreshRate * 1000)
@@ -4,6 +4,10 @@
4
4
  */
5
5
  import { deviceBase } from './device.js';
6
6
  import { hs2rgb, rgb2hs, m2hs } from '../utils.js';
7
+ /*
8
+ * For Testing Locally:
9
+ * import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
10
+ */
7
11
  import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
8
12
  import { Subject, debounceTime, interval, skipWhile, take, tap } from 'rxjs';
9
13
 
@@ -161,16 +165,28 @@ export class StripLight extends deviceBase {
161
165
  .onSet(this.SaturationSet.bind(this));
162
166
 
163
167
  // Retrieve initial values and updateHomekit
164
- this.debugLog('Retrieve initial values and update Homekit');
165
- this.refreshStatus();
168
+ try {
169
+ this.debugLog('Retrieve initial values and update Homekit');
170
+ this.refreshStatus();
171
+ } catch (e: any) {
172
+ this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
173
+ }
166
174
 
167
175
  //regisiter webhook event handler if enabled
168
- this.debugLog('Registering Webhook Event Handler');
169
- this.registerWebhook();
176
+ try {
177
+ this.debugLog('Registering Webhook Event Handler');
178
+ this.registerWebhook();
179
+ } catch (e: any) {
180
+ this.errorLog(`failed to registerWebhook, Error: ${e}`);
181
+ }
170
182
 
171
183
  //regisiter platform BLE event handler if enabled
172
- this.debugLog('Registering Platform BLE Event Handler');
173
- this.registerPlatformBLE();
184
+ try {
185
+ this.debugLog('Registering Platform BLE Event Handler');
186
+ this.registerPlatformBLE();
187
+ } catch (e: any) {
188
+ this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
189
+ }
174
190
 
175
191
  // Start an update interval
176
192
  interval(this.deviceRefreshRate * 1000)
@@ -3,6 +3,10 @@
3
3
  * lock.ts: @switchbot/homebridge-switchbot.
4
4
  */
5
5
  import { deviceBase } from './device.js';
6
+ /*
7
+ * For Testing Locally:
8
+ * import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
9
+ */
6
10
  import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
7
11
  import { Subject, debounceTime, interval, skipWhile, take, tap } from 'rxjs';
8
12
 
@@ -165,16 +169,28 @@ export class Lock extends deviceBase {
165
169
  }
166
170
 
167
171
  // Retrieve initial values and updateHomekit
168
- this.debugLog('Retrieve initial values and update Homekit');
169
- this.refreshStatus();
172
+ try {
173
+ this.debugLog('Retrieve initial values and update Homekit');
174
+ this.refreshStatus();
175
+ } catch (e: any) {
176
+ this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
177
+ }
170
178
 
171
179
  //regisiter webhook event handler if enabled
172
- this.debugLog('Registering Webhook Event Handler');
173
- this.registerWebhook();
180
+ try {
181
+ this.debugLog('Registering Webhook Event Handler');
182
+ this.registerWebhook();
183
+ } catch (e: any) {
184
+ this.errorLog(`failed to registerWebhook, Error: ${e}`);
185
+ }
174
186
 
175
187
  //regisiter platform BLE event handler if enabled
176
- this.debugLog('Registering Platform BLE Event Handler');
177
- this.registerPlatformBLE();
188
+ try {
189
+ this.debugLog('Registering Platform BLE Event Handler');
190
+ this.registerPlatformBLE();
191
+ } catch (e: any) {
192
+ this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
193
+ }
178
194
 
179
195
  // Start an update interval
180
196
  interval(this.deviceRefreshRate * 1000)
@@ -6,6 +6,10 @@ import { Units } from 'homebridge';
6
6
  import { deviceBase } from './device.js';
7
7
  import { Subject, interval, skipWhile } from 'rxjs';
8
8
  import { convertUnits, validHumidity } from '../utils.js';
9
+ /*
10
+ * For Testing Locally:
11
+ * import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
12
+ */
9
13
  import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
10
14
 
11
15
  import type { devicesConfig } from '../settings.js';
@@ -148,16 +152,28 @@ export class Meter extends deviceBase {
148
152
  }
149
153
 
150
154
  // Retrieve initial values and updateHomekit
151
- this.debugLog('Retrieve initial values and update Homekit');
152
- this.refreshStatus();
155
+ try {
156
+ this.debugLog('Retrieve initial values and update Homekit');
157
+ this.refreshStatus();
158
+ } catch (e: any) {
159
+ this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
160
+ }
153
161
 
154
162
  //regisiter webhook event handler if enabled
155
- this.debugLog('Registering Webhook Event Handler');
156
- this.registerWebhook();
163
+ try {
164
+ this.debugLog('Registering Webhook Event Handler');
165
+ this.registerWebhook();
166
+ } catch (e: any) {
167
+ this.errorLog(`failed to registerWebhook, Error: ${e}`);
168
+ }
157
169
 
158
170
  //regisiter platform BLE event handler if enabled
159
- this.debugLog('Registering Platform BLE Event Handler');
160
- this.registerPlatformBLE();
171
+ try {
172
+ this.debugLog('Registering Platform BLE Event Handler');
173
+ this.registerPlatformBLE();
174
+ } catch (e: any) {
175
+ this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
176
+ }
161
177
 
162
178
  // Start an update interval
163
179
  interval(this.deviceRefreshRate * 1000)