@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.
- package/CHANGELOG.md +8 -0
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +25 -6
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +25 -6
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +25 -6
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +25 -6
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +25 -6
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +25 -6
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/fan.d.ts.map +1 -1
- package/dist/device/fan.js +25 -6
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +25 -6
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +25 -6
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +25 -6
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +25 -6
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +25 -6
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +25 -6
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +25 -6
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +25 -6
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +25 -6
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +25 -6
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +25 -6
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +22 -3
- package/dist/platform.js.map +1 -1
- package/package.json +6 -6
- package/src/device/blindtilt.ts +22 -6
- package/src/device/bot.ts +22 -6
- package/src/device/ceilinglight.ts +22 -6
- package/src/device/colorbulb.ts +22 -6
- package/src/device/contact.ts +22 -6
- package/src/device/curtain.ts +23 -6
- package/src/device/fan.ts +22 -6
- package/src/device/hub.ts +22 -6
- package/src/device/humidifier.ts +22 -6
- package/src/device/iosensor.ts +22 -6
- package/src/device/lightstrip.ts +22 -6
- package/src/device/lock.ts +22 -6
- package/src/device/meter.ts +22 -6
- package/src/device/meterplus.ts +22 -6
- package/src/device/motion.ts +22 -6
- package/src/device/plug.ts +22 -6
- package/src/device/robotvacuumcleaner.ts +22 -6
- package/src/device/waterdetector.ts +22 -6
- 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.
|
|
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.
|
|
94
|
-
"@stylistic/eslint-plugin": "^2.
|
|
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.
|
|
97
|
-
"eslint": "^9.
|
|
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.
|
|
107
|
+
"typescript-eslint": "^8.0.0-alpha.54"
|
|
108
108
|
}
|
|
109
109
|
}
|
package/src/device/blindtilt.ts
CHANGED
|
@@ -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
|
-
|
|
196
|
-
|
|
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
|
-
|
|
200
|
-
|
|
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
|
-
|
|
204
|
-
|
|
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
|
-
|
|
428
|
-
|
|
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
|
-
|
|
432
|
-
|
|
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
|
-
|
|
436
|
-
|
|
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
|
-
|
|
165
|
-
|
|
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
|
-
|
|
169
|
-
|
|
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
|
-
|
|
173
|
-
|
|
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/colorbulb.ts
CHANGED
|
@@ -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
|
-
|
|
161
|
-
|
|
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
|
-
|
|
165
|
-
|
|
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
|
-
|
|
169
|
-
|
|
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)
|
package/src/device/contact.ts
CHANGED
|
@@ -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
|
-
|
|
173
|
-
|
|
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
|
-
|
|
177
|
-
|
|
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
|
-
|
|
181
|
-
|
|
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)
|
package/src/device/curtain.ts
CHANGED
|
@@ -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
|
-
|
|
192
|
-
|
|
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
|
-
|
|
196
|
-
|
|
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
|
-
|
|
200
|
-
|
|
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
|
-
|
|
165
|
-
|
|
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
|
-
|
|
169
|
-
|
|
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
|
-
|
|
173
|
-
|
|
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
|
-
|
|
155
|
-
|
|
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
|
-
|
|
159
|
-
|
|
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
|
-
|
|
163
|
-
|
|
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)
|
package/src/device/humidifier.ts
CHANGED
|
@@ -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
|
-
|
|
155
|
-
|
|
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
|
-
|
|
159
|
-
|
|
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
|
-
|
|
163
|
-
|
|
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)
|
package/src/device/iosensor.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 { 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
|
-
|
|
159
|
-
|
|
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
|
-
|
|
163
|
-
|
|
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
|
-
|
|
167
|
-
|
|
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)
|
package/src/device/lightstrip.ts
CHANGED
|
@@ -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
|
-
|
|
165
|
-
|
|
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
|
-
|
|
169
|
-
|
|
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
|
-
|
|
173
|
-
|
|
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/lock.ts
CHANGED
|
@@ -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
|
-
|
|
169
|
-
|
|
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
|
-
|
|
173
|
-
|
|
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
|
-
|
|
177
|
-
|
|
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)
|
package/src/device/meter.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 { 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
|
-
|
|
152
|
-
|
|
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
|
-
|
|
156
|
-
|
|
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
|
-
|
|
160
|
-
|
|
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)
|