@switchbot/homebridge-switchbot 1.4.1-beta.2 → 1.4.1-beta.6
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 +13 -7
- package/config.schema.json +1 -1
- package/dist/devices/bots.d.ts +1 -1
- package/dist/devices/bots.d.ts.map +1 -1
- package/dist/devices/bots.js +32 -17
- package/dist/devices/bots.js.map +1 -1
- package/dist/devices/colorbulb.d.ts +1 -1
- package/dist/devices/colorbulb.d.ts.map +1 -1
- package/dist/devices/colorbulb.js +28 -8
- package/dist/devices/colorbulb.js.map +1 -1
- package/dist/devices/contact.d.ts +1 -1
- package/dist/devices/contact.d.ts.map +1 -1
- package/dist/devices/contact.js +30 -4
- package/dist/devices/contact.js.map +1 -1
- package/dist/devices/curtains.d.ts +1 -1
- package/dist/devices/curtains.d.ts.map +1 -1
- package/dist/devices/curtains.js +35 -7
- package/dist/devices/curtains.js.map +1 -1
- package/dist/devices/humidifiers.d.ts +1 -1
- package/dist/devices/humidifiers.d.ts.map +1 -1
- package/dist/devices/humidifiers.js +35 -9
- package/dist/devices/humidifiers.js.map +1 -1
- package/dist/devices/meters.d.ts +1 -1
- package/dist/devices/meters.d.ts.map +1 -1
- package/dist/devices/meters.js +27 -4
- package/dist/devices/meters.js.map +1 -1
- package/dist/devices/motion.d.ts +1 -1
- package/dist/devices/motion.d.ts.map +1 -1
- package/dist/devices/motion.js +25 -4
- package/dist/devices/motion.js.map +1 -1
- package/dist/devices/plugs.d.ts +1 -1
- package/dist/devices/plugs.d.ts.map +1 -1
- package/dist/devices/plugs.js +20 -4
- package/dist/devices/plugs.js.map +1 -1
- package/dist/irdevices/airconditioners.d.ts +30 -14
- package/dist/irdevices/airconditioners.d.ts.map +1 -1
- package/dist/irdevices/airconditioners.js +292 -152
- package/dist/irdevices/airconditioners.js.map +1 -1
- package/dist/irdevices/airpurifiers.d.ts +1 -1
- package/dist/irdevices/airpurifiers.d.ts.map +1 -1
- package/dist/irdevices/airpurifiers.js +7 -3
- package/dist/irdevices/airpurifiers.js.map +1 -1
- package/dist/irdevices/cameras.d.ts +1 -1
- package/dist/irdevices/cameras.d.ts.map +1 -1
- package/dist/irdevices/cameras.js +4 -3
- package/dist/irdevices/cameras.js.map +1 -1
- package/dist/irdevices/fans.d.ts +1 -1
- package/dist/irdevices/fans.d.ts.map +1 -1
- package/dist/irdevices/fans.js +6 -3
- package/dist/irdevices/fans.js.map +1 -1
- package/dist/irdevices/lights.d.ts +1 -1
- package/dist/irdevices/lights.d.ts.map +1 -1
- package/dist/irdevices/lights.js +4 -3
- package/dist/irdevices/lights.js.map +1 -1
- package/dist/irdevices/others.d.ts +1 -1
- package/dist/irdevices/others.d.ts.map +1 -1
- package/dist/irdevices/others.js +4 -3
- package/dist/irdevices/others.js.map +1 -1
- package/dist/irdevices/tvs.d.ts +1 -1
- package/dist/irdevices/tvs.d.ts.map +1 -1
- package/dist/irdevices/tvs.js +5 -3
- package/dist/irdevices/tvs.js.map +1 -1
- package/dist/irdevices/vacuumcleaners.d.ts +1 -1
- package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
- package/dist/irdevices/vacuumcleaners.js +4 -3
- package/dist/irdevices/vacuumcleaners.js.map +1 -1
- package/dist/irdevices/waterheaters.d.ts +1 -1
- package/dist/irdevices/waterheaters.d.ts.map +1 -1
- package/dist/irdevices/waterheaters.js +4 -3
- package/dist/irdevices/waterheaters.js.map +1 -1
- package/package.json +10 -6
- package/src/devices/bots.ts +32 -18
- package/src/devices/colorbulb.ts +29 -9
- package/src/devices/contact.ts +31 -5
- package/src/devices/curtains.ts +35 -7
- package/src/devices/humidifiers.ts +36 -10
- package/src/devices/meters.ts +28 -5
- package/src/devices/motion.ts +26 -5
- package/src/devices/plugs.ts +21 -5
- package/src/irdevices/airconditioners.ts +301 -160
- package/src/irdevices/airpurifiers.ts +8 -4
- package/src/irdevices/cameras.ts +5 -4
- package/src/irdevices/fans.ts +7 -4
- package/src/irdevices/lights.ts +5 -4
- package/src/irdevices/others.ts +4 -3
- package/src/irdevices/tvs.ts +6 -4
- package/src/irdevices/vacuumcleaners.ts +5 -4
- package/src/irdevices/waterheaters.ts +5 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waterheaters.js","sourceRoot":"","sources":["../../src/irdevices/waterheaters.ts"],"names":[],"mappings":";;;AAEA,0CAA4E;AAG5E;;;;GAIG;AACH,MAAa,WAAW;IAWtB,YACmB,QAA2B,EACpC,SAA4B,EAC7B,MAAkC;QAFxB,aAAQ,GAAR,QAAQ,CAAmB;QACpC,cAAS,GAAT,SAAS,CAAmB;QAC7B,WAAM,GAAN,MAAM,CAA4B;QAEzC,uBAAuB;QACvB,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE;YAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC;SAC5D;aAAM;YACL,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC;SAC7C;QAED,4BAA4B;QAC5B,SAAS;aACN,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,oBAAoB,CAAE;aACvD,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,YAAY,EAAE,WAAW,CAAC;aACzE,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC;aACxE,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,YAAY,EAAE,MAAM,CAAC,QAAS,CAAC,CAAC;QAElF,qFAAqF;QACrF,sDAAsD;QACtD,CAAC,IAAI,CAAC,OAAO;YACX,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC;gBAC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AI,CAAC,qBAAqB,EAAE,EAAE;YAChC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;SACxC;IACH,CAAC;IAED,QAAQ,CAAC,GAAG,GAAU;QACpB,IAAI,IAAI,CAAC,qBAAqB,EAAE,EAAE;YAChC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;SACzC;IACH,CAAC;IAED,QAAQ,CAAC,GAAG,GAAU;QACpB,IAAI,IAAI,CAAC,qBAAqB,EAAE,EAAE;YAChC,IAAI,IAAI,CAAC,aAAa,KAAK,OAAO,EAAE;gBAClC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;aACnD;iBAAM;gBACL,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;aACzC;SACF;IACH,CAAC;IAED,qBAAqB;QACnB,OAAO,IAAI,CAAC,aAAa,KAAK,OAAO,IAAI,IAAI,CAAC,aAAa,KAAK,UAAU,CAAC;IAC7E,CAAC;CACF;AA1ND,kCA0NC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "Homebridge SwitchBot",
|
|
3
3
|
"name": "@switchbot/homebridge-switchbot",
|
|
4
|
-
"version": "1.4.1-beta.
|
|
4
|
+
"version": "1.4.1-beta.6",
|
|
5
5
|
"description": "The [Homebridge](https://homebridge.io) SwitchBot plugin allows you to access your [SwitchBot](https://www.switch-bot.com) device(s) from HomeKit.",
|
|
6
6
|
"author": "SwitchBot <support@wondertechlabs.com> (https://github.com/SwitchBot)",
|
|
7
7
|
"license": "ISC",
|
|
@@ -28,7 +28,11 @@
|
|
|
28
28
|
"funding": [
|
|
29
29
|
{
|
|
30
30
|
"type": "Paypal",
|
|
31
|
-
"url": "https://
|
|
31
|
+
"url": "https://paypal.me/donavanbecker"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"type": "GitHub",
|
|
35
|
+
"url": "https://github.com/sponsors/donavanbecker"
|
|
32
36
|
}
|
|
33
37
|
],
|
|
34
38
|
"publishConfig": {
|
|
@@ -53,10 +57,10 @@
|
|
|
53
57
|
"rxjs": "^7.4.0"
|
|
54
58
|
},
|
|
55
59
|
"devDependencies": {
|
|
56
|
-
"@types/node": "^17.0.
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
58
|
-
"@typescript-eslint/parser": "^5.
|
|
59
|
-
"eslint": "^8.
|
|
60
|
+
"@types/node": "^17.0.4",
|
|
61
|
+
"@typescript-eslint/eslint-plugin": "^5.8.0",
|
|
62
|
+
"@typescript-eslint/parser": "^5.8.0",
|
|
63
|
+
"eslint": "^8.5.0",
|
|
60
64
|
"homebridge": "^1.3.8",
|
|
61
65
|
"nodemon": "^2.0.15",
|
|
62
66
|
"npm-check-updates": "^12.0.5",
|
package/src/devices/bots.ts
CHANGED
|
@@ -4,7 +4,7 @@ import Switchbot from 'node-switchbot';
|
|
|
4
4
|
import { interval, Subject } from 'rxjs';
|
|
5
5
|
import { SwitchBotPlatform } from '../platform';
|
|
6
6
|
import { debounceTime, skipWhile, take, tap } from 'rxjs/operators';
|
|
7
|
-
import { Service, PlatformAccessory, CharacteristicValue
|
|
7
|
+
import { Service, PlatformAccessory, CharacteristicValue } from 'homebridge';
|
|
8
8
|
import { DeviceURL, device, devicesConfig, serviceData, ad, switchbot, deviceStatusResponse, payload } from '../settings';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -170,18 +170,33 @@ export class Bot {
|
|
|
170
170
|
refreshRate() {
|
|
171
171
|
if (this.device.refreshRate) {
|
|
172
172
|
this.deviceRefreshRate = this.accessory.context.refreshRate = this.device.refreshRate;
|
|
173
|
+
if (this.platform.debugMode) {
|
|
174
|
+
this.warnLog(`Using Device Config refreshRate: ${this.deviceRefreshRate}`);
|
|
175
|
+
}
|
|
173
176
|
} else if (this.platform.config.options!.refreshRate) {
|
|
174
177
|
this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options!.refreshRate;
|
|
178
|
+
if (this.platform.debugMode) {
|
|
179
|
+
this.warnLog(`Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
|
|
180
|
+
}
|
|
175
181
|
}
|
|
176
182
|
}
|
|
177
183
|
|
|
178
184
|
logs() {
|
|
179
185
|
if (this.device.logging) {
|
|
180
186
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
187
|
+
if (this.platform.debugMode) {
|
|
188
|
+
this.warnLog(`Using Device Config Logging: ${this.deviceLogging}`);
|
|
189
|
+
}
|
|
181
190
|
} else if (this.platform.config.options?.logging) {
|
|
182
191
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
192
|
+
if (this.platform.debugMode) {
|
|
193
|
+
this.warnLog(`Using Platform Config Logging: ${this.deviceLogging}`);
|
|
194
|
+
}
|
|
183
195
|
} else {
|
|
184
196
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
197
|
+
if (this.platform.debugMode) {
|
|
198
|
+
this.warnLog('Using Device Standard Logging');
|
|
199
|
+
}
|
|
185
200
|
}
|
|
186
201
|
}
|
|
187
202
|
|
|
@@ -308,7 +323,7 @@ export class Bot {
|
|
|
308
323
|
this.warnLog(`Bot: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
309
324
|
await this.openAPIRefreshStatus();
|
|
310
325
|
}
|
|
311
|
-
this.apiError();
|
|
326
|
+
this.apiError(e);
|
|
312
327
|
});
|
|
313
328
|
}
|
|
314
329
|
|
|
@@ -318,16 +333,6 @@ export class Bot {
|
|
|
318
333
|
try {
|
|
319
334
|
this.deviceStatus = (await this.platform.axios.get(`${DeviceURL}/${this.device.deviceId}/status`)).data;
|
|
320
335
|
this.debugLog(`Bot: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(this.deviceStatus)}`);
|
|
321
|
-
/*this.deviceStatus = {
|
|
322
|
-
statusCode: 100,
|
|
323
|
-
body: {
|
|
324
|
-
deviceId: this.device.deviceId!,
|
|
325
|
-
deviceType: this.device.deviceType!,
|
|
326
|
-
hubDeviceId: this.device.hubDeviceId,
|
|
327
|
-
power: 'on',
|
|
328
|
-
},
|
|
329
|
-
message: 'success',
|
|
330
|
-
};*/
|
|
331
336
|
this.parseStatus();
|
|
332
337
|
this.updateHomeKitCharacteristics();
|
|
333
338
|
} catch (e: any) {
|
|
@@ -340,7 +345,7 @@ export class Bot {
|
|
|
340
345
|
this.errorLog(`Bot: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,`
|
|
341
346
|
+ ` Error: ${JSON.stringify(e)}`);
|
|
342
347
|
}
|
|
343
|
-
this.apiError();
|
|
348
|
+
this.apiError(e);
|
|
344
349
|
}
|
|
345
350
|
}
|
|
346
351
|
}
|
|
@@ -392,7 +397,7 @@ export class Bot {
|
|
|
392
397
|
this.warnLog(`Bot: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
393
398
|
await this.openAPIpushChanges();
|
|
394
399
|
}
|
|
395
|
-
this.apiError();
|
|
400
|
+
this.apiError(e);
|
|
396
401
|
});
|
|
397
402
|
} else if (this.device.bot?.mode === 'switch') {
|
|
398
403
|
this.debugLog(`Bot: ${this.accessory.displayName} Press Mode: ${this.device.bot?.mode}`);
|
|
@@ -415,7 +420,7 @@ export class Bot {
|
|
|
415
420
|
this.warnLog(`Bot: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
416
421
|
await this.openAPIpushChanges();
|
|
417
422
|
}
|
|
418
|
-
this.apiError();
|
|
423
|
+
this.apiError(e);
|
|
419
424
|
});
|
|
420
425
|
} else {
|
|
421
426
|
this.errorLog(`Bot: ${this.accessory.displayName} Mode Not Set, mode: ${this.device.bot?.mode}`);
|
|
@@ -479,7 +484,7 @@ export class Bot {
|
|
|
479
484
|
this.errorLog(`Bot: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
|
|
480
485
|
+ ` Error: ${JSON.stringify(e)}`);
|
|
481
486
|
}
|
|
482
|
-
this.apiError();
|
|
487
|
+
this.apiError(e);
|
|
483
488
|
}
|
|
484
489
|
}
|
|
485
490
|
}
|
|
@@ -514,8 +519,17 @@ export class Bot {
|
|
|
514
519
|
}
|
|
515
520
|
}
|
|
516
521
|
|
|
517
|
-
public apiError() {
|
|
518
|
-
|
|
522
|
+
public apiError(e: any) {
|
|
523
|
+
if (this.device.bot?.deviceType === 'switch') {
|
|
524
|
+
this.switchService?.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
525
|
+
} else {
|
|
526
|
+
this.outletService?.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
527
|
+
}
|
|
528
|
+
if (this.device.ble) {
|
|
529
|
+
this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, e);
|
|
530
|
+
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
|
|
531
|
+
}
|
|
532
|
+
//throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
|
|
519
533
|
}
|
|
520
534
|
|
|
521
535
|
private statusCode(push: AxiosResponse<{ statusCode: number; }>) {
|
package/src/devices/colorbulb.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { AxiosResponse } from 'axios';
|
|
|
2
2
|
import { interval, Subject } from 'rxjs';
|
|
3
3
|
import { SwitchBotPlatform } from '../platform';
|
|
4
4
|
import { debounceTime, skipWhile, tap } from 'rxjs/operators';
|
|
5
|
-
import { Service, PlatformAccessory, CharacteristicValue, ControllerConstructor, Controller, ControllerServiceMap
|
|
5
|
+
import { Service, PlatformAccessory, CharacteristicValue, ControllerConstructor, Controller, ControllerServiceMap } from 'homebridge';
|
|
6
6
|
import { DeviceURL, device, devicesConfig, switchbot, deviceStatusResponse, payload, hs2rgb, rgb2hs, m2hs } from '../settings';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -191,7 +191,7 @@ export class ColorBulb {
|
|
|
191
191
|
this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges,`
|
|
192
192
|
+ ` Error: ${JSON.stringify(e)}`);
|
|
193
193
|
}
|
|
194
|
-
this.apiError();
|
|
194
|
+
this.apiError(e);
|
|
195
195
|
}
|
|
196
196
|
this.colorBulbUpdateInProgress = false;
|
|
197
197
|
});
|
|
@@ -200,18 +200,33 @@ export class ColorBulb {
|
|
|
200
200
|
refreshRate() {
|
|
201
201
|
if (this.device.refreshRate) {
|
|
202
202
|
this.deviceRefreshRate = this.accessory.context.refreshRate = this.device.refreshRate;
|
|
203
|
+
if (this.platform.debugMode) {
|
|
204
|
+
this.warnLog(`Using Device Config refreshRate: ${this.deviceRefreshRate}`);
|
|
205
|
+
}
|
|
203
206
|
} else if (this.platform.config.options!.refreshRate) {
|
|
204
207
|
this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options!.refreshRate;
|
|
208
|
+
if (this.platform.debugMode) {
|
|
209
|
+
this.warnLog(`Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
|
|
210
|
+
}
|
|
205
211
|
}
|
|
206
212
|
}
|
|
207
213
|
|
|
208
214
|
logs() {
|
|
209
215
|
if (this.device.logging) {
|
|
210
216
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
217
|
+
if (this.platform.debugMode) {
|
|
218
|
+
this.warnLog(`Using Device Config Logging: ${this.deviceLogging}`);
|
|
219
|
+
}
|
|
211
220
|
} else if (this.platform.config.options?.logging) {
|
|
212
221
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
222
|
+
if (this.platform.debugMode) {
|
|
223
|
+
this.warnLog(`Using Platform Config Logging: ${this.deviceLogging}`);
|
|
224
|
+
}
|
|
213
225
|
} else {
|
|
214
226
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
227
|
+
if (this.platform.debugMode) {
|
|
228
|
+
this.warnLog('Using Device Standard Logging');
|
|
229
|
+
}
|
|
215
230
|
}
|
|
216
231
|
}
|
|
217
232
|
|
|
@@ -286,7 +301,7 @@ export class ColorBulb {
|
|
|
286
301
|
this.errorLog(`Color Bulb: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,`
|
|
287
302
|
+ ` Error: ${JSON.stringify(e)}`);
|
|
288
303
|
}
|
|
289
|
-
this.apiError();
|
|
304
|
+
this.apiError(e);
|
|
290
305
|
}
|
|
291
306
|
}
|
|
292
307
|
|
|
@@ -350,7 +365,7 @@ export class ColorBulb {
|
|
|
350
365
|
this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
|
|
351
366
|
+ ` Error: ${JSON.stringify(e)}`);
|
|
352
367
|
}
|
|
353
|
-
this.apiError();
|
|
368
|
+
this.apiError(e);
|
|
354
369
|
}
|
|
355
370
|
}
|
|
356
371
|
|
|
@@ -392,7 +407,7 @@ export class ColorBulb {
|
|
|
392
407
|
this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
|
|
393
408
|
+ ` Error: ${JSON.stringify(e)}`);
|
|
394
409
|
}
|
|
395
|
-
this.apiError();
|
|
410
|
+
this.apiError(e);
|
|
396
411
|
}
|
|
397
412
|
}
|
|
398
413
|
|
|
@@ -430,7 +445,7 @@ export class ColorBulb {
|
|
|
430
445
|
this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
|
|
431
446
|
+ ` Error: ${JSON.stringify(e)}`);
|
|
432
447
|
}
|
|
433
|
-
this.apiError();
|
|
448
|
+
this.apiError(e);
|
|
434
449
|
}
|
|
435
450
|
}
|
|
436
451
|
|
|
@@ -465,7 +480,7 @@ export class ColorBulb {
|
|
|
465
480
|
this.errorLog(`Color Bulb: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
|
|
466
481
|
+ ` Error: ${JSON.stringify(e)}`);
|
|
467
482
|
}
|
|
468
|
-
this.apiError();
|
|
483
|
+
this.apiError(e);
|
|
469
484
|
}
|
|
470
485
|
}
|
|
471
486
|
|
|
@@ -502,8 +517,13 @@ export class ColorBulb {
|
|
|
502
517
|
}
|
|
503
518
|
}
|
|
504
519
|
|
|
505
|
-
public apiError() {
|
|
506
|
-
|
|
520
|
+
public apiError(e: any) {
|
|
521
|
+
this.service.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
522
|
+
this.service.updateCharacteristic(this.platform.Characteristic.Hue, e);
|
|
523
|
+
this.service.updateCharacteristic(this.platform.Characteristic.Brightness, e);
|
|
524
|
+
this.service.updateCharacteristic(this.platform.Characteristic.Saturation, e);
|
|
525
|
+
this.service.updateCharacteristic(this.platform.Characteristic.ColorTemperature, e);
|
|
526
|
+
//throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
|
|
507
527
|
}
|
|
508
528
|
|
|
509
529
|
private statusCode(push: AxiosResponse<{ statusCode: number; }>) {
|
package/src/devices/contact.ts
CHANGED
|
@@ -2,7 +2,7 @@ import Switchbot from 'node-switchbot';
|
|
|
2
2
|
import { interval, Subject } from 'rxjs';
|
|
3
3
|
import { skipWhile } from 'rxjs/operators';
|
|
4
4
|
import { SwitchBotPlatform } from '../platform';
|
|
5
|
-
import { Service, PlatformAccessory, CharacteristicValue
|
|
5
|
+
import { Service, PlatformAccessory, CharacteristicValue } from 'homebridge';
|
|
6
6
|
import { DeviceURL, device, devicesConfig, serviceData, switchbot, deviceStatusResponse } from '../settings';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -146,18 +146,33 @@ export class Contact {
|
|
|
146
146
|
refreshRate() {
|
|
147
147
|
if (this.device.refreshRate) {
|
|
148
148
|
this.deviceRefreshRate = this.accessory.context.refreshRate = this.device.refreshRate;
|
|
149
|
+
if (this.platform.debugMode) {
|
|
150
|
+
this.warnLog(`Using Device Config refreshRate: ${this.deviceRefreshRate}`);
|
|
151
|
+
}
|
|
149
152
|
} else if (this.platform.config.options!.refreshRate) {
|
|
150
153
|
this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options!.refreshRate;
|
|
154
|
+
if (this.platform.debugMode) {
|
|
155
|
+
this.warnLog(`Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
|
|
156
|
+
}
|
|
151
157
|
}
|
|
152
158
|
}
|
|
153
159
|
|
|
154
160
|
logs() {
|
|
155
161
|
if (this.device.logging) {
|
|
156
162
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
163
|
+
if (this.platform.debugMode) {
|
|
164
|
+
this.warnLog(`Using Device Config Logging: ${this.deviceLogging}`);
|
|
165
|
+
}
|
|
157
166
|
} else if (this.platform.config.options?.logging) {
|
|
158
167
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
168
|
+
if (this.platform.debugMode) {
|
|
169
|
+
this.warnLog(`Using Platform Config Logging: ${this.deviceLogging}`);
|
|
170
|
+
}
|
|
159
171
|
} else {
|
|
160
172
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
173
|
+
if (this.platform.debugMode) {
|
|
174
|
+
this.warnLog('Using Device Standard Logging');
|
|
175
|
+
}
|
|
161
176
|
}
|
|
162
177
|
}
|
|
163
178
|
|
|
@@ -307,7 +322,7 @@ export class Contact {
|
|
|
307
322
|
this.warnLog(`Contact Sensor: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
308
323
|
await this.openAPIRefreshStatus();
|
|
309
324
|
}
|
|
310
|
-
this.apiError();
|
|
325
|
+
this.apiError(e);
|
|
311
326
|
});
|
|
312
327
|
}
|
|
313
328
|
|
|
@@ -329,7 +344,7 @@ export class Contact {
|
|
|
329
344
|
this.errorLog(`Contact Sensor: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,`
|
|
330
345
|
+ ` Error: ${JSON.stringify(e)}`);
|
|
331
346
|
}
|
|
332
|
-
this.apiError();
|
|
347
|
+
this.apiError(e);
|
|
333
348
|
}
|
|
334
349
|
}
|
|
335
350
|
}
|
|
@@ -377,8 +392,19 @@ export class Contact {
|
|
|
377
392
|
}
|
|
378
393
|
}
|
|
379
394
|
|
|
380
|
-
public apiError() {
|
|
381
|
-
|
|
395
|
+
public apiError(e: any) {
|
|
396
|
+
this.service.updateCharacteristic(this.platform.Characteristic.ContactSensorState, e);
|
|
397
|
+
if (!this.device.contact?.hide_motionsensor) {
|
|
398
|
+
this.motionService?.updateCharacteristic(this.platform.Characteristic.MotionDetected, e);
|
|
399
|
+
}
|
|
400
|
+
if (!this.device.contact?.hide_lightsensor) {
|
|
401
|
+
this.lightSensorService?.updateCharacteristic(this.platform.Characteristic.CurrentAmbientLightLevel, e);
|
|
402
|
+
}
|
|
403
|
+
if (this.device.ble) {
|
|
404
|
+
this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, e);
|
|
405
|
+
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
|
|
406
|
+
}
|
|
407
|
+
//throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
|
|
382
408
|
}
|
|
383
409
|
|
|
384
410
|
/**
|
package/src/devices/curtains.ts
CHANGED
|
@@ -186,7 +186,7 @@ export class Curtain {
|
|
|
186
186
|
this.errorLog(`Curtain: ${this.accessory.displayName} failed pushChanges,`
|
|
187
187
|
+ ` Error: ${JSON.stringify(e)}`);
|
|
188
188
|
}
|
|
189
|
-
this.apiError();
|
|
189
|
+
this.apiError(e);
|
|
190
190
|
}
|
|
191
191
|
this.curtainUpdateInProgress = false;
|
|
192
192
|
});
|
|
@@ -196,12 +196,21 @@ export class Curtain {
|
|
|
196
196
|
// refreshRate
|
|
197
197
|
if (this.device.refreshRate) {
|
|
198
198
|
this.deviceRefreshRate = this.accessory.context.refreshRate = this.device.refreshRate;
|
|
199
|
+
if (this.platform.debugMode) {
|
|
200
|
+
this.warnLog(`Using Device Config refreshRate: ${this.deviceRefreshRate}`);
|
|
201
|
+
}
|
|
199
202
|
} else if (this.platform.config.options!.refreshRate) {
|
|
200
203
|
this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options!.refreshRate;
|
|
204
|
+
if (this.platform.debugMode) {
|
|
205
|
+
this.warnLog(`Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
|
|
206
|
+
}
|
|
201
207
|
}
|
|
202
208
|
// curtainRefreshRate
|
|
203
209
|
if (this.device?.curtain?.refreshRate) {
|
|
204
210
|
this.curtainRefreshRate = this.device?.curtain?.refreshRate;
|
|
211
|
+
if (this.platform.debugMode) {
|
|
212
|
+
this.warnLog(`Using Device Config Curtain refreshRate: ${this.deviceRefreshRate}`);
|
|
213
|
+
}
|
|
205
214
|
} else {
|
|
206
215
|
this.curtainRefreshRate = 5;
|
|
207
216
|
if (this.deviceLogging === 'debug') {
|
|
@@ -213,10 +222,19 @@ export class Curtain {
|
|
|
213
222
|
logs() {
|
|
214
223
|
if (this.device.logging) {
|
|
215
224
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
225
|
+
if (this.platform.debugMode) {
|
|
226
|
+
this.warnLog(`Using Device Config Logging: ${this.deviceLogging}`);
|
|
227
|
+
}
|
|
216
228
|
} else if (this.platform.config.options?.logging) {
|
|
217
229
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
230
|
+
if (this.platform.debugMode) {
|
|
231
|
+
this.warnLog(`Using Platform Config Logging: ${this.deviceLogging}`);
|
|
232
|
+
}
|
|
218
233
|
} else {
|
|
219
234
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
235
|
+
if (this.platform.debugMode) {
|
|
236
|
+
this.warnLog('Using Device Standard Logging');
|
|
237
|
+
}
|
|
220
238
|
}
|
|
221
239
|
}
|
|
222
240
|
|
|
@@ -472,7 +490,7 @@ export class Curtain {
|
|
|
472
490
|
this.warnLog(`Curtain: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
473
491
|
await this.openAPIRefreshStatus();
|
|
474
492
|
}
|
|
475
|
-
this.apiError();
|
|
493
|
+
this.apiError(e);
|
|
476
494
|
});
|
|
477
495
|
}
|
|
478
496
|
|
|
@@ -494,7 +512,7 @@ export class Curtain {
|
|
|
494
512
|
this.errorLog(`Curtain: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,`
|
|
495
513
|
+ ` Error: ${JSON.stringify(e)}`);
|
|
496
514
|
}
|
|
497
|
-
this.apiError();
|
|
515
|
+
this.apiError(e);
|
|
498
516
|
}
|
|
499
517
|
}
|
|
500
518
|
}
|
|
@@ -536,7 +554,7 @@ export class Curtain {
|
|
|
536
554
|
this.warnLog(`Curtain: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
537
555
|
await this.OpenAPIpushChanges();
|
|
538
556
|
}
|
|
539
|
-
this.apiError();
|
|
557
|
+
this.apiError(e);
|
|
540
558
|
});
|
|
541
559
|
} else {
|
|
542
560
|
this.debugLog(`Curtain: ${this.accessory.displayName} No BLE Changes, CurrentPosition & TargetPosition Are the Same.`
|
|
@@ -578,7 +596,7 @@ export class Curtain {
|
|
|
578
596
|
this.errorLog(`Curtain: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
|
|
579
597
|
+ ` Error: ${JSON.stringify(e)}`);
|
|
580
598
|
}
|
|
581
|
-
this.apiError();
|
|
599
|
+
this.apiError(e);
|
|
582
600
|
}
|
|
583
601
|
}
|
|
584
602
|
}
|
|
@@ -627,8 +645,18 @@ export class Curtain {
|
|
|
627
645
|
}
|
|
628
646
|
}
|
|
629
647
|
|
|
630
|
-
public apiError() {
|
|
631
|
-
|
|
648
|
+
public apiError(e: any) {
|
|
649
|
+
this.service.updateCharacteristic(this.platform.Characteristic.CurrentPosition, e);
|
|
650
|
+
this.service.updateCharacteristic(this.platform.Characteristic.PositionState, e);
|
|
651
|
+
this.service.updateCharacteristic(this.platform.Characteristic.TargetPosition, e);
|
|
652
|
+
if (!this.device.curtain?.hide_lightsensor) {
|
|
653
|
+
this.lightSensorService?.updateCharacteristic(this.platform.Characteristic.CurrentAmbientLightLevel, e);
|
|
654
|
+
}
|
|
655
|
+
if (this.device.ble) {
|
|
656
|
+
this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, e);
|
|
657
|
+
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
|
|
658
|
+
}
|
|
659
|
+
//throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
|
|
632
660
|
}
|
|
633
661
|
|
|
634
662
|
private statusCode(push: AxiosResponse<{ statusCode: number; }>) {
|
|
@@ -3,7 +3,7 @@ import Switchbot from 'node-switchbot';
|
|
|
3
3
|
import { interval, Subject } from 'rxjs';
|
|
4
4
|
import { SwitchBotPlatform } from '../platform';
|
|
5
5
|
import { debounceTime, skipWhile, take, tap } from 'rxjs/operators';
|
|
6
|
-
import { Service, PlatformAccessory, CharacteristicValue
|
|
6
|
+
import { Service, PlatformAccessory, CharacteristicValue } from 'homebridge';
|
|
7
7
|
import { DeviceURL, device, devicesConfig, serviceData, ad, deviceStatusResponse, payload } from '../settings';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -184,7 +184,7 @@ export class Humidifier {
|
|
|
184
184
|
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges,`
|
|
185
185
|
+ ` Error: ${JSON.stringify(e)}`);
|
|
186
186
|
}
|
|
187
|
-
this.apiError();
|
|
187
|
+
this.apiError(e);
|
|
188
188
|
}
|
|
189
189
|
this.humidifierUpdateInProgress = false;
|
|
190
190
|
});
|
|
@@ -193,18 +193,33 @@ export class Humidifier {
|
|
|
193
193
|
refreshRate() {
|
|
194
194
|
if (this.device.refreshRate) {
|
|
195
195
|
this.deviceRefreshRate = this.accessory.context.refreshRate = this.device.refreshRate;
|
|
196
|
+
if (this.platform.debugMode) {
|
|
197
|
+
this.warnLog(`Using Device Config refreshRate: ${this.deviceRefreshRate}`);
|
|
198
|
+
}
|
|
196
199
|
} else if (this.platform.config.options!.refreshRate) {
|
|
197
200
|
this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options!.refreshRate;
|
|
201
|
+
if (this.platform.debugMode) {
|
|
202
|
+
this.warnLog(`Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
|
|
203
|
+
}
|
|
198
204
|
}
|
|
199
205
|
}
|
|
200
206
|
|
|
201
207
|
logs() {
|
|
202
208
|
if (this.device.logging) {
|
|
203
209
|
this.deviceLogging = this.accessory.context.logging = this.device.logging;
|
|
210
|
+
if (this.platform.debugMode) {
|
|
211
|
+
this.warnLog(`Using Device Config Logging: ${this.deviceLogging}`);
|
|
212
|
+
}
|
|
204
213
|
} else if (this.platform.config.options?.logging) {
|
|
205
214
|
this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
|
|
215
|
+
if (this.platform.debugMode) {
|
|
216
|
+
this.warnLog(`Using Platform Config Logging: ${this.deviceLogging}`);
|
|
217
|
+
}
|
|
206
218
|
} else {
|
|
207
219
|
this.deviceLogging = this.accessory.context.logging = 'standard';
|
|
220
|
+
if (this.platform.debugMode) {
|
|
221
|
+
this.warnLog('Using Device Standard Logging');
|
|
222
|
+
}
|
|
208
223
|
}
|
|
209
224
|
}
|
|
210
225
|
|
|
@@ -372,7 +387,7 @@ export class Humidifier {
|
|
|
372
387
|
this.warnLog(`Humidifier: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
373
388
|
await this.openAPIRefreshStatus();
|
|
374
389
|
}
|
|
375
|
-
this.apiError();
|
|
390
|
+
this.apiError(e);
|
|
376
391
|
});
|
|
377
392
|
}
|
|
378
393
|
|
|
@@ -398,7 +413,7 @@ export class Humidifier {
|
|
|
398
413
|
this.errorLog(`Humidifier: ${this.accessory.displayName} failed refreshStatus with OpenAPI Connection,`
|
|
399
414
|
+ ` Error: ${JSON.stringify(e)}`);
|
|
400
415
|
}
|
|
401
|
-
this.apiError();
|
|
416
|
+
this.apiError(e);
|
|
402
417
|
}
|
|
403
418
|
}
|
|
404
419
|
}
|
|
@@ -442,7 +457,7 @@ export class Humidifier {
|
|
|
442
457
|
this.warnLog(`Humidifier: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
443
458
|
await this.OpenAPIpushChanges();
|
|
444
459
|
}
|
|
445
|
-
this.apiError();
|
|
460
|
+
this.apiError(e);
|
|
446
461
|
});
|
|
447
462
|
}
|
|
448
463
|
|
|
@@ -479,7 +494,7 @@ export class Humidifier {
|
|
|
479
494
|
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,`
|
|
480
495
|
+ ` Error: ${JSON.stringify(e)}`);
|
|
481
496
|
}
|
|
482
|
-
this.apiError();
|
|
497
|
+
this.apiError(e);
|
|
483
498
|
}
|
|
484
499
|
} else if (
|
|
485
500
|
this.TargetHumidifierDehumidifierState ===
|
|
@@ -528,7 +543,7 @@ export class Humidifier {
|
|
|
528
543
|
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushAutoChanges with OpenAPI Connection,`
|
|
529
544
|
+ ` Error: ${JSON.stringify(e)}`);
|
|
530
545
|
}
|
|
531
|
-
this.apiError();
|
|
546
|
+
this.apiError(e);
|
|
532
547
|
}
|
|
533
548
|
}
|
|
534
549
|
|
|
@@ -563,7 +578,7 @@ export class Humidifier {
|
|
|
563
578
|
this.errorLog(`Humidifier: ${this.accessory.displayName} failed pushActiveChanges with OpenAPI Connection,`
|
|
564
579
|
+ ` Error: ${JSON.stringify(e)}`);
|
|
565
580
|
}
|
|
566
|
-
this.apiError();
|
|
581
|
+
this.apiError(e);
|
|
567
582
|
}
|
|
568
583
|
}
|
|
569
584
|
|
|
@@ -624,8 +639,19 @@ export class Humidifier {
|
|
|
624
639
|
}
|
|
625
640
|
}
|
|
626
641
|
|
|
627
|
-
public apiError() {
|
|
628
|
-
|
|
642
|
+
public apiError(e: any) {
|
|
643
|
+
this.service.updateCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity, e);
|
|
644
|
+
if (!this.device.ble) {
|
|
645
|
+
this.service.updateCharacteristic(this.platform.Characteristic.WaterLevel, e);
|
|
646
|
+
}
|
|
647
|
+
this.service.updateCharacteristic(this.platform.Characteristic.CurrentHumidifierDehumidifierState, e);
|
|
648
|
+
this.service.updateCharacteristic(this.platform.Characteristic.TargetHumidifierDehumidifierState, e);
|
|
649
|
+
this.service.updateCharacteristic(this.platform.Characteristic.Active, e);
|
|
650
|
+
this.service.updateCharacteristic(this.platform.Characteristic.RelativeHumidityHumidifierThreshold, e);
|
|
651
|
+
if (!this.device.humidifier?.hide_temperature && !this.device.ble) {
|
|
652
|
+
this.temperatureservice?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, e);
|
|
653
|
+
}
|
|
654
|
+
//throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
|
|
629
655
|
}
|
|
630
656
|
|
|
631
657
|
private statusCode(push: AxiosResponse<{ statusCode: number; }>) {
|