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