@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
@@ -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';
@@ -153,16 +157,28 @@ export class MeterPlus extends deviceBase {
153
157
  }
154
158
 
155
159
  // Retrieve initial values and updateHomekit
156
- this.debugLog('Retrieve initial values and update Homekit');
157
- this.refreshStatus();
160
+ try {
161
+ this.debugLog('Retrieve initial values and update Homekit');
162
+ this.refreshStatus();
163
+ } catch (e: any) {
164
+ this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
165
+ }
158
166
 
159
167
  //regisiter webhook event handler if enabled
160
- this.debugLog('Registering Webhook Event Handler');
161
- this.registerWebhook();
168
+ try {
169
+ this.debugLog('Registering Webhook Event Handler');
170
+ this.registerWebhook();
171
+ } catch (e: any) {
172
+ this.errorLog(`failed to registerWebhook, Error: ${e}`);
173
+ }
162
174
 
163
175
  //regisiter platform BLE event handler if enabled
164
- this.debugLog('Registering Platform BLE Event Handler');
165
- this.registerPlatformBLE();
176
+ try {
177
+ this.debugLog('Registering Platform BLE Event Handler');
178
+ this.registerPlatformBLE();
179
+ } catch (e: any) {
180
+ this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
181
+ }
166
182
 
167
183
  // Start an update interval
168
184
  interval(this.deviceRefreshRate * 1000)
@@ -5,6 +5,10 @@
5
5
  */
6
6
  import { deviceBase } from './device.js';
7
7
  import { Subject, interval, skipWhile } from 'rxjs';
8
+ /*
9
+ * For Testing Locally:
10
+ * import { SwitchBotBLEModel, SwitchBotBLEModelName } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
11
+ */
8
12
  import { SwitchBotBLEModel, SwitchBotBLEModelName } from 'node-switchbot';
9
13
 
10
14
  import type { devicesConfig } from '../settings.js';
@@ -138,16 +142,28 @@ export class Motion extends deviceBase {
138
142
  };
139
143
 
140
144
  // Retrieve initial values and updateHomekit
141
- this.debugLog('Retrieve initial values and update Homekit');
142
- this.refreshStatus();
145
+ try {
146
+ this.debugLog('Retrieve initial values and update Homekit');
147
+ this.refreshStatus();
148
+ } catch (e: any) {
149
+ this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
150
+ }
143
151
 
144
152
  //regisiter webhook event handler if enabled
145
- this.debugLog('Registering Webhook Event Handler');
146
- this.registerWebhook();
153
+ try {
154
+ this.debugLog('Registering Webhook Event Handler');
155
+ this.registerWebhook();
156
+ } catch (e: any) {
157
+ this.errorLog(`failed to registerWebhook, Error: ${e}`);
158
+ }
147
159
 
148
160
  //regisiter platform BLE event handler if enabled
149
- this.debugLog('Registering Platform BLE Event Handler');
150
- this.registerPlatformBLE();
161
+ try {
162
+ this.debugLog('Registering Platform BLE Event Handler');
163
+ this.registerPlatformBLE();
164
+ } catch (e: any) {
165
+ this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
166
+ }
151
167
 
152
168
  // Start an update interval
153
169
  interval(this.deviceRefreshRate * 1000)
@@ -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
 
@@ -66,16 +70,28 @@ export class Plug extends deviceBase {
66
70
  .onSet(this.OnSet.bind(this));
67
71
 
68
72
  // Retrieve initial values and updateHomekit
69
- this.debugLog('Retrieve initial values and update Homekit');
70
- this.refreshStatus();
73
+ try {
74
+ this.debugLog('Retrieve initial values and update Homekit');
75
+ this.refreshStatus();
76
+ } catch (e: any) {
77
+ this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
78
+ }
71
79
 
72
80
  //regisiter webhook event handler if enabled
73
- this.debugLog('Registering Webhook Event Handler');
74
- this.registerWebhook();
81
+ try {
82
+ this.debugLog('Registering Webhook Event Handler');
83
+ this.registerWebhook();
84
+ } catch (e: any) {
85
+ this.errorLog(`failed to registerWebhook, Error: ${e}`);
86
+ }
75
87
 
76
88
  //regisiter platform BLE event handler if enabled
77
- this.debugLog('Registering Platform BLE Event Handler');
78
- this.registerPlatformBLE();
89
+ try {
90
+ this.debugLog('Registering Platform BLE Event Handler');
91
+ this.registerPlatformBLE();
92
+ } catch (e: any) {
93
+ this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
94
+ }
79
95
 
80
96
  // Start an update interval
81
97
  interval(this.deviceRefreshRate * 1000)
@@ -3,6 +3,10 @@
3
3
  * robotvacuumcleaner.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
 
@@ -127,16 +131,28 @@ export class RobotVacuumCleaner extends deviceBase {
127
131
  });
