@switchbot/homebridge-switchbot 3.5.0-beta.68 → 3.5.0-beta.69
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.d.ts.map +1 -1
- package/dist/device/blindtilt.js +6 -3
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +245 -167
- package/dist/device/bot.js.map +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +10 -6
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +6 -3
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +10 -3
- package/dist/device/device.js.map +1 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +15 -9
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +5 -3
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +10 -6
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +11 -7
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +10 -6
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +10 -6
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +5 -3
- package/dist/device/motion.js.map +1 -1
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +5 -3
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +40 -20
- package/dist/irdevice/other.js.map +1 -1
- package/package.json +1 -1
- package/src/device/blindtilt.ts +6 -3
- package/src/device/bot.ts +322 -244
- package/src/device/contact.ts +10 -6
- package/src/device/curtain.ts +6 -3
- package/src/device/device.ts +10 -3
- package/src/device/hub.ts +15 -9
- package/src/device/humidifier.ts +5 -3
- package/src/device/iosensor.ts +10 -6
- package/src/device/lock.ts +11 -7
- package/src/device/meter.ts +10 -6
- package/src/device/meterplus.ts +10 -6
- package/src/device/motion.ts +5 -3
- package/src/device/waterdetector.ts +5 -3
- package/src/irdevice/other.ts +60 -40
package/src/device/contact.ts
CHANGED
|
@@ -103,9 +103,11 @@ export class Contact extends deviceBase {
|
|
|
103
103
|
|
|
104
104
|
// Initialize Motion Sensor Service
|
|
105
105
|
if (this.device.contact?.hide_motionsensor) {
|
|
106
|
-
this.
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
if (this.MotionSensor) {
|
|
107
|
+
this.debugLog(`${device.deviceType}: ${accessory.displayName} Removing Motion Sensor Service`);
|
|
108
|
+
this.MotionSensor.Service = accessory.getService(this.hap.Service.MotionSensor) as Service;
|
|
109
|
+
accessory.removeService(this.MotionSensor.Service);
|
|
110
|
+
}
|
|
109
111
|
} else {
|
|
110
112
|
accessory.context.MotionSensor = accessory.context.MotionSensor ?? {};
|
|
111
113
|
this.MotionSensor = {
|
|
@@ -127,9 +129,11 @@ export class Contact extends deviceBase {
|
|
|
127
129
|
|
|
128
130
|
// Initialize Light Sensor Service
|
|
129
131
|
if (device.contact?.hide_lightsensor) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
if (this.LightSensor) {
|
|
133
|
+
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Light Sensor Service`);
|
|
134
|
+
this.LightSensor.Service = accessory.getService(this.hap.Service.LightSensor) as Service;
|
|
135
|
+
accessory.removeService(this.LightSensor.Service);
|
|
136
|
+
}
|
|
133
137
|
} else {
|
|
134
138
|
accessory.context.LightSensor = accessory.context.LightSensor ?? {};
|
|
135
139
|
this.LightSensor = {
|
package/src/device/curtain.ts
CHANGED
|
@@ -148,9 +148,12 @@ export class Curtain extends deviceBase {
|
|
|
148
148
|
|
|
149
149
|
// Initialize LightSensor Service
|
|
150
150
|
if (device.curtain?.hide_lightsensor) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
if (this.LightSensor?.Service) {
|
|
152
|
+
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Light Sensor Service`);
|
|
153
|
+
this.LightSensor.Service = this.accessory.getService(this.hap.Service.LightSensor) as Service;
|
|
154
|
+
accessory.removeService(this.LightSensor.Service);
|
|
155
|
+
accessory.context.LightSensor = {};
|
|
156
|
+
}
|
|
154
157
|
} else {
|
|
155
158
|
accessory.context.LightSensor = accessory.context.LightSensor ?? {};
|
|
156
159
|
this.LightSensor = {
|
package/src/device/device.ts
CHANGED
|
@@ -584,11 +584,18 @@ export abstract class deviceBase {
|
|
|
584
584
|
|
|
585
585
|
async statusCode(statusCode: number): Promise<void> {
|
|
586
586
|
if (statusCode === 171) {
|
|
587
|
-
|
|
587
|
+
const previousStatusCode = statusCode;
|
|
588
|
+
if (this.device.hubDeviceId === this.device.deviceId) {
|
|
588
589
|
statusCode = 161;
|
|
590
|
+
this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${previousStatusCode} is now statusCode: `
|
|
591
|
+
+ `${statusCode}, because the hubDeviceId: ${this.device.hubDeviceId} is set to the same as the deviceId: `
|
|
592
|
+
+ `${this.device.deviceId}, meaning the device is it's own hub.`);
|
|
589
593
|
}
|
|
590
|
-
if (this.device.
|
|
594
|
+
if (this.device.hubDeviceId === '000000000000') {
|
|
591
595
|
statusCode = 161;
|
|
596
|
+
this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${previousStatusCode} is now statusCode: `
|
|
597
|
+
+ `${statusCode}, because the hubDeviceId: ${this.device.hubDeviceId} is set to the same as the deviceId: `
|
|
598
|
+
+ `${this.device.deviceId}, meaning the device is it's own hub.`);
|
|
592
599
|
}
|
|
593
600
|
}
|
|
594
601
|
switch (statusCode) {
|
|
@@ -656,7 +663,7 @@ export abstract class deviceBase {
|
|
|
656
663
|
break;
|
|
657
664
|
default:
|
|
658
665
|
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Unknown statusCode: `
|
|
659
|
-
+ `${statusCode}, Submit Bugs Here:
|
|
666
|
+
+ `${statusCode}, Submit Bugs Here: https://tinyurl.com/SwitchBotBug`);
|
|
660
667
|
}
|
|
661
668
|
}
|
|
662
669
|
|
package/src/device/hub.ts
CHANGED
|
@@ -48,9 +48,11 @@ export class Hub extends deviceBase {
|
|
|
48
48
|
|
|
49
49
|
// Initialize Temperature Sensor Service
|
|
50
50
|
if (device.hub?.hide_temperature) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
if (this.TemperatureSensor) {
|
|
52
|
+
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Temperature Sensor Service`);
|
|
53
|
+
this.TemperatureSensor.Service = this.accessory.getService(this.hap.Service.TemperatureSensor) as Service;
|
|
54
|
+
accessory.removeService(this.TemperatureSensor.Service);
|
|
55
|
+
}
|
|
54
56
|
} else {
|
|
55
57
|
accessory.context.TemperatureSensor = accessory.context.TemperatureSensor ?? {};
|
|
56
58
|
this.TemperatureSensor = {
|
|
@@ -78,9 +80,11 @@ export class Hub extends deviceBase {
|
|
|
78
80
|
|
|
79
81
|
// Initialize Humidity Sensor Service
|
|
80
82
|
if (device.hub?.hide_humidity) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
if (this.HumiditySensor) {
|
|
84
|
+
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Humidity Sensor Service`);
|
|
85
|
+
this.HumiditySensor.Service = this.accessory.getService(this.hap.Service.HumiditySensor) as Service;
|
|
86
|
+
accessory.removeService(this.HumiditySensor.Service);
|
|
87
|
+
}
|
|
84
88
|
} else {
|
|
85
89
|
accessory.context.HumiditySensor = accessory.context.HumiditySensor ?? {};
|
|
86
90
|
this.HumiditySensor = {
|
|
@@ -104,9 +108,11 @@ export class Hub extends deviceBase {
|
|
|
104
108
|
|
|
105
109
|
// Initialize Light Sensor Service
|
|
106
110
|
if (device.hub?.hide_lightsensor) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
111
|
+
if (this.LightSensor) {
|
|
112
|
+
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Light Sensor Service`);
|
|
113
|
+
this.LightSensor.Service = this.accessory.getService(this.hap.Service.LightSensor) as Service;
|
|
114
|
+
accessory.removeService(this.LightSensor.Service);
|
|
115
|
+
}
|
|
110
116
|
} else {
|
|
111
117
|
accessory.context.LightSensor = accessory.context.LightSensor ?? {};
|
|
112
118
|
this.LightSensor = {
|
package/src/device/humidifier.ts
CHANGED
|
@@ -103,9 +103,11 @@ export class Humidifier extends deviceBase {
|
|
|
103
103
|
|
|
104
104
|
// Initialize the Temperature Sensor Service
|
|
105
105
|
if (device.humidifier?.hide_temperature) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
if (this.TemperatureSensor) {
|
|
107
|
+
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Temperature Sensor Service`);
|
|
108
|
+
this.TemperatureSensor!.Service = this.accessory.getService(this.hap.Service.TemperatureSensor) as Service;
|
|
109
|
+
accessory.removeService(this.TemperatureSensor!.Service);
|
|
110
|
+
}
|
|
109
111
|
} else {
|
|
110
112
|
accessory.context.TemperatureSensor = accessory.context.TemperatureSensor ?? {};
|
|
111
113
|
this.TemperatureSensor = {
|
package/src/device/iosensor.ts
CHANGED
|
@@ -80,9 +80,11 @@ export class IOSensor extends deviceBase {
|
|
|
80
80
|
|
|
81
81
|
// InitializeTemperature Sensor Service
|
|
82
82
|
if (device.iosensor?.hide_temperature) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
if (this.TemperatureSensor) {
|
|
84
|
+
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Temperature Sensor Service`);
|
|
85
|
+
this.TemperatureSensor.Service = this.accessory.getService(this.hap.Service.TemperatureSensor) as Service;
|
|
86
|
+
accessory.removeService(this.TemperatureSensor.Service);
|
|
87
|
+
}
|
|
86
88
|
} else {
|
|
87
89
|
accessory.context.TemperatureSensor = accessory.context.TemperatureSensor ?? {};
|
|
88
90
|
this.TemperatureSensor = {
|
|
@@ -110,9 +112,11 @@ export class IOSensor extends deviceBase {
|
|
|
110
112
|
|
|
111
113
|
// Initialize Humidity Sensor Service
|
|
112
114
|
if (device.iosensor?.hide_humidity) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
115
|
+
if (this.HumiditySensor) {
|
|
116
|
+
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Humidity Sensor Service`);
|
|
117
|
+
this.HumiditySensor.Service = this.accessory.getService(this.hap.Service.HumiditySensor) as Service;
|
|
118
|
+
accessory.removeService(this.HumiditySensor.Service);
|
|
119
|
+
}
|
|
116
120
|
} else {
|
|
117
121
|
accessory.context.HumiditySensor = accessory.context.HumiditySensor ?? {};
|
|
118
122
|
this.HumiditySensor = {
|
package/src/device/lock.ts
CHANGED
|
@@ -96,9 +96,11 @@ export class Lock extends deviceBase {
|
|
|
96
96
|
|
|
97
97
|
// Contact Sensor Service
|
|
98
98
|
if (device.lock?.hide_contactsensor) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
if (this.ContactSensor) {
|
|
100
|
+
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Contact Sensor Service`);
|
|
101
|
+
this.ContactSensor.Service = this.accessory.getService(this.hap.Service.ContactSensor) as Service;
|
|
102
|
+
accessory.removeService(this.ContactSensor.Service);
|
|
103
|
+
}
|
|
102
104
|
} else {
|
|
103
105
|
accessory.context.ContactSensor = accessory.context.ContactSensor ?? {};
|
|
104
106
|
this.ContactSensor = {
|
|
@@ -119,10 +121,12 @@ export class Lock extends deviceBase {
|
|
|
119
121
|
}
|
|
120
122
|
|
|
121
123
|
// Initialize Latch Button Service
|
|
122
|
-
if (device.lock?.activate_latchbutton === false) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
if (device.lock?.activate_latchbutton === false) {
|
|
125
|
+
if (this.Switch) {
|
|
126
|
+
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Latch Button Service`);
|
|
127
|
+
this.Switch.Service = accessory.getService(this.hap.Service.Switch) as Service;
|
|
128
|
+
accessory.removeService(this.Switch.Service);
|
|
129
|
+
}
|
|
126
130
|
} else {
|
|
127
131
|
accessory.context.Switch = accessory.context.Switch ?? {};
|
|
128
132
|
this.Switch = {
|
package/src/device/meter.ts
CHANGED
|
@@ -74,9 +74,11 @@ export class Meter extends deviceBase {
|
|
|
74
74
|
|
|
75
75
|
// Initialize Temperature Sensor Service
|
|
76
76
|
if (device.meter?.hide_temperature) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
if (this.TemperatureSensor) {
|
|
78
|
+
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Temperature Sensor Service`);
|
|
79
|
+
this.TemperatureSensor.Service = this.accessory.getService(this.hap.Service.TemperatureSensor) as Service;
|
|
80
|
+
accessory.removeService(this.TemperatureSensor.Service);
|
|
81
|
+
}
|
|
80
82
|
} else {
|
|
81
83
|
accessory.context.TemperatureSensor = accessory.context.TemperatureSensor ?? {};
|
|
82
84
|
this.TemperatureSensor = {
|
|
@@ -103,9 +105,11 @@ export class Meter extends deviceBase {
|
|
|
103
105
|
}
|
|
104
106
|
// Initialize Humidity Sensor Service
|
|
105
107
|
if (device.meter?.hide_humidity) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
if (this.HumiditySensor) {
|
|
109
|
+
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Humidity Sensor Service`);
|
|
110
|
+
this.HumiditySensor.Service = this.accessory.getService(this.hap.Service.HumiditySensor) as Service;
|
|
111
|
+
accessory.removeService(this.HumiditySensor.Service);
|
|
112
|
+
}
|
|
109
113
|
} else {
|
|
110
114
|
accessory.context.HumiditySensor = accessory.context.HumiditySensor ?? {};
|
|
111
115
|
this.HumiditySensor = {
|
package/src/device/meterplus.ts
CHANGED
|
@@ -78,9 +78,11 @@ export class MeterPlus extends deviceBase {
|
|
|
78
78
|
|
|
79
79
|
// Initialize Temperature Sensor Service
|
|
80
80
|
if (device.meter?.hide_temperature) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
if (this.TemperatureSensor) {
|
|
82
|
+
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Temperature Sensor Service`);
|
|
83
|
+
this.TemperatureSensor.Service = this.accessory.getService(this.hap.Service.TemperatureSensor) as Service;
|
|
84
|
+
accessory.removeService(this.TemperatureSensor.Service);
|
|
85
|
+
}
|
|
84
86
|
} else {
|
|
85
87
|
accessory.context.TemperatureSensor = accessory.context.TemperatureSensor ?? {};
|
|
86
88
|
this.TemperatureSensor = {
|
|
@@ -107,9 +109,11 @@ export class MeterPlus extends deviceBase {
|
|
|
107
109
|
}
|
|
108
110
|
// Initialize Humidity Sensor Service
|
|
109
111
|
if (device.meter?.hide_humidity) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
if (this.HumiditySensor) {
|
|
113
|
+
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Humidity Sensor Service`);
|
|
114
|
+
this.HumiditySensor.Service = this.accessory.getService(this.hap.Service.HumiditySensor) as Service;
|
|
115
|
+
accessory.removeService(this.HumiditySensor.Service);
|
|
116
|
+
}
|
|
113
117
|
} else {
|
|
114
118
|
accessory.context.HumiditySensor = accessory.context.HumiditySensor ?? {};
|
|
115
119
|
this.HumiditySensor = {
|
package/src/device/motion.ts
CHANGED
|
@@ -98,9 +98,11 @@ export class Motion extends deviceBase {
|
|
|
98
98
|
|
|
99
99
|
// Initialize Light Sensor Service
|
|
100
100
|
if (device.motion?.hide_lightsensor) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
if (this.LightSensor) {
|
|
102
|
+
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Light Sensor Service`);
|
|
103
|
+
this.LightSensor.Service = this.accessory.getService(this.hap.Service.LightSensor) as Service;
|
|
104
|
+
accessory.removeService(this.LightSensor.Service);
|
|
105
|
+
}
|
|
104
106
|
} else {
|
|
105
107
|
accessory.context.LightSensor = accessory.context.LightSensor ?? {};
|
|
106
108
|
this.LightSensor = {
|
|
@@ -78,9 +78,11 @@ export class WaterDetector extends deviceBase {
|
|
|
78
78
|
|
|
79
79
|
// Initialize Leak Sensor Service
|
|
80
80
|
if (device.waterdetector?.hide_leak) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
if (this.LeakSensor) {
|
|
82
|
+
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Leak Sensor Service`);
|
|
83
|
+
this.LeakSensor.Service = this.accessory.getService(this.hap.Service.LeakSensor) as Service;
|
|
84
|
+
accessory.removeService(this.LeakSensor.Service);
|
|
85
|
+
}
|
|
84
86
|
} else {
|
|
85
87
|
accessory.context.LeakSensor = accessory.context.LeakSensor ?? {};
|
|
86
88
|
this.LeakSensor = {
|
package/src/irdevice/other.ts
CHANGED
|
@@ -725,125 +725,145 @@ export class Others extends irdeviceBase {
|
|
|
725
725
|
|
|
726
726
|
async apiError(e: any): Promise<void> {
|
|
727
727
|
if (this.otherDeviceType === 'garagedoor') {
|
|
728
|
-
this.GarageDoor
|
|
729
|
-
|
|
730
|
-
|
|
728
|
+
if (this.GarageDoor) {
|
|
729
|
+
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, e);
|
|
730
|
+
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, e);
|
|
731
|
+
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.ObstructionDetected, e);
|
|
732
|
+
}
|
|
731
733
|
} else if (this.otherDeviceType === 'door') {
|
|
732
|
-
this.Door
|
|
733
|
-
|
|
734
|
-
|
|
734
|
+
if (this.Door) {
|
|
735
|
+
this.Door.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, e);
|
|
736
|
+
this.Door.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, e);
|
|
737
|
+
this.Door.Service.updateCharacteristic(this.hap.Characteristic.PositionState, e);
|
|
738
|
+
}
|
|
735
739
|
} else if (this.otherDeviceType === 'window') {
|
|
736
|
-
this.Window
|
|
737
|
-
|
|
738
|
-
|
|
740
|
+
if (this.Window) {
|
|
741
|
+
this.Window.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, e);
|
|
742
|
+
this.Window.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, e);
|
|
743
|
+
this.Window.Service.updateCharacteristic(this.hap.Characteristic.PositionState, e);
|
|
744
|
+
}
|
|
739
745
|
} else if (this.otherDeviceType === 'windowcovering') {
|
|
740
|
-
this.WindowCovering
|
|
741
|
-
|
|
742
|
-
|
|
746
|
+
if (this.WindowCovering) {
|
|
747
|
+
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, e);
|
|
748
|
+
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, e);
|
|
749
|
+
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.PositionState, e);
|
|
750
|
+
}
|
|
743
751
|
} else if (this.otherDeviceType === 'lock') {
|
|
744
|
-
|
|
745
|
-
|
|
752
|
+
if (this.LockMechanism) {
|
|
753
|
+
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState, e);
|
|
754
|
+
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState, e);
|
|
755
|
+
}
|
|
746
756
|
} else if (this.otherDeviceType === 'faucet') {
|
|
747
|
-
this.Faucet
|
|
757
|
+
if (this.Faucet) {
|
|
758
|
+
this.Faucet.Service.updateCharacteristic(this.hap.Characteristic.Active, e);
|
|
759
|
+
}
|
|
748
760
|
} else if (this.otherDeviceType === 'fan') {
|
|
749
|
-
this.Fan
|
|
761
|
+
if (this.Fan) {
|
|
762
|
+
this.Fan.Service.updateCharacteristic(this.hap.Characteristic.On, e);
|
|
763
|
+
}
|
|
750
764
|
} else if (this.otherDeviceType === 'stateful') {
|
|
751
|
-
this.StatefulProgrammableSwitch
|
|
752
|
-
|
|
765
|
+
if (this.StatefulProgrammableSwitch) {
|
|
766
|
+
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent, e);
|
|
767
|
+
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, e);
|
|
768
|
+
}
|
|
753
769
|
} else if (this.otherDeviceType === 'switch') {
|
|
754
|
-
this.Switch
|
|
770
|
+
if (this.Switch) {
|
|
771
|
+
this.Switch.Service.updateCharacteristic(this.hap.Characteristic.On, e);
|
|
772
|
+
}
|
|
755
773
|
} else {
|
|
756
|
-
this.Outlet
|
|
774
|
+
if (this.Outlet) {
|
|
775
|
+
this.Outlet.Service.updateCharacteristic(this.hap.Characteristic.On, e);
|
|
776
|
+
}
|
|
757
777
|
}
|
|
758
778
|
}
|
|
759
779
|
|
|
760
780
|
async removeOutletService(accessory: PlatformAccessory): Promise<void> {
|
|
761
781
|
// If Outlet.Service still present, then remove first
|
|
762
782
|
if (this.Outlet?.Service) {
|
|
763
|
-
this.Outlet
|
|
783
|
+
this.Outlet.Service = this.accessory.getService(this.hap.Service.Outlet) as Service;
|
|
764
784
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Outlet Service`);
|
|
765
|
-
accessory.removeService(this.Outlet
|
|
785
|
+
accessory.removeService(this.Outlet.Service);
|
|
766
786
|
}
|
|
767
787
|
}
|
|
768
788
|
|
|
769
789
|
async removeGarageDoorService(accessory: PlatformAccessory): Promise<void> {
|
|
770
790
|
// If GarageDoor.Service still present, then remove first
|
|
771
791
|
if (this.GarageDoor?.Service) {
|
|
772
|
-
this.GarageDoor
|
|
792
|
+
this.GarageDoor.Service = this.accessory.getService(this.hap.Service.GarageDoorOpener) as Service;
|
|
773
793
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Garage Door Service`);
|
|
774
|
-
accessory.removeService(this.GarageDoor
|
|
794
|
+
accessory.removeService(this.GarageDoor.Service);
|
|
775
795
|
}
|
|
776
796
|
}
|
|
777
797
|
|
|
778
798
|
async removeDoorService(accessory: PlatformAccessory): Promise<void> {
|
|
779
799
|
// If Door.Service still present, then remove first
|
|
780
800
|
if (this.Door?.Service) {
|
|
781
|
-
this.Door
|
|
801
|
+
this.Door.Service = this.accessory.getService(this.hap.Service.Door) as Service;
|
|
782
802
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Door Service`);
|
|
783
|
-
accessory.removeService(this.Door
|
|
803
|
+
accessory.removeService(this.Door.Service);
|
|
784
804
|
}
|
|
785
805
|
}
|
|
786
806
|
|
|
787
807
|
async removeLockService(accessory: PlatformAccessory): Promise<void> {
|
|
788
808
|
// If Lock.Service still present, then remove first
|
|
789
809
|
if (this.LockMechanism?.Service) {
|
|
790
|
-
this.LockMechanism
|
|
810
|
+
this.LockMechanism.Service = this.accessory.getService(this.hap.Service.LockMechanism) as Service;
|
|
791
811
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Lock Service`);
|
|
792
|
-
accessory.removeService(this.LockMechanism
|
|
812
|
+
accessory.removeService(this.LockMechanism.Service);
|
|
793
813
|
}
|
|
794
814
|
}
|
|
795
815
|
|
|
796
816
|
async removeFaucetService(accessory: PlatformAccessory): Promise<void> {
|
|
797
817
|
// If Faucet.Service still present, then remove first
|
|
798
818
|
if (this.Faucet?.Service) {
|
|
799
|
-
this.Faucet
|
|
819
|
+
this.Faucet.Service = this.accessory.getService(this.hap.Service.Faucet) as Service;
|
|
800
820
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Faucet Service`);
|
|
801
|
-
accessory.removeService(this.Faucet
|
|
821
|
+
accessory.removeService(this.Faucet.Service);
|
|
802
822
|
}
|
|
803
823
|
}
|
|
804
824
|
|
|
805
825
|
async removeFanService(accessory: PlatformAccessory): Promise<void> {
|
|
806
826
|
// If Fan Service still present, then remove first
|
|
807
827
|
if (this.Fan?.Service) {
|
|
808
|
-
this.Fan
|
|
828
|
+
this.Fan.Service = this.accessory.getService(this.hap.Service.Fan) as Service;
|
|
809
829
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Fan Service`);
|
|
810
|
-
accessory.removeService(this.Fan
|
|
830
|
+
accessory.removeService(this.Fan.Service);
|
|
811
831
|
}
|
|
812
832
|
}
|
|
813
833
|
|
|
814
834
|
async removeWindowService(accessory: PlatformAccessory): Promise<void> {
|
|
815
835
|
// If Window.Service still present, then remove first
|
|
816
836
|
if (this.Window?.Service) {
|
|
817
|
-
this.Window
|
|
837
|
+
this.Window.Service = this.accessory.getService(this.hap.Service.Window) as Service;
|
|
818
838
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Window Service`);
|
|
819
|
-
accessory.removeService(this.Window
|
|
839
|
+
accessory.removeService(this.Window.Service);
|
|
820
840
|
}
|
|
821
841
|
}
|
|
822
842
|
|
|
823
843
|
async removeWindowCoveringService(accessory: PlatformAccessory): Promise<void> {
|
|
824
844
|
// If WindowCovering.Service still present, then remove first
|
|
825
845
|
if (this.WindowCovering?.Service) {
|
|
826
|
-
this.WindowCovering
|
|
846
|
+
this.WindowCovering.Service = this.accessory.getService(this.hap.Service.WindowCovering) as Service;
|
|
827
847
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Window Covering Service`);
|
|
828
|
-
accessory.removeService(this.WindowCovering
|
|
848
|
+
accessory.removeService(this.WindowCovering.Service);
|
|
829
849
|
}
|
|
830
850
|
}
|
|
831
851
|
|
|
832
852
|
async removeStatefulProgrammableSwitchService(accessory: PlatformAccessory): Promise<void> {
|
|
833
853
|
// If StatefulProgrammableSwitch.Service still present, then remove first
|
|
834
854
|
if (this.StatefulProgrammableSwitch?.Service) {
|
|
835
|
-
this.StatefulProgrammableSwitch
|
|
855
|
+
this.StatefulProgrammableSwitch.Service = this.accessory.getService(this.hap.Service.StatefulProgrammableSwitch) as Service;
|
|
836
856
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Stateful Programmable Switch Service`);
|
|
837
|
-
accessory.removeService(this.StatefulProgrammableSwitch
|
|
857
|
+
accessory.removeService(this.StatefulProgrammableSwitch.Service);
|
|
838
858
|
}
|
|
839
859
|
}
|
|
840
860
|
|
|
841
861
|
async removeSwitchService(accessory: PlatformAccessory): Promise<void> {
|
|
842
862
|
// If Switch.Service still present, then remove first
|
|
843
863
|
if (this.Switch?.Service) {
|
|
844
|
-
this.Switch
|
|
864
|
+
this.Switch.Service = this.accessory.getService(this.hap.Service.Switch) as Service;
|
|
845
865
|
this.warnLog(`${this.device.remoteType}: ${accessory.displayName} Removing Leftover Switch Service`);
|
|
846
|
-
accessory.removeService(this.Switch
|
|
866
|
+
accessory.removeService(this.Switch.Service);
|
|
847
867
|
}
|
|
848
868
|
}
|
|
849
869
|
|