@switchbot/homebridge-switchbot 3.5.1-beta.8 → 3.5.1
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 +7 -0
- package/config.schema.json +19 -3
- package/dist/device/blindtilt.d.ts +6 -4
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +60 -46
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +6 -3
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +59 -25
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +6 -3
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +47 -29
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +6 -3
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +53 -36
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +6 -3
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +45 -31
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +6 -4
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +41 -27
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts +6 -3
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +59 -152
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.d.ts +6 -3
- package/dist/device/fan.d.ts.map +1 -1
- package/dist/device/fan.js +53 -32
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.d.ts +6 -3
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +49 -30
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +6 -3
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +47 -28
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +6 -3
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +44 -27
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +6 -3
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +46 -28
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +6 -3
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +38 -25
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +6 -3
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +43 -27
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +6 -3
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +42 -27
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +6 -3
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +37 -24
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +6 -3
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +30 -17
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +6 -3
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +37 -22
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts +6 -3
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +44 -25
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/homebridge-ui/public/index.html +2 -2
- package/dist/irdevice/airconditioner.d.ts +1 -3
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +67 -177
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +0 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +24 -53
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +12 -17
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +22 -38
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/irdevice.d.ts +22 -10
- package/dist/irdevice/irdevice.d.ts.map +1 -1
- package/dist/irdevice/irdevice.js +94 -100
- package/dist/irdevice/irdevice.js.map +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +20 -38
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +79 -77
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +38 -53
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +11 -16
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +11 -16
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts +4 -6
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +564 -665
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +10 -8
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/dist/types/bledevicestatus.d.ts +2 -1
- package/dist/types/bledevicestatus.d.ts.map +1 -1
- package/dist/types/devicestatus.d.ts +1 -1
- package/dist/types/devicestatus.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/device/blindtilt.ts +64 -48
- package/src/device/bot.ts +79 -26
- package/src/device/ceilinglight.ts +57 -31
- package/src/device/colorbulb.ts +57 -43
- package/src/device/contact.ts +49 -31
- package/src/device/curtain.ts +51 -28
- package/src/device/device.ts +61 -135
- package/src/device/fan.ts +67 -33
- package/src/device/hub.ts +62 -33
- package/src/device/humidifier.ts +60 -33
- package/src/device/iosensor.ts +51 -30
- package/src/device/lightstrip.ts +52 -29
- package/src/device/lock.ts +55 -26
- package/src/device/meter.ts +60 -29
- package/src/device/meterplus.ts +56 -29
- package/src/device/motion.ts +50 -26
- package/src/device/plug.ts +38 -18
- package/src/device/robotvacuumcleaner.ts +53 -24
- package/src/device/waterdetector.ts +63 -27
- package/src/homebridge-ui/public/index.html +2 -2
- package/src/irdevice/airconditioner.ts +76 -165
- package/src/irdevice/airpurifier.ts +29 -49
- package/src/irdevice/camera.ts +13 -16
- package/src/irdevice/fan.ts +25 -35
- package/src/irdevice/irdevice.ts +97 -96
- package/src/irdevice/light.ts +21 -35
- package/src/irdevice/other.ts +79 -77
- package/src/irdevice/tv.ts +40 -51
- package/src/irdevice/vacuumcleaner.ts +12 -15
- package/src/irdevice/waterheater.ts +12 -15
- package/src/platform.ts +566 -696
- package/src/settings.ts +11 -8
- package/src/types/bledevicestatus.ts +4 -2
- package/src/types/devicestatus.ts +1 -1
- package/.github/npm-version-script.cjs +0 -81
package/dist/irdevice/other.js
CHANGED
|
@@ -26,6 +26,8 @@ export class Others extends irdeviceBase {
|
|
|
26
26
|
constructor(platform, accessory, device) {
|
|
27
27
|
super(platform, accessory, device);
|
|
28
28
|
this.platform = platform;
|
|
29
|
+
// Set category
|
|
30
|
+
accessory.category = 1 /* this.hap.Categories.OTHER */;
|
|
29
31
|
// default placeholders
|
|
30
32
|
this.getOtherConfigSettings(device);
|
|
31
33
|
// deviceType
|
|
@@ -38,7 +40,7 @@ export class Others extends irdeviceBase {
|
|
|
38
40
|
On: accessory.context.On ?? false,
|
|
39
41
|
};
|
|
40
42
|
accessory.context.Switch = this.Switch;
|
|
41
|
-
this.debugWarnLog(
|
|
43
|
+
this.debugWarnLog('Displaying as Switch');
|
|
42
44
|
this.Switch.Service
|
|
43
45
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
44
46
|
.getCharacteristic(this.hap.Characteristic.On)
|
|
@@ -66,7 +68,7 @@ export class Others extends irdeviceBase {
|
|
|
66
68
|
On: accessory.context.On ?? false,
|
|
67
69
|
};
|
|
68
70
|
accessory.context.GarageDoor = this.GarageDoor;
|
|
69
|
-
this.debugWarnLog(
|
|
71
|
+
this.debugWarnLog('Displaying as Garage Door Opener');
|
|
70
72
|
this.GarageDoor.Service
|
|
71
73
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
72
74
|
.setCharacteristic(this.hap.Characteristic.ObstructionDetected, false)
|
|
@@ -95,7 +97,7 @@ export class Others extends irdeviceBase {
|
|
|
95
97
|
On: accessory.context.On ?? false,
|
|
96
98
|
};
|
|
97
99
|
accessory.context.Door = this.Door;
|
|
98
|
-
this.debugWarnLog(
|
|
100
|
+
this.debugWarnLog('Displaying as Door');
|
|
99
101
|
this.Door.Service
|
|
100
102
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
101
103
|
.setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
|
|
@@ -130,7 +132,7 @@ export class Others extends irdeviceBase {
|
|
|
130
132
|
On: accessory.context.On ?? false,
|
|
131
133
|
};
|
|
132
134
|
accessory.context.Window = this.Window;
|
|
133
|
-
this.debugWarnLog(
|
|
135
|
+
this.debugWarnLog('Displaying as Window');
|
|
134
136
|
this.Window.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
135
137
|
.setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
|
|
136
138
|
.getCharacteristic(this.hap.Characteristic.TargetPosition)
|
|
@@ -164,7 +166,7 @@ export class Others extends irdeviceBase {
|
|
|
164
166
|
On: accessory.context.On ?? false,
|
|
165
167
|
};
|
|
166
168
|
accessory.context.WindowCovering = this.WindowCovering;
|
|
167
|
-
this.debugWarnLog(
|
|
169
|
+
this.debugWarnLog('Displaying as Window Covering');
|
|
168
170
|
this.WindowCovering.Service
|
|
169
171
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
170
172
|
.setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
|
|
@@ -199,7 +201,7 @@ export class Others extends irdeviceBase {
|
|
|
199
201
|
On: accessory.context.On ?? false,
|
|
200
202
|
};
|
|
201
203
|
accessory.context.LockMechanism = this.LockMechanism;
|
|
202
|
-
this.debugWarnLog(
|
|
204
|
+
this.debugWarnLog('Displaying as Lock');
|
|
203
205
|
this.LockMechanism.Service
|
|
204
206
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
205
207
|
.getCharacteristic(this.hap.Characteristic.LockTargetState)
|
|
@@ -227,7 +229,7 @@ export class Others extends irdeviceBase {
|
|
|
227
229
|
On: accessory.context.On ?? false,
|
|
228
230
|
};
|
|
229
231
|
accessory.context.Faucet = this.Faucet;
|
|
230
|
-
this.debugWarnLog(
|
|
232
|
+
this.debugWarnLog('Displaying as Faucet');
|
|
231
233
|
this.Faucet.Service
|
|
232
234
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
233
235
|
.getCharacteristic(this.hap.Characteristic.Active)
|
|
@@ -255,7 +257,7 @@ export class Others extends irdeviceBase {
|
|
|
255
257
|
On: accessory.context.On ?? false,
|
|
256
258
|
};
|
|
257
259
|
accessory.context.Fan = this.Fan;
|
|
258
|
-
this.debugWarnLog(
|
|
260
|
+
this.debugWarnLog('Displaying as Fan');
|
|
259
261
|
this.Fan.Service
|
|
260
262
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
261
263
|
.getCharacteristic(this.hap.Characteristic.On)
|
|
@@ -284,7 +286,7 @@ export class Others extends irdeviceBase {
|
|
|
284
286
|
On: accessory.context.On ?? false,
|
|
285
287
|
};
|
|
286
288
|
accessory.context.StatefulProgrammableSwitch = this.StatefulProgrammableSwitch;
|
|
287
|
-
this.debugWarnLog(
|
|
289
|
+
this.debugWarnLog('Displaying as Stateful Programmable Switch');
|
|
288
290
|
this.StatefulProgrammableSwitch.Service
|
|
289
291
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
290
292
|
.getCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState)
|
|
@@ -312,7 +314,7 @@ export class Others extends irdeviceBase {
|
|
|
312
314
|
On: accessory.context.On ?? false,
|
|
313
315
|
};
|
|
314
316
|
accessory.context.Outlet = this.Outlet;
|
|
315
|
-
this.debugWarnLog(
|
|
317
|
+
this.debugWarnLog('Displaying as Outlet');
|
|
316
318
|
this.Outlet.Service
|
|
317
319
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
318
320
|
.getCharacteristic(this.hap.Characteristic.On)
|
|
@@ -338,7 +340,7 @@ export class Others extends irdeviceBase {
|
|
|
338
340
|
async OnSet(value) {
|
|
339
341
|
let On;
|
|
340
342
|
if (this.otherDeviceType === 'garagedoor') {
|
|
341
|
-
this.infoLog(
|
|
343
|
+
this.infoLog(`Set TargetDoorState: ${value}`);
|
|
342
344
|
if (value === this.hap.Characteristic.TargetDoorState.CLOSED) {
|
|
343
345
|
this.GarageDoor.On = false;
|
|
344
346
|
}
|
|
@@ -348,7 +350,7 @@ export class Others extends irdeviceBase {
|
|
|
348
350
|
On = this.GarageDoor.On;
|
|
349
351
|
}
|
|
350
352
|
else if (this.otherDeviceType === 'door') {
|
|
351
|
-
this.infoLog(
|
|
353
|
+
this.infoLog(`Set TargetPosition: ${value}`);
|
|
352
354
|
if (value === 0) {
|
|
353
355
|
this.Door.On = false;
|
|
354
356
|
}
|
|
@@ -358,7 +360,7 @@ export class Others extends irdeviceBase {
|
|
|
358
360
|
On = this.Door.On;
|
|
359
361
|
}
|
|
360
362
|
else if (this.otherDeviceType === 'window') {
|
|
361
|
-
this.infoLog(
|
|
363
|
+
this.infoLog(`Set TargetPosition: ${value}`);
|
|
362
364
|
if (value === 0) {
|
|
363
365
|
this.Window.On = false;
|
|
364
366
|
}
|
|
@@ -368,7 +370,7 @@ export class Others extends irdeviceBase {
|
|
|
368
370
|
On = this.Window.On;
|
|
369
371
|
}
|
|
370
372
|
else if (this.otherDeviceType === 'windowcovering') {
|
|
371
|
-
this.infoLog(
|
|
373
|
+
this.infoLog(`Set TargetPosition: ${value}`);
|
|
372
374
|
if (value === 0) {
|
|
373
375
|
this.WindowCovering.On = false;
|
|
374
376
|
}
|
|
@@ -378,7 +380,7 @@ export class Others extends irdeviceBase {
|
|
|
378
380
|
On = this.WindowCovering.On;
|
|
379
381
|
}
|
|
380
382
|
else if (this.otherDeviceType === 'lock') {
|
|
381
|
-
this.infoLog(
|
|
383
|
+
this.infoLog(`Set LockTargetState: ${value}`);
|
|
382
384
|
if (value === this.hap.Characteristic.LockTargetState.SECURED) {
|
|
383
385
|
this.LockMechanism.On = false;
|
|
384
386
|
}
|
|
@@ -388,7 +390,7 @@ export class Others extends irdeviceBase {
|
|
|
388
390
|
On = this.LockMechanism.On;
|
|
389
391
|
}
|
|
390
392
|
else if (this.otherDeviceType === 'faucet') {
|
|
391
|
-
this.infoLog(
|
|
393
|
+
this.infoLog(`Set Active: ${value}`);
|
|
392
394
|
if (value === this.hap.Characteristic.Active.INACTIVE) {
|
|
393
395
|
this.Faucet.On = false;
|
|
394
396
|
}
|
|
@@ -398,7 +400,7 @@ export class Others extends irdeviceBase {
|
|
|
398
400
|
On = this.Faucet.On;
|
|
399
401
|
}
|
|
400
402
|
else if (this.otherDeviceType === 'stateful') {
|
|
401
|
-
this.infoLog(
|
|
403
|
+
this.infoLog(`Set ProgrammableSwitchOutputState: ${value}`);
|
|
402
404
|
if (value === 0) {
|
|
403
405
|
this.StatefulProgrammableSwitch.On = false;
|
|
404
406
|
}
|
|
@@ -408,7 +410,7 @@ export class Others extends irdeviceBase {
|
|
|
408
410
|
On = this.StatefulProgrammableSwitch.On;
|
|
409
411
|
}
|
|
410
412
|
else {
|
|
411
|
-
this.infoLog(
|
|
413
|
+
this.infoLog(`Set On: ${value}`);
|
|
412
414
|
this.Outlet.On = value;
|
|
413
415
|
On = this.Outlet.On ? true : false;
|
|
414
416
|
}
|
|
@@ -431,7 +433,7 @@ export class Others extends irdeviceBase {
|
|
|
431
433
|
* Other - "command" "channelSub" "default" = previous channel
|
|
432
434
|
*/
|
|
433
435
|
async pushOnChanges(On) {
|
|
434
|
-
this.debugLog(
|
|
436
|
+
await this.debugLog(`pushOnChanges On: ${On},`
|
|
435
437
|
+ ` disablePushOn: ${this.disablePushOn}, customize: ${this.device.customize}, customOn: ${this.device.customOn}`);
|
|
436
438
|
if (this.device.customize) {
|
|
437
439
|
if (On === true && !this.disablePushOn) {
|
|
@@ -446,11 +448,11 @@ export class Others extends irdeviceBase {
|
|
|
446
448
|
}
|
|
447
449
|
}
|
|
448
450
|
else {
|
|
449
|
-
this.errorLog(
|
|
451
|
+
this.errorLog('On Command not set');
|
|
450
452
|
}
|
|
451
453
|
}
|
|
452
454
|
async pushOffChanges(On) {
|
|
453
|
-
this.debugLog(
|
|
455
|
+
await this.debugLog(`pushOffChanges On: ${On},`
|
|
454
456
|
+ ` disablePushOff: ${this.disablePushOff}, customize: ${this.device.customize}, customOff: ${this.device.customOff}`);
|
|
455
457
|
if (this.device.customize) {
|
|
456
458
|
if (On === false && !this.disablePushOff) {
|
|
@@ -465,18 +467,18 @@ export class Others extends irdeviceBase {
|
|
|
465
467
|
}
|
|
466
468
|
}
|
|
467
469
|
else {
|
|
468
|
-
this.errorLog(
|
|
470
|
+
this.errorLog('Off Command not set.');
|
|
469
471
|
}
|
|
470
472
|
}
|
|
471
473
|
async pushChanges(bodyChange) {
|
|
472
|
-
this.debugLog(
|
|
474
|
+
await this.debugLog('pushChanges');
|
|
473
475
|
if (this.device.connectionType === 'OpenAPI') {
|
|
474
|
-
this.infoLog(
|
|
476
|
+
this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
475
477
|
try {
|
|
476
478
|
const { body, statusCode } = await this.pushChangeRequest(bodyChange);
|
|
477
479
|
const deviceStatus = await body.json();
|
|
478
480
|
await this.pushStatusCodes(statusCode, deviceStatus);
|
|
479
|
-
if (
|
|
481
|
+
if (await this.successfulStatusCodes(statusCode, deviceStatus)) {
|
|
480
482
|
await this.successfulPushChange(statusCode, deviceStatus, bodyChange);
|
|
481
483
|
await this.updateHomeKitCharacteristics();
|
|
482
484
|
}
|
|
@@ -491,185 +493,185 @@ export class Others extends irdeviceBase {
|
|
|
491
493
|
}
|
|
492
494
|
}
|
|
493
495
|
else {
|
|
494
|
-
this.warnLog(
|
|
495
|
-
+ ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
496
|
+
await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
496
497
|
}
|
|
497
498
|
}
|
|
498
499
|
async updateHomeKitCharacteristics() {
|
|
500
|
+
await this.debugLog('updateHomeKitCharacteristics');
|
|
499
501
|
if (this.otherDeviceType === 'garagedoor') {
|
|
500
502
|
if (this.GarageDoor.On === undefined) {
|
|
501
|
-
this.debugLog(
|
|
503
|
+
await this.debugLog(`On: ${this.GarageDoor.On}`);
|
|
502
504
|
}
|
|
503
505
|
else {
|
|
504
506
|
if (this.GarageDoor.On) {
|
|
505
507
|
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, this.hap.Characteristic.TargetDoorState.OPEN);
|
|
506
508
|
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, this.hap.Characteristic.CurrentDoorState.OPEN);
|
|
507
|
-
this.debugLog(
|
|
509
|
+
await this.debugLog('updateCharacteristic'
|
|
508
510
|
+ ` TargetDoorState: Open, CurrentDoorState: Open (${this.GarageDoor.On})`);
|
|
509
511
|
}
|
|
510
512
|
else {
|
|
511
513
|
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, this.hap.Characteristic.TargetDoorState.CLOSED);
|
|
512
514
|
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, this.hap.Characteristic.CurrentDoorState.CLOSED);
|
|
513
|
-
this.debugLog(
|
|
515
|
+
await this.debugLog('updateCharacteristic'
|
|
514
516
|
+ ` TargetDoorState: Closed, CurrentDoorState: Closed (${this.GarageDoor.On})`);
|
|
515
517
|
}
|
|
516
518
|
}
|
|
517
|
-
this.debugLog(
|
|
519
|
+
await this.debugLog(`Garage Door On: ${this.GarageDoor.On}`);
|
|
518
520
|
}
|
|
519
521
|
else if (this.otherDeviceType === 'door') {
|
|
520
522
|
if (this.Door.On === undefined) {
|
|
521
|
-
this.debugLog(
|
|
523
|
+
await this.debugLog(`On: ${this.Door.On}`);
|
|
522
524
|
}
|
|
523
525
|
else {
|
|
524
526
|
if (this.Door.On) {
|
|
525
527
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
|
|
526
528
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
|
|
527
529
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
528
|
-
this.debugLog(
|
|
530
|
+
await this.debugLog('updateCharacteristic'
|
|
529
531
|
+ ` TargetPosition: 100, CurrentPosition: 100 (${this.Door.On})`);
|
|
530
532
|
}
|
|
531
533
|
else {
|
|
532
534
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
|
|
533
535
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
|
|
534
536
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
535
|
-
this.debugLog(
|
|
537
|
+
await this.debugLog('updateCharacteristic'
|
|
536
538
|
+ ` TargetPosition: 0, CurrentPosition: 0 (${this.Door.On})`);
|
|
537
539
|
}
|
|
538
540
|
}
|
|
539
|
-
this.debugLog(
|
|
541
|
+
await this.debugLog(`Door On: ${this.Door.On}`);
|
|
540
542
|
}
|
|
541
543
|
else if (this.otherDeviceType === 'window') {
|
|
542
544
|
if (this.Window.On === undefined) {
|
|
543
|
-
this.debugLog(
|
|
545
|
+
await this.debugLog(`On: ${this.Window.On}`);
|
|
544
546
|
}
|
|
545
547
|
else {
|
|
546
548
|
if (this.Window.On) {
|
|
547
549
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
|
|
548
550
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
|
|
549
551
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
550
|
-
this.debugLog(
|
|
552
|
+
await this.debugLog('updateCharacteristic'
|
|
551
553
|
+ ` TargetPosition: 100, CurrentPosition: 100 (${this.Window.On})`);
|
|
552
554
|
}
|
|
553
555
|
else {
|
|
554
556
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
|
|
555
557
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
|
|
556
558
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
557
|
-
this.debugLog(
|
|
559
|
+
await this.debugLog('updateCharacteristic'
|
|
558
560
|
+ ` TargetPosition: 0, CurrentPosition: 0 (${this.Window.On})`);
|
|
559
561
|
}
|
|
560
562
|
}
|
|
561
|
-
this.debugLog(
|
|
563
|
+
await this.debugLog(`Window On: ${this.Window.On}`);
|
|
562
564
|
}
|
|
563
565
|
else if (this.otherDeviceType === 'windowcovering') {
|
|
564
566
|
if (this.WindowCovering.On === undefined) {
|
|
565
|
-
this.debugLog(
|
|
567
|
+
await this.debugLog(`On: ${this.WindowCovering.On}`);
|
|
566
568
|
}
|
|
567
569
|
else {
|
|
568
570
|
if (this.WindowCovering.On) {
|
|
569
571
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
|
|
570
572
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
|
|
571
573
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
572
|
-
this.debugLog(
|
|
574
|
+
await this.debugLog('updateCharacteristic'
|
|
573
575
|
+ ` TargetPosition: 100, CurrentPosition: 100 (${this.WindowCovering.On})`);
|
|
574
576
|
}
|
|
575
577
|
else {
|
|
576
578
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
|
|
577
579
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
|
|
578
580
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
579
|
-
this.debugLog(
|
|
581
|
+
await this.debugLog('updateCharacteristic'
|
|
580
582
|
+ ` TargetPosition: 0, CurrentPosition: 0 (${this.WindowCovering.On})`);
|
|
581
583
|
}
|
|
582
584
|
}
|
|
583
|
-
this.debugLog(
|
|
585
|
+
await this.debugLog(`Window Covering On: ${this.WindowCovering.On}`);
|
|
584
586
|
}
|
|
585
587
|
else if (this.otherDeviceType === 'lock') {
|
|
586
588
|
if (this.LockMechanism?.On === undefined) {
|
|
587
|
-
this.debugLog(
|
|
589
|
+
await this.debugLog(`On: ${this.LockMechanism?.On}`);
|
|
588
590
|
}
|
|
589
591
|
else {
|
|
590
592
|
if (this.LockMechanism.On) {
|
|
591
593
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState, this.hap.Characteristic.LockTargetState.UNSECURED);
|
|
592
594
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState, this.hap.Characteristic.LockCurrentState.UNSECURED);
|
|
593
|
-
this.debugLog(
|
|
595
|
+
await this.debugLog('updateCharacteristic'
|
|
594
596
|
+ ` LockTargetState: UNSECURED, LockCurrentState: UNSECURE (${this.LockMechanism.On})`);
|
|
595
597
|
}
|
|
596
598
|
else {
|
|
597
599
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState, this.hap.Characteristic.LockTargetState.SECURED);
|
|
598
600
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState, this.hap.Characteristic.LockCurrentState.SECURED);
|
|
599
|
-
this.debugLog(
|
|
601
|
+
await this.debugLog('updateCharacteristic'
|
|
600
602
|
+ ` LockTargetState: SECURED, LockCurrentState: SECURED (${this.LockMechanism.On})`);
|
|
601
603
|
}
|
|
602
604
|
}
|
|
603
|
-
this.debugLog(
|
|
605
|
+
await this.debugLog(`Lock On: ${this.LockMechanism?.On}`);
|
|
604
606
|
}
|
|
605
607
|
else if (this.otherDeviceType === 'faucet') {
|
|
606
608
|
if (this.Faucet.On === undefined) {
|
|
607
|
-
this.debugLog(
|
|
609
|
+
await this.debugLog(`On: ${this.Faucet.On}`);
|
|
608
610
|
}
|
|
609
611
|
else {
|
|
610
612
|
if (this.Faucet.On) {
|
|
611
613
|
this.Faucet.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.ACTIVE);
|
|
612
|
-
this.debugLog(
|
|
614
|
+
await this.debugLog(`updateCharacteristic Active: ${this.Faucet.On}`);
|
|
613
615
|
}
|
|
614
616
|
else {
|
|
615
617
|
this.Faucet.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.INACTIVE);
|
|
616
|
-
this.debugLog(
|
|
618
|
+
await this.debugLog(`updateCharacteristic Active: ${this.Faucet.On}`);
|
|
617
619
|
}
|
|
618
620
|
}
|
|
619
|
-
this.debugLog(
|
|
621
|
+
await this.debugLog(`Faucet On: ${this.Faucet.On}`);
|
|
620
622
|
}
|
|
621
623
|
else if (this.otherDeviceType === 'fan') {
|
|
622
624
|
if (this.Fan.On === undefined) {
|
|
623
|
-
this.debugLog(
|
|
625
|
+
await this.debugLog(`On: ${this.Fan.On}`);
|
|
624
626
|
}
|
|
625
627
|
else {
|
|
626
628
|
if (this.Fan.On) {
|
|
627
629
|
this.Fan.Service.updateCharacteristic(this.hap.Characteristic.On, this.Fan.On);
|
|
628
|
-
this.debugLog(
|
|
630
|
+
await this.debugLog(`updateCharacteristic On: ${this.Fan.On}`);
|
|
629
631
|
}
|
|
630
632
|
else {
|
|
631
633
|
this.Fan.Service.updateCharacteristic(this.hap.Characteristic.On, this.Fan.On);
|
|
632
|
-
this.debugLog(
|
|
634
|
+
await this.debugLog(`updateCharacteristic On: ${this.Fan.On}`);
|
|
633
635
|
}
|
|
634
636
|
}
|
|
635
|
-
this.debugLog(
|
|
637
|
+
await this.debugLog(`Fan On: ${this.Fan.On}`);
|
|
636
638
|
}
|
|
637
639
|
else if (this.otherDeviceType === 'stateful') {
|
|
638
640
|
if (this.StatefulProgrammableSwitch.On === undefined) {
|
|
639
|
-
this.debugLog(
|
|
641
|
+
await this.debugLog(`On: ${this.StatefulProgrammableSwitch.On}`);
|
|
640
642
|
}
|
|
641
643
|
else {
|
|
642
644
|
if (this.StatefulProgrammableSwitch.On) {
|
|
643
645
|
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent, this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);
|
|
644
646
|
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, 1);
|
|
645
|
-
this.debugLog(
|
|
647
|
+
await this.debugLog('updateCharacteristic'
|
|
646
648
|
+ ` ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 1 (${this.StatefulProgrammableSwitch.On})`);
|
|
647
649
|
}
|
|
648
650
|
else {
|
|
649
651
|
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent, this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);
|
|
650
652
|
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, 0);
|
|
651
|
-
this.debugLog(
|
|
653
|
+
await this.debugLog('updateCharacteristic'
|
|
652
654
|
+ ` ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 0 (${this.StatefulProgrammableSwitch.On})`);
|
|
653
655
|
}
|
|
654
656
|
}
|
|
655
|
-
this.debugLog(
|
|
657
|
+
await this.debugLog(`StatefulProgrammableSwitch On: ${this.StatefulProgrammableSwitch.On}`);
|
|
656
658
|
}
|
|
657
659
|
else if (this.otherDeviceType === 'switch') {
|
|
658
660
|
if (this.Switch.On === undefined) {
|
|
659
|
-
this.debugLog(
|
|
661
|
+
await this.debugLog(`On: ${this.Switch.On}`);
|
|
660
662
|
}
|
|
661
663
|
else {
|
|
662
664
|
this.Switch.Service.updateCharacteristic(this.hap.Characteristic.On, this.Switch.On);
|
|
663
|
-
this.debugLog(
|
|
665
|
+
await this.debugLog(`updateCharacteristic On: ${this.Switch.On}`);
|
|
664
666
|
}
|
|
665
667
|
}
|
|
666
668
|
else {
|
|
667
669
|
if (this.Outlet.On === undefined) {
|
|
668
|
-
this.debugLog(
|
|
670
|
+
await this.debugLog(`On: ${this.Outlet.On}`);
|
|
669
671
|
}
|
|
670
672
|
else {
|
|
671
673
|
this.Outlet.Service.updateCharacteristic(this.hap.Characteristic.On, this.Outlet.On);
|
|
672
|
-
this.debugLog(
|
|
674
|
+
await this.debugLog(`updateCharacteristic On: ${this.Outlet.On}`);
|
|
673
675
|
}
|
|
674
676
|
}
|
|
675
677
|
}
|
|
@@ -739,7 +741,7 @@ export class Others extends irdeviceBase {
|
|
|
739
741
|
// If Outlet.Service still present, then remove first
|
|
740
742
|
if (this.Outlet?.Service) {
|
|
741
743
|
this.Outlet.Service = this.accessory.getService(this.hap.Service.Outlet);
|
|
742
|
-
this.warnLog(
|
|
744
|
+
this.warnLog('Removing Leftover Outlet Service');
|
|
743
745
|
accessory.removeService(this.Outlet.Service);
|
|
744
746
|
}
|
|
745
747
|
}
|
|
@@ -747,7 +749,7 @@ export class Others extends irdeviceBase {
|
|
|
747
749
|
// If GarageDoor.Service still present, then remove first
|
|
748
750
|
if (this.GarageDoor?.Service) {
|
|
749
751
|
this.GarageDoor.Service = this.accessory.getService(this.hap.Service.GarageDoorOpener);
|
|
750
|
-
this.warnLog(
|
|
752
|
+
this.warnLog('Removing Leftover Garage Door Service');
|
|
751
753
|
accessory.removeService(this.GarageDoor.Service);
|
|
752
754
|
}
|
|
753
755
|
}
|
|
@@ -755,7 +757,7 @@ export class Others extends irdeviceBase {
|
|
|
755
757
|
// If Door.Service still present, then remove first
|
|
756
758
|
if (this.Door?.Service) {
|
|
757
759
|
this.Door.Service = this.accessory.getService(this.hap.Service.Door);
|
|
758
|
-
this.warnLog(
|
|
760
|
+
this.warnLog('Removing Leftover Door Service');
|
|
759
761
|
accessory.removeService(this.Door.Service);
|
|
760
762
|
}
|
|
761
763
|
}
|
|
@@ -763,7 +765,7 @@ export class Others extends irdeviceBase {
|
|
|
763
765
|
// If Lock.Service still present, then remove first
|
|
764
766
|
if (this.LockMechanism?.Service) {
|
|
765
767
|
this.LockMechanism.Service = this.accessory.getService(this.hap.Service.LockMechanism);
|
|
766
|
-
this.warnLog(
|
|
768
|
+
this.warnLog('Removing Leftover Lock Service');
|
|
767
769
|
accessory.removeService(this.LockMechanism.Service);
|
|
768
770
|
}
|
|
769
771
|
}
|
|
@@ -771,7 +773,7 @@ export class Others extends irdeviceBase {
|
|
|
771
773
|
// If Faucet.Service still present, then remove first
|
|
772
774
|
if (this.Faucet?.Service) {
|
|
773
775
|
this.Faucet.Service = this.accessory.getService(this.hap.Service.Faucet);
|
|
774
|
-
this.warnLog(
|
|
776
|
+
this.warnLog('Removing Leftover Faucet Service');
|
|
775
777
|
accessory.removeService(this.Faucet.Service);
|
|
776
778
|
}
|
|
777
779
|
}
|
|
@@ -779,7 +781,7 @@ export class Others extends irdeviceBase {
|
|
|
779
781
|
// If Fan Service still present, then remove first
|
|
780
782
|
if (this.Fan?.Service) {
|
|
781
783
|
this.Fan.Service = this.accessory.getService(this.hap.Service.Fan);
|
|
782
|
-
this.warnLog(
|
|
784
|
+
this.warnLog('Removing Leftover Fan Service');
|
|
783
785
|
accessory.removeService(this.Fan.Service);
|
|
784
786
|
}
|
|
785
787
|
}
|
|
@@ -787,7 +789,7 @@ export class Others extends irdeviceBase {
|
|
|
787
789
|
// If Window.Service still present, then remove first
|
|
788
790
|
if (this.Window?.Service) {
|
|
789
791
|
this.Window.Service = this.accessory.getService(this.hap.Service.Window);
|
|
790
|
-
this.warnLog(
|
|
792
|
+
this.warnLog('Removing Leftover Window Service');
|
|
791
793
|
accessory.removeService(this.Window.Service);
|
|
792
794
|
}
|
|
793
795
|
}
|
|
@@ -795,7 +797,7 @@ export class Others extends irdeviceBase {
|
|
|
795
797
|
// If WindowCovering.Service still present, then remove first
|
|
796
798
|
if (this.WindowCovering?.Service) {
|
|
797
799
|
this.WindowCovering.Service = this.accessory.getService(this.hap.Service.WindowCovering);
|
|
798
|
-
this.warnLog(
|
|
800
|
+
this.warnLog('Removing Leftover Window Covering Service');
|
|
799
801
|
accessory.removeService(this.WindowCovering.Service);
|
|
800
802
|
}
|
|
801
803
|
}
|
|
@@ -803,7 +805,7 @@ export class Others extends irdeviceBase {
|
|
|
803
805
|
// If StatefulProgrammableSwitch.Service still present, then remove first
|
|
804
806
|
if (this.StatefulProgrammableSwitch?.Service) {
|
|
805
807
|
this.StatefulProgrammableSwitch.Service = this.accessory.getService(this.hap.Service.StatefulProgrammableSwitch);
|
|
806
|
-
this.warnLog(
|
|
808
|
+
this.warnLog('Removing Leftover Stateful Programmable Switch Service');
|
|
807
809
|
accessory.removeService(this.StatefulProgrammableSwitch.Service);
|
|
808
810
|
}
|
|
809
811
|
}
|
|
@@ -811,24 +813,24 @@ export class Others extends irdeviceBase {
|
|
|
811
813
|
// If Switch.Service still present, then remove first
|
|
812
814
|
if (this.Switch?.Service) {
|
|
813
815
|
this.Switch.Service = this.accessory.getService(this.hap.Service.Switch);
|
|
814
|
-
this.warnLog(
|
|
816
|
+
this.warnLog('Removing Leftover Switch Service');
|
|
815
817
|
accessory.removeService(this.Switch.Service);
|
|
816
818
|
}
|
|
817
819
|
}
|
|
818
820
|
async getOtherConfigSettings(device) {
|
|
819
821
|
if (!device.other?.deviceType && this.accessory.context.deviceType) {
|
|
820
822
|
this.otherDeviceType = this.accessory.context.deviceType;
|
|
821
|
-
this.debugWarnLog(
|
|
823
|
+
await this.debugWarnLog(`Using Device Type: ${this.otherDeviceType}, from Accessory Cache.`);
|
|
822
824
|
}
|
|
823
825
|
else if (device.other?.deviceType) {
|
|
824
826
|
this.accessory.context.deviceType = device.other.deviceType;
|
|
825
|
-
this.debugWarnLog(
|
|
827
|
+
await this.debugWarnLog(`Accessory Cache: ${this.accessory.context.deviceType}`);
|
|
826
828
|
this.otherDeviceType = this.accessory.context.deviceType;
|
|
827
|
-
this.debugWarnLog(
|
|
829
|
+
await this.debugWarnLog(`Using Device Type: ${this.otherDeviceType}`);
|
|
828
830
|
}
|
|
829
831
|
else {
|
|
830
832
|
this.otherDeviceType = 'outlet';
|
|
831
|
-
this.warnLog(
|
|
833
|
+
this.warnLog(`no deviceType set, using default deviceType: ${this.otherDeviceType}`);
|
|
832
834
|
}
|
|
833
835
|
}
|
|
834
836
|
}
|