128
132
 
129
133
  // Retrieve initial values and updateHomekit
130
- this.debugLog('Retrieve initial values and update Homekit');
131
- this.refreshStatus();
134
+ try {
135
+ this.debugLog('Retrieve initial values and update Homekit');
136
+ this.refreshStatus();
137
+ } catch (e: any) {
138
+ this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
139
+ }
132
140
 
133
141
  //regisiter webhook event handler if enabled
134
- this.debugLog('Registering Webhook Event Handler');
135
- this.registerWebhook();
142
+ try {
143
+ this.debugLog('Registering Webhook Event Handler');
144
+ this.registerWebhook();
145
+ } catch (e: any) {
146
+ this.errorLog(`failed to registerWebhook, Error: ${e}`);
147
+ }
136
148
 
137
149
  //regisiter platform BLE event handler if enabled
138
- this.debugLog('Registering Platform BLE Event Handler');
139
- this.registerPlatformBLE();
150
+ try {
151
+ this.debugLog('Registering Platform BLE Event Handler');
152
+ this.registerPlatformBLE();
153
+ } catch (e: any) {
154
+ this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
155
+ }
140
156
 
141
157
  // Start an update interval
142
158
  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';
@@ -118,16 +122,28 @@ export class WaterDetector extends deviceBase {
118
122
  }
119
123
 
120
124
  // Retrieve initial values and updateHomekit
121
- this.debugLog('Retrieve initial values and update Homekit');
122
- this.refreshStatus();
125
+ try {
126
+ this.debugLog('Retrieve initial values and update Homekit');
127
+ this.refreshStatus();
128
+ } catch (e: any) {
129
+ this.errorLog(`failed to retrieve initial values and update Homekit, Error: ${e}`);
130
+ }
123
131
 
124
132
  //regisiter webhook event handler if enabled
125
- this.debugLog('Registering Webhook Event Handler');
126
- this.registerWebhook();
133
+ try {
134
+ this.debugLog('Registering Webhook Event Handler');
135
+ this.registerWebhook();
136
+ } catch (e: any) {
137
+ this.errorLog(`failed to registerWebhook, Error: ${e}`);
138
+ }
127
139
 
128
140
  //regisiter platform BLE event handler if enabled
129
- this.debugLog('Registering Platform BLE Event Handler');
130
- this.registerPlatformBLE();
141
+ try {
142
+ this.debugLog('Registering Platform BLE Event Handler');
143
+ this.registerPlatformBLE();
144
+ } catch (e: any) {
145
+ this.errorLog(`failed to registerPlatformBLE, Error: ${e}`);
146
+ }
131
147
 
132
148
  // Start an update interval
133
149
  interval(this.deviceRefreshRate * 1000)
package/src/platform.ts CHANGED
@@ -51,6 +51,10 @@ import type { blindTilt, curtain, curtain3, device } from './types/devicelist.js
51
51
  import type { API, DynamicPlatformPlugin, Logging, PlatformAccessory } from 'homebridge';
52
52
  import type { SwitchBotPlatformConfig, devicesConfig, irDevicesConfig } from './settings.js';
53
53
  import type { IncomingMessage, Server, ServerResponse } from 'http';
54
+ /*
55
+ * For Testing Locally:
56
+ * import { SwitchBotModel } from '/Users/Shared/GitHub/OpenWonderLabs/node-switchbot/dist/index.js';
57
+ */
54
58
  import { SwitchBotModel } from 'node-switchbot';
55
59
 
56
60
  /**
@@ -147,9 +151,21 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
147
151
  }
148
152
  });
149
153
 
150
- this.setupMqtt();
151
- this.setupwebhook();
152
- this.setupBlE();
154
+ try {
155
+ this.setupMqtt();
156
+ } catch (e: any) {
157
+ this.errorLog(`Setup MQTT, Error Message: ${e.message}, Submit Bugs Here: ` + 'https://tinyurl.com/SwitchBotBug');
158
+ }
159
+ try {
160
+ this.setupwebhook();
161
+ } catch (e: any) {
162
+ this.errorLog(`Setup Webhook, Error Message: ${e.message}, Submit Bugs Here: ` + 'https://tinyurl.com/SwitchBotBug');
163
+ }
164
+ try {
165
+ this.setupBlE();
166
+ } catch (e: any) {
167
+ this.errorLog(`Setup Platform BLE, Error Message: ${e.message}, Submit Bugs Here: ` + 'https://tinyurl.com/SwitchBotBug');
168
+ }
153
169
  }
154
170
 
155
171
  async setupMqtt(): Promise<void> {