@switchbot/homebridge-switchbot 3.5.0-beta.63 → 3.5.0-beta.64
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 +7 -6
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +31 -21
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +4 -3
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +1 -2
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +14 -10
- package/dist/device/contact.js.map +1 -1
- package/dist/device/device.js +11 -10
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.d.ts.map +1 -1
- package/dist/device/fan.js +7 -5
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +9 -6
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +6 -4
- 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/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +3 -2
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +12 -8
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +8 -5
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +9 -6
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +9 -5
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +3 -2
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +6 -4
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +4 -2
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +5 -5
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +6 -10
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +3 -5
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +3 -6
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +7 -13
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +34 -55
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +4 -8
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +3 -5
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +3 -5
- package/dist/irdevice/waterheater.js.map +1 -1
- package/package.json +1 -1
- package/src/device/blindtilt.ts +7 -6
- package/src/device/bot.ts +31 -21
- package/src/device/ceilinglight.ts +4 -3
- package/src/device/colorbulb.ts +1 -2
- package/src/device/contact.ts +14 -10
- package/src/device/device.ts +11 -11
- package/src/device/fan.ts +7 -5
- package/src/device/hub.ts +9 -6
- package/src/device/humidifier.ts +6 -4
- package/src/device/iosensor.ts +10 -6
- package/src/device/lightstrip.ts +3 -2
- package/src/device/lock.ts +12 -8
- package/src/device/meter.ts +8 -5
- package/src/device/meterplus.ts +9 -6
- package/src/device/motion.ts +9 -5
- package/src/device/plug.ts +3 -2
- package/src/device/robotvacuumcleaner.ts +6 -4
- package/src/device/waterdetector.ts +4 -2
- package/src/irdevice/airconditioner.ts +5 -6
- package/src/irdevice/airpurifier.ts +6 -11
- package/src/irdevice/camera.ts +3 -5
- package/src/irdevice/fan.ts +3 -7
- package/src/irdevice/light.ts +7 -15
- package/src/irdevice/other.ts +34 -55
- package/src/irdevice/tv.ts +4 -8
- package/src/irdevice/vacuumcleaner.ts +3 -5
- package/src/irdevice/waterheater.ts +3 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vacuumcleaner.js","sourceRoot":"","sources":["../../src/irdevice/vacuumcleaner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAM7C;;;;GAIG;AACH,MAAM,OAAO,aAAc,SAAQ,YAAY;IASlC;IARX,WAAW;IACH,MAAM,CAIZ;IAEF,YACW,QAA2B,EACpC,SAA4B,EAC5B,MAAkC;QAElC,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAJ1B,aAAQ,GAAR,QAAQ,CAAmB;QAMpC,4BAA4B;QAC5B,
|
|
1
|
+
{"version":3,"file":"vacuumcleaner.js","sourceRoot":"","sources":["../../src/irdevice/vacuumcleaner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;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CAAC,QAAQ,CAAC,CAAM;QACnB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAC1E,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waterheater.d.ts","sourceRoot":"","sources":["../../src/irdevice/waterheater.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAW,MAAM,YAAY,CAAC;AAElF;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,YAAY;IASzC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB;IAPtC,OAAO,CAAC,KAAK,CAIX;gBAGS,QAAQ,EAAE,iBAAiB,EACpC,SAAS,EAAE,iBAAiB,EAC5B,MAAM,EAAE,QAAQ,GAAG,eAAe;
|
|
1
|
+
{"version":3,"file":"waterheater.d.ts","sourceRoot":"","sources":["../../src/irdevice/waterheater.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAW,MAAM,YAAY,CAAC;AAElF;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,YAAY;IASzC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB;IAPtC,OAAO,CAAC,KAAK,CAIX;gBAGS,QAAQ,EAAE,iBAAiB,EACpC,SAAS,EAAE,iBAAiB,EAC5B,MAAM,EAAE,QAAQ,GAAG,eAAe;IAuB9B,SAAS,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAa1D;;;;;OAKG;IACG,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC;IAezC,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC;IAe1C,WAAW,CAAC,UAAU,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAmC3C,4BAA4B,IAAI,OAAO,CAAC,IAAI,CAAC;IAW7C,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE;QAAE,CAAC,EAAE,GAAG,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAGjD"}
|
|
@@ -18,14 +18,13 @@ export class WaterHeater extends irdeviceBase {
|
|
|
18
18
|
super(platform, accessory, device);
|
|
19
19
|
this.platform = platform;
|
|
20
20
|
// Initialize Switch Service
|
|
21
|
-
|
|
22
|
-
accessory.context.Valve = {};
|
|
23
|
-
}
|
|
21
|
+
accessory.context.Valve = accessory.context.Valve ?? {};
|
|
24
22
|
this.Valve = {
|
|
25
|
-
Name: accessory.context.Name ?? `${accessory.displayName} ${device.remoteType}`,
|
|
23
|
+
Name: accessory.context.Valve.Name ?? `${accessory.displayName} ${device.remoteType}`,
|
|
26
24
|
Service: accessory.getService(this.hap.Service.Valve) ?? accessory.addService(this.hap.Service.Valve),
|
|
27
25
|
Active: accessory.context.Active ?? this.hap.Characteristic.Active.INACTIVE,
|
|
28
26
|
};
|
|
27
|
+
accessory.context.Valve = this.Valve;
|
|
29
28
|
this.Valve.Service
|
|
30
29
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
31
30
|
.setCharacteristic(this.hap.Characteristic.ValveType, this.hap.Characteristic.ValveType.GENERIC_VALVE)
|
|
@@ -34,7 +33,6 @@ export class WaterHeater extends irdeviceBase {
|
|
|
34
33
|
return this.Valve.Active;
|
|
35
34
|
})
|
|
36
35
|
.onSet(this.ActiveSet.bind(this));
|
|
37
|
-
accessory.context.Valve.Name = this.Valve.Name;
|
|
38
36
|
}
|
|
39
37
|
async ActiveSet(value) {
|
|
40
38
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${value}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waterheater.js","sourceRoot":"","sources":["../../src/irdevice/waterheater.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAM7C;;;;GAIG;AACH,MAAM,OAAO,WAAY,SAAQ,YAAY;IAShC;IARX,WAAW;IACH,KAAK,CAIX;IAEF,YACW,QAA2B,EACpC,SAA4B,EAC5B,MAAkC;QAElC,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAJ1B,aAAQ,GAAR,QAAQ,CAAmB;QAMpC,4BAA4B;QAC5B,
|
|
1
|
+
{"version":3,"file":"waterheater.js","sourceRoot":"","sources":["../../src/irdevice/waterheater.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAM7C;;;;GAIG;AACH,MAAM,OAAO,WAAY,SAAQ,YAAY;IAShC;IARX,WAAW;IACH,KAAK,CAIX;IAEF,YACW,QAA2B,EACpC,SAA4B,EAC5B,MAAkC;QAElC,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAJ1B,aAAQ,GAAR,QAAQ,CAAmB;QAMpC,4BAA4B;QAC5B,SAAS,CAAC,OAAO,CAAC,KAAK,GAAG,S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,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAC3F,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,KAAK,IAAI,CAAC,SAAS,CAAC,WAAW,iCAAiC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QAC9H,CAAC;IACH,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAc;QAC9B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC7E,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "SwitchBot",
|
|
3
3
|
"name": "@switchbot/homebridge-switchbot",
|
|
4
|
-
"version": "3.5.0-beta.
|
|
4
|
+
"version": "3.5.0-beta.64",
|
|
5
5
|
"description": "The SwitchBot plugin allows you to access your SwitchBot device(s) from HomeKit.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "SwitchBot",
|
package/src/device/blindtilt.ts
CHANGED
|
@@ -66,8 +66,8 @@ export class BlindTilt extends deviceBase {
|
|
|
66
66
|
this.blindTiltUpdateInProgress = false;
|
|
67
67
|
this.setNewTarget = false;
|
|
68
68
|
|
|
69
|
-
accessory.context.WindowCovering = accessory.context.WindowCovering ?? {};
|
|
70
69
|
// Initialize WindowCovering Service
|
|
70
|
+
accessory.context.WindowCovering = accessory.context.WindowCovering ?? {};
|
|
71
71
|
this.WindowCovering = {
|
|
72
72
|
Name: accessory.context.WindowCovering.Name ?? accessory.displayName,
|
|
73
73
|
Service: accessory.getService(this.hap.Service.WindowCovering) ?? accessory.addService(this.hap.Service.WindowCovering) as Service,
|
|
@@ -119,7 +119,6 @@ export class BlindTilt extends deviceBase {
|
|
|
119
119
|
return this.WindowCovering.TargetHorizontalTiltAngle;
|
|
120
120
|
})
|
|
121
121
|
.onSet(this.TargetHorizontalTiltAngleSet.bind(this));
|
|
122
|
-
accessory.context.WindowCovering.Name = this.WindowCovering.Name;
|
|
123
122
|
|
|
124
123
|
// Initialize WindowCovering CurrentHorizontalTiltAngle Characteristic
|
|
125
124
|
this.WindowCovering.Service
|
|
@@ -134,19 +133,20 @@ export class BlindTilt extends deviceBase {
|
|
|
134
133
|
});
|
|
135
134
|
|
|
136
135
|
// Initialize Battery Service
|
|
136
|
+
accessory.context.Battery = accessory.context.Battery ?? {};
|
|
137
137
|
this.Battery = {
|
|
138
|
-
Name: accessory.context.
|
|
138
|
+
Name: accessory.context.Battery.Name ?? `${accessory.displayName} Battery`,
|
|
139
139
|
Service: accessory.getService(this.hap.Service.Battery) ?? accessory.addService(this.hap.Service.Battery) as Service,
|
|
140
140
|
BatteryLevel: accessory.context.BatteryLevel ?? 100,
|
|
141
141
|
StatusLowBattery: this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL,
|
|
142
142
|
ChargingState: accessory.context.ChargingState ?? this.hap.Characteristic.ChargingState.NOT_CHARGING,
|
|
143
143
|
};
|
|
144
|
+
accessory.context.Battery = this.Battery as object;
|
|
144
145
|
|
|
145
146
|
// Initialize Battery Name Characteristic
|
|
146
147
|
this.Battery.Service
|
|
147
148
|
.setCharacteristic(this.hap.Characteristic.Name, this.Battery.Name)
|
|
148
149
|
.setCharacteristic(this.hap.Characteristic.ChargingState, this.hap.Characteristic.ChargingState.NOT_CHARGEABLE);
|
|
149
|
-
accessory.context.BatteryName = this.Battery.Name;
|
|
150
150
|
|
|
151
151
|
// Initialize LightSensor Service
|
|
152
152
|
if (device.blindTilt?.hide_lightsensor) {
|
|
@@ -154,11 +154,13 @@ export class BlindTilt extends deviceBase {
|
|
|
154
154
|
this.LightSensor!.Service = accessory.getService(this.hap.Service.LightSensor) as Service;
|
|
155
155
|
accessory.removeService(this.LightSensor!.Service);
|
|
156
156
|
} else {
|
|
157
|
+
accessory.context.LightSensor = accessory.context.LightSensor ?? {};
|
|
157
158
|
this.LightSensor = {
|
|
158
|
-
Name: accessory.context.
|
|
159
|
+
Name: accessory.context.LightSensor.Name ?? `${accessory.displayName} Light Sensor`,
|
|
159
160
|
Service: accessory.getService(this.hap.Service.LightSensor) ?? accessory.addService(this.hap.Service.LightSensor) as Service,
|
|
160
161
|
CurrentAmbientLightLevel: accessory.context.CurrentAmbientLightLevel ?? 0.0001,
|
|
161
162
|
};
|
|
163
|
+
accessory.context.LightSensor = this.LightSensor as object;
|
|
162
164
|
|
|
163
165
|
// Initialize LightSensor Characteristics
|
|
164
166
|
this.LightSensor.Service
|
|
@@ -168,7 +170,6 @@ export class BlindTilt extends deviceBase {
|
|
|
168
170
|
.onGet(() => {
|
|
169
171
|
return this.LightSensor?.CurrentAmbientLightLevel ?? 0.0001;
|
|
170
172
|
});
|
|
171
|
-
accessory.context.LightSensorName = this.LightSensor.Name;
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
// Retrieve initial values and updateHomekit
|
package/src/device/bot.ts
CHANGED
|
@@ -119,22 +119,24 @@ export class Bot extends deviceBase {
|
|
|
119
119
|
BatteryLevel: accessory.context.BatteryLevel ?? 100,
|
|
120
120
|
StatusLowBattery: accessory.context.StatusLowBattery ?? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL,
|
|
121
121
|
};
|
|
122
|
+
accessory.context.Battery = this.Battery as object;
|
|
122
123
|
|
|
123
124
|
// Initialize Battery Characteristics
|
|
124
125
|
this.Battery.Service
|
|
125
126
|
.setCharacteristic(this.hap.Characteristic.Name, this.Battery.Name)
|
|
126
127
|
.setCharacteristic(this.hap.Characteristic.StatusLowBattery, this.Battery.StatusLowBattery)
|
|
127
128
|
.setCharacteristic(this.hap.Characteristic.ChargingState, this.hap.Characteristic.ChargingState.NOT_CHARGEABLE);
|
|
128
|
-
accessory.context.BatteryName = this.Battery.Name;
|
|
129
129
|
|
|
130
130
|
// deviceType
|
|
131
131
|
if (this.botDeviceType === 'switch') {
|
|
132
132
|
// Initialize Switch Service
|
|
133
|
+
accessory.context.Switch = accessory.context.Switch ?? {};
|
|
133
134
|
this.Switch = {
|
|
134
|
-
Name: accessory.context.Name ?? accessory.displayName,
|
|
135
|
+
Name: accessory.context.Switch.Name ?? accessory.displayName,
|
|
135
136
|
Service: accessory.getService(this.hap.Service.Switch) ?? accessory.addService(this.hap.Service.Switch) as Service,
|
|
136
137
|
On: accessory.context.On ?? false,
|
|
137
138
|
};
|
|
139
|
+
accessory.context.Switch = this.Switch as object;
|
|
138
140
|
this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Switch`);
|
|
139
141
|
|
|
140
142
|
// Initialize Switch Characteristics
|
|
@@ -146,7 +148,6 @@ export class Bot extends deviceBase {
|
|
|
146
148
|
return this.Switch!.On;
|
|
147
149
|
})
|
|
148
150
|
.onSet(this.OnSet.bind(this));
|
|
149
|
-
accessory.context.Name = this.Switch.Name;
|
|
150
151
|
|
|
151
152
|
// Remove other services
|
|
152
153
|
this.removeFanService(accessory);
|
|
@@ -160,11 +161,13 @@ export class Bot extends deviceBase {
|
|
|
160
161
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
161
162
|
} else if (this.botDeviceType === 'garagedoor') {
|
|
162
163
|
// Initialize GarageDoor Service
|
|
164
|
+
accessory.context.GarageDoor = accessory.context.GarageDoor ?? {};
|
|
163
165
|
this.GarageDoor = {
|
|
164
|
-
Name: accessory.context.Name ?? accessory.displayName,
|
|
166
|
+
Name: accessory.context.GarageDoor.Name ?? accessory.displayName,
|
|
165
167
|
Service: accessory.getService(this.hap.Service.GarageDoorOpener) ?? accessory.addService(this.hap.Service.GarageDoorOpener) as Service,
|
|
166
168
|
On: accessory.context.On ?? false,
|
|
167
169
|
};
|
|
170
|
+
accessory.context.GarageDoor = this.GarageDoor as object;
|
|
168
171
|
this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Garage Door Opener`);
|
|
169
172
|
|
|
170
173
|
// Initialize GarageDoor Characteristics
|
|
@@ -181,7 +184,6 @@ export class Bot extends deviceBase {
|
|
|
181
184
|
return this.GarageDoor!.On;
|
|
182
185
|
})
|
|
183
186
|
.onSet(this.OnSet.bind(this));
|
|
184
|
-
accessory.context.Name = this.GarageDoor.Name;
|
|
185
187
|
|
|
186
188
|
// Remove other services
|
|
187
189
|
this.removeFanService(accessory);
|
|
@@ -195,11 +197,13 @@ export class Bot extends deviceBase {
|
|
|
195
197
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
196
198
|
} else if (this.botDeviceType === 'door') {
|
|
197
199
|
// Initialize Door Service
|
|
200
|
+
accessory.context.Door = accessory.context.Door ?? {};
|
|
198
201
|
this.Door = {
|
|
199
|
-
Name: accessory.context.Name ?? accessory.displayName,
|
|
202
|
+
Name: accessory.context.Door.Name ?? accessory.displayName,
|
|
200
203
|
Service: accessory.getService(this.hap.Service.Door) ?? accessory.addService(this.hap.Service.Door) as Service,
|
|
201
204
|
On: accessory.context.On ?? false,
|
|
202
205
|
};
|
|
206
|
+
accessory.context.Door = this.Door as object;
|
|
203
207
|
this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Door`);
|
|
204
208
|
|
|
205
209
|
// Initialize Door Characteristics
|
|
@@ -216,7 +220,6 @@ export class Bot extends deviceBase {
|
|
|
216
220
|
return this.Door!.On;
|
|
217
221
|
})
|
|
218
222
|
.onSet(this.OnSet.bind(this));
|
|
219
|
-
accessory.context.Name = this.Door.Name;
|
|
220
223
|
|
|
221
224
|
// Remove other services
|
|
222
225
|
this.removeFanService(accessory);
|
|
@@ -230,11 +233,13 @@ export class Bot extends deviceBase {
|
|
|
230
233
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
231
234
|
} else if (this.botDeviceType === 'window') {
|
|
232
235
|
// Initialize Window Service
|
|
236
|
+
accessory.context.Window = accessory.context.Window ?? {};
|
|
233
237
|
this.Window = {
|
|
234
|
-
Name: accessory.context.Name ?? accessory.displayName,
|
|
238
|
+
Name: accessory.context.Window.Name ?? accessory.displayName,
|
|
235
239
|
Service: accessory.getService(this.hap.Service.Window) ?? accessory.addService(this.hap.Service.Window) as Service,
|
|
236
240
|
On: accessory.context.On ?? false,
|
|
237
241
|
};
|
|
242
|
+
accessory.context.Window = this.Window as object;
|
|
238
243
|
this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Window`);
|
|
239
244
|
|
|
240
245
|
// Initialize Window Characteristics
|
|
@@ -251,7 +256,6 @@ export class Bot extends deviceBase {
|
|
|
251
256
|
return this.Window!.On;
|
|
252
257
|
})
|
|
253
258
|
.onSet(this.OnSet.bind(this));
|
|
254
|
-
accessory.context.Name = this.Window.Name;
|
|
255
259
|
|
|
256
260
|
// Remove other services
|
|
257
261
|
this.removeFanService(accessory);
|
|
@@ -265,11 +269,13 @@ export class Bot extends deviceBase {
|
|
|
265
269
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
266
270
|
} else if (this.botDeviceType === 'windowcovering') {
|
|
267
271
|
// Initialize WindowCovering Service
|
|
272
|
+
accessory.context.WindowCovering = accessory.context.WindowCovering ?? {};
|
|
268
273
|
this.WindowCovering = {
|
|
269
|
-
Name: accessory.context.Name ?? accessory.displayName,
|
|
274
|
+
Name: accessory.context.WindowCovering.Name ?? accessory.displayName,
|
|
270
275
|
Service: accessory.getService(this.hap.Service.WindowCovering) ?? accessory.addService(this.hap.Service.WindowCovering) as Service,
|
|
271
276
|
On: accessory.context.On ?? false,
|
|
272
277
|
};
|
|
278
|
+
accessory.context.WindowCovering = this.WindowCovering as object;
|
|
273
279
|
this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Window Covering`);
|
|
274
280
|
|
|
275
281
|
// Initialize WindowCovering Characteristics
|
|
@@ -286,7 +292,6 @@ export class Bot extends deviceBase {
|
|
|
286
292
|
return this.WindowCovering!.On;
|
|
287
293
|
})
|
|
288
294
|
.onSet(this.OnSet.bind(this));
|
|
289
|
-
accessory.context.Name = this.WindowCovering.Name;
|
|
290
295
|
|
|
291
296
|
// Remove other services
|
|
292
297
|
this.removeFanService(accessory);
|
|
@@ -300,11 +305,13 @@ export class Bot extends deviceBase {
|
|
|
300
305
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
301
306
|
} else if (this.botDeviceType === 'lock') {
|
|
302
307
|
// Initialize Lock Service
|
|
308
|
+
accessory.context.LockMechanism = accessory.context.LockMechanism ?? {};
|
|
303
309
|
this.LockMechanism = {
|
|
304
|
-
Name: accessory.context.Name ?? accessory.displayName,
|
|
310
|
+
Name: accessory.context.LockMechanism.Name ?? accessory.displayName,
|
|
305
311
|
Service: accessory.getService(this.hap.Service.LockMechanism) ?? accessory.addService(this.hap.Service.LockMechanism) as Service,
|
|
306
312
|
On: accessory.context.On ?? false,
|
|
307
313
|
};
|
|
314
|
+
accessory.context.LockMechanism = this.LockMechanism as object;
|
|
308
315
|
this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Lock`);
|
|
309
316
|
|
|
310
317
|
// Initialize Lock Characteristics
|
|
@@ -315,7 +322,6 @@ export class Bot extends deviceBase {
|
|
|
315
322
|
return this.LockMechanism!.On;
|
|
316
323
|
})
|
|
317
324
|
.onSet(this.OnSet.bind(this));
|
|
318
|
-
accessory.context.Name = this.LockMechanism.Name;
|
|
319
325
|
|
|
320
326
|
// Remove other services
|
|
321
327
|
this.removeFanService(accessory);
|
|
@@ -329,11 +335,13 @@ export class Bot extends deviceBase {
|
|
|
329
335
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
330
336
|
} else if (this.botDeviceType === 'faucet') {
|
|
331
337
|
// Initialize Faucet Service
|
|
338
|
+
accessory.context.Faucet = accessory.context.Faucet ?? {};
|
|
332
339
|
this.Faucet = {
|
|
333
|
-
Name: accessory.context.Name ?? accessory.displayName,
|
|
340
|
+
Name: accessory.context.Faucet.Name ?? accessory.displayName,
|
|
334
341
|
Service: accessory.getService(this.hap.Service.Faucet) ?? accessory.addService(this.hap.Service.Faucet) as Service,
|
|
335
342
|
On: accessory.context.On ?? false,
|
|
336
343
|
};
|
|
344
|
+
accessory.context.Faucet = this.Faucet as object;
|
|
337
345
|
this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Faucet`);
|
|
338
346
|
|
|
339
347
|
// Initialize Faucet Characteristics
|
|
@@ -344,7 +352,6 @@ export class Bot extends deviceBase {
|
|
|
344
352
|
return this.Faucet!.On;
|
|
345
353
|
})
|
|
346
354
|
.onSet(this.OnSet.bind(this));
|
|
347
|
-
accessory.context.Name = this.Faucet.Name;
|
|
348
355
|
|
|
349
356
|
// Remove other services
|
|
350
357
|
this.removeFanService(accessory);
|
|
@@ -358,11 +365,13 @@ export class Bot extends deviceBase {
|
|
|
358
365
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
359
366
|
} else if (this.botDeviceType === 'fan') {
|
|
360
367
|
// Initialize Fan Service
|
|
368
|
+
accessory.context.Fan = accessory.context.Fan ?? {};
|
|
361
369
|
this.Fan = {
|
|
362
|
-
Name: accessory.context.Name ?? accessory.displayName,
|
|
370
|
+
Name: accessory.context.Fan.Name ?? accessory.displayName,
|
|
363
371
|
Service: accessory.getService(this.hap.Service.Fanv2) ?? accessory.addService(this.hap.Service.Fanv2) as Service,
|
|
364
372
|
On: accessory.context.On ?? false,
|
|
365
373
|
};
|
|
374
|
+
accessory.context.Fan = this.Fan as object;
|
|
366
375
|
this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Fan`);
|
|
367
376
|
|
|
368
377
|
// Initialize Fan Characteristics
|
|
@@ -373,7 +382,6 @@ export class Bot extends deviceBase {
|
|
|
373
382
|
return this.Fan!.On;
|
|
374
383
|
})
|
|
375
384
|
.onSet(this.OnSet.bind(this));
|
|
376
|
-
accessory.context.Name = this.Fan.Name;
|
|
377
385
|
|
|
378
386
|
// Remove other services
|
|
379
387
|
this.removeLockService(accessory);
|
|
@@ -387,12 +395,14 @@ export class Bot extends deviceBase {
|
|
|
387
395
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
388
396
|
} else if (this.botDeviceType === 'stateful') {
|
|
389
397
|
// Initialize StatefulProgrammableSwitch Service
|
|
398
|
+
accessory.context.StatefulProgrammableSwitch = accessory.context.StatefulProgrammableSwitch ?? {};
|
|
390
399
|
this.StatefulProgrammableSwitch = {
|
|
391
|
-
Name: accessory.context.Name ?? accessory.displayName,
|
|
400
|
+
Name: accessory.context.StatefulProgrammableSwitch.Name ?? accessory.displayName,
|
|
392
401
|
Service: accessory.getService(this.hap.Service.StatefulProgrammableSwitch)
|
|
393
402
|
?? accessory.addService(this.hap.Service.StatefulProgrammableSwitch) as Service,
|
|
394
403
|
On: accessory.context.On ?? false,
|
|
395
404
|
};
|
|
405
|
+
accessory.context.StatefulProgrammableSwitch = this.StatefulProgrammableSwitch as object;
|
|
396
406
|
this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Stateful Programmable Switch`);
|
|
397
407
|
|
|
398
408
|
// Initialize StatefulProgrammableSwitch Characteristics
|
|
@@ -403,7 +413,6 @@ export class Bot extends deviceBase {
|
|
|
403
413
|
return this.StatefulProgrammableSwitch!.On;
|
|
404
414
|
})
|
|
405
415
|
.onSet(this.OnSet.bind(this));
|
|
406
|
-
accessory.context.Name = this.StatefulProgrammableSwitch.Name;
|
|
407
416
|
|
|
408
417
|
// Remove other services
|
|
409
418
|
this.removeFanService(accessory);
|
|
@@ -417,11 +426,13 @@ export class Bot extends deviceBase {
|
|
|
417
426
|
this.removeWindowCoveringService(accessory);
|
|
418
427
|
} else {
|
|
419
428
|
// Initialize Switch property
|
|
429
|
+
accessory.context.Outlet = accessory.context.Outlet ?? {};
|
|
420
430
|
this.Outlet = {
|
|
421
|
-
Name: accessory.context.Name ?? accessory.displayName,
|
|
431
|
+
Name: accessory.context.Outlet.Name ?? accessory.displayName,
|
|
422
432
|
Service: accessory.getService(this.hap.Service.Outlet) ?? accessory.addService(this.hap.Service.Outlet) as Service,
|
|
423
433
|
On: accessory.context.On ?? false,
|
|
424
434
|
};
|
|
435
|
+
accessory.context.Outlet = this.Outlet as object;
|
|
425
436
|
this.debugWarnLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Outlet`);
|
|
426
437
|
|
|
427
438
|
// Initialize Outlet Characteristics
|
|
@@ -432,7 +443,6 @@ export class Bot extends deviceBase {
|
|
|
432
443
|
return this.Outlet!.On;
|
|
433
444
|
})
|
|
434
445
|
.onSet(this.OnSet.bind(this));
|
|
435
|
-
accessory.context.Name = this.Outlet.Name;
|
|
436
446
|
|
|
437
447
|
// Remove other services
|
|
438
448
|
this.removeFanService(accessory);
|
|
@@ -51,9 +51,10 @@ export class CeilingLight extends deviceBase {
|
|
|
51
51
|
this.doCeilingLightUpdate = new Subject();
|
|
52
52
|
this.ceilingLightUpdateInProgress = false;
|
|
53
53
|
|
|
54
|
-
// Initialize LightBulb
|
|
54
|
+
// Initialize LightBulb Service
|
|
55
|
+
accessory.context.LightBulb = accessory.context.LightBulb ?? {};
|
|
55
56
|
this.LightBulb = {
|
|
56
|
-
Name: accessory.context.
|
|
57
|
+
Name: accessory.context.LightBul.bName ?? accessory.displayName,
|
|
57
58
|
Service: accessory.getService(this.hap.Service.Lightbulb) ?? accessory.addService(this.hap.Service.Lightbulb) as Service,
|
|
58
59
|
On: accessory.context.On ?? false,
|
|
59
60
|
Hue: accessory.context.Hue ?? 0,
|
|
@@ -61,6 +62,7 @@ export class CeilingLight extends deviceBase {
|
|
|
61
62
|
Brightness: accessory.context.Brightness ?? 0,
|
|
62
63
|
ColorTemperature: accessory.context.ColorTemperature ?? 140,
|
|
63
64
|
};
|
|
65
|
+
accessory.context.LightBulb = this.LightBulb as object;
|
|
64
66
|
|
|
65
67
|
// Adaptive Lighting
|
|
66
68
|
if (this.adaptiveLightingShift === -1 && accessory.context.adaptiveLighting) {
|
|
@@ -141,7 +143,6 @@ export class CeilingLight extends deviceBase {
|
|
|
141
143
|
return this.LightBulb.Saturation;
|
|
142
144
|
})
|
|
143
145
|
.onSet(this.SaturationSet.bind(this));
|
|
144
|
-
accessory.context.LightBulbName = this.LightBulb.Name;
|
|
145
146
|
|
|
146
147
|
// Retrieve initial values and updateHomekit
|
|
147
148
|
this.refreshStatus();
|
package/src/device/colorbulb.ts
CHANGED
|
@@ -51,8 +51,8 @@ export class ColorBulb extends deviceBase {
|
|
|
51
51
|
this.doColorBulbUpdate = new Subject();
|
|
52
52
|
this.colorBulbUpdateInProgress = false;
|
|
53
53
|
|
|
54
|
-
accessory.context.LightBulb = accessory.context.LightBulb ?? {};
|
|
55
54
|
// Initialize LightBulb property
|
|
55
|
+
accessory.context.LightBulb = accessory.context.LightBulb ?? {};
|
|
56
56
|
this.LightBulb = {
|
|
57
57
|
Name: accessory.context.LightBulb.Name ?? accessory.displayName,
|
|
58
58
|
Service: accessory.getService(this.hap.Service.Lightbulb) ?? accessory.addService(this.hap.Service.Lightbulb) as Service,
|
|
@@ -140,7 +140,6 @@ export class ColorBulb extends deviceBase {
|
|
|
140
140
|
return this.LightBulb.Saturation;
|
|
141
141
|
})
|
|
142
142
|
.onSet(this.SaturationSet.bind(this));
|
|
143
|
-
accessory.context.LightBulb.Name = this.LightBulb.Name;
|
|
144
143
|
|
|
145
144
|
// Retrieve initial values and updateHomekit
|
|
146
145
|
this.refreshStatus();
|
package/src/device/contact.ts
CHANGED
|
@@ -57,12 +57,14 @@ export class Contact extends deviceBase {
|
|
|
57
57
|
this.doContactUpdate = new Subject();
|
|
58
58
|
this.contactUpdateInProgress = false;
|
|
59
59
|
|
|
60
|
-
// Initialize Contact Sensor
|
|
60
|
+
// Initialize Contact Sensor Service
|
|
61
|
+
accessory.context.ContactSensor = accessory.context.ContactSensor ?? {};
|
|
61
62
|
this.ContactSensor = {
|
|
62
|
-
Name: accessory.context.
|
|
63
|
+
Name: accessory.context.ContactSensor.Name ?? accessory.displayName,
|
|
63
64
|
Service: accessory.getService(this.hap.Service.ContactSensor) ?? accessory.addService(this.hap.Service.ContactSensor) as Service,
|
|
64
65
|
ContactSensorState: accessory.context.ContactSensorState ?? this.hap.Characteristic.ContactSensorState.CONTACT_DETECTED,
|
|
65
66
|
};
|
|
67
|
+
accessory.context.ContactSensor = this.ContactSensor as object;
|
|
66
68
|
|
|
67
69
|
// Initialize ContactSensor Characteristics
|
|
68
70
|
this.ContactSensor.Service
|
|
@@ -72,15 +74,16 @@ export class Contact extends deviceBase {
|
|
|
72
74
|
.onGet(() => {
|
|
73
75
|
return this.ContactSensor.ContactSensorState;
|
|
74
76
|
});
|
|
75
|
-
accessory.context.ContactSensorName = this.ContactSensor.Name;
|
|
76
77
|
|
|
77
|
-
// Initialize Battery
|
|
78
|
+
// Initialize Battery Service
|
|
79
|
+
accessory.context.Battery = accessory.context.Battery ?? {};
|
|
78
80
|
this.Battery = {
|
|
79
|
-
Name: accessory.context.
|
|
81
|
+
Name: accessory.context.Battery.Name ?? `${accessory.displayName} Battery`,
|
|
80
82
|
Service: accessory.getService(this.hap.Service.Battery) ?? accessory.addService(this.hap.Service.Battery) as Service,
|
|
81
83
|
BatteryLevel: accessory.context.BatteryLevel ?? 100,
|
|
82
84
|
StatusLowBattery: accessory.context.StatusLowBattery ?? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL,
|
|
83
85
|
};
|
|
86
|
+
accessory.context.Battery = this.Battery as object;
|
|
84
87
|
|
|
85
88
|
// Initialize Battery Characteristics
|
|
86
89
|
this.Battery.Service
|
|
@@ -97,7 +100,6 @@ export class Contact extends deviceBase {
|
|
|
97
100
|
.onGet(() => {
|
|
98
101
|
return this.Battery.StatusLowBattery;
|
|
99
102
|
});
|
|
100
|
-
accessory.context.BatteryName = this.Battery.Name;
|
|
101
103
|
|
|
102
104
|
// Initialize Motion Sensor Service
|
|
103
105
|
if (this.device.contact?.hide_motionsensor) {
|
|
@@ -105,11 +107,13 @@ export class Contact extends deviceBase {
|
|
|
105
107
|
this.MotionSensor!.Service = accessory.getService(this.hap.Service.MotionSensor) as Service;
|
|
106
108
|
accessory.removeService(this.MotionSensor!.Service);
|
|
107
109
|
} else {
|
|
110
|
+
accessory.context.MotionSensor = accessory.context.MotionSensor ?? {};
|
|
108
111
|
this.MotionSensor = {
|
|
109
|
-
Name: accessory.context.
|
|
112
|
+
Name: accessory.context.MotionSensor.Name ?? `${accessory.displayName} Motion Sensor`,
|
|
110
113
|
Service: accessory.getService(this.hap.Service.MotionSensor) ?? accessory.addService(this.hap.Service.MotionSensor) as Service,
|
|
111
114
|
MotionDetected: accessory.context.MotionDetected ?? false,
|
|
112
115
|
};
|
|
116
|
+
accessory.context.MotionSensor = this.MotionSensor as object;
|
|
113
117
|
|
|
114
118
|
// Motion Sensor Characteristics
|
|
115
119
|
this.MotionSensor.Service
|
|
@@ -119,7 +123,6 @@ export class Contact extends deviceBase {
|
|
|
119
123
|
.onGet(() => {
|
|
120
124
|
return this.MotionSensor!.MotionDetected;
|
|
121
125
|
});
|
|
122
|
-
accessory.context.MotionSensorName = this.MotionSensor.Name;
|
|
123
126
|
}
|
|
124
127
|
|
|
125
128
|
// Initialize Light Sensor Service
|
|
@@ -128,11 +131,13 @@ export class Contact extends deviceBase {
|
|
|
128
131
|
this.LightSensor!.Service = accessory.getService(this.hap.Service.LightSensor) as Service;
|
|
129
132
|
accessory.removeService(this.LightSensor!.Service);
|
|
130
133
|
} else {
|
|
134
|
+
accessory.context.LightSensor = accessory.context.LightSensor ?? {};
|
|
131
135
|
this.LightSensor = {
|
|
132
|
-
Name: accessory.context.
|
|
136
|
+
Name: accessory.context.LightSensor.Name ?? `${accessory.displayName} Light Sensor`,
|
|
133
137
|
Service: accessory.getService(this.hap.Service.LightSensor) ?? accessory.addService(this.hap.Service.LightSensor) as Service,
|
|
134
138
|
CurrentAmbientLightLevel: accessory.context.CurrentAmbientLightLevel ?? 0.0001,
|
|
135
139
|
};
|
|
140
|
+
accessory.context.LightSensor = this.LightSensor as object;
|
|
136
141
|
|
|
137
142
|
// Light Sensor Characteristics
|
|
138
143
|
this.LightSensor.Service
|
|
@@ -142,7 +147,6 @@ export class Contact extends deviceBase {
|
|
|
142
147
|
.onGet(() => {
|
|
143
148
|
return this.LightSensor!.CurrentAmbientLightLevel;
|
|
144
149
|
});
|
|
145
|
-
accessory.context.LightSensorName = this.LightSensor.Name;
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
// Retrieve initial values and updateHomekit
|
package/src/device/device.ts
CHANGED
|
@@ -549,19 +549,19 @@ export abstract class deviceBase {
|
|
|
549
549
|
} else if (device.firmware === undefined && device.version === undefined && accessory.context.version === undefined) {
|
|
550
550
|
device.version = this.platform.version;
|
|
551
551
|
accessory.context.version = this.platform.version;
|
|
552
|
-
} else {
|
|
552
|
+
} else if (accessory.context.device.version) {
|
|
553
|
+
accessory.context.version = accessory.context.device.version.replace(/^V|-.*$/g, '');
|
|
554
|
+
}else {
|
|
553
555
|
accessory.context.version = device.version?.replace(/^V|-.*$/g, '');
|
|
554
556
|
}
|
|
555
|
-
this.
|
|
556
|
-
|
|
557
|
-
this.
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
}
|
|
564
|
-
this.debugSuccessLog(`${this.device.deviceType}: ${this.accessory.displayName} Context: ${JSON.stringify(accessory.context)}`);
|
|
557
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Firmware Version: ${accessory.context.device.version}`);
|
|
558
|
+
this.accessory
|
|
559
|
+
.getService(this.hap.Service.AccessoryInformation)!
|
|
560
|
+
.setCharacteristic(this.hap.Characteristic.HardwareRevision, accessory.context.version)
|
|
561
|
+
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, accessory.context.version)
|
|
562
|
+
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
563
|
+
.updateValue(accessory.context.version);
|
|
564
|
+
this.debugSuccessLog(`${this.device.deviceType}: ${this.accessory.displayName} Context: ${JSON.stringify(accessory.context.device)}`);
|
|
565
565
|
}
|
|
566
566
|
|
|
567
567
|
async statusCode(statusCode: number): Promise<void> {
|
package/src/device/fan.ts
CHANGED
|
@@ -44,13 +44,15 @@ export class Fan extends deviceBase {
|
|
|
44
44
|
this.plugUpdateInProgress = false;
|
|
45
45
|
|
|
46
46
|
// Initialize Fan Service
|
|
47
|
+
accessory.context.Fan = accessory.context.Fan ?? {};
|
|
47
48
|
this.Fan = {
|
|
48
|
-
Name: accessory.context.
|
|
49
|
+
Name: accessory.context.Fan.Name ?? accessory.displayName,
|
|
49
50
|
Service: accessory.getService(this.hap.Service.Fanv2) ?? accessory.addService(this.hap.Service.Fanv2) as Service,
|
|
50
51
|
Active: accessory.context.Active ?? this.hap.Characteristic.Active.INACTIVE,
|
|
51
52
|
SwingMode: accessory.context.SwingMode ?? this.hap.Characteristic.SwingMode.SWING_DISABLED,
|
|
52
53
|
RotationSpeed: accessory.context.RotationSpeed ?? 0,
|
|
53
54
|
};
|
|
55
|
+
accessory.context.Fan = this.Fan as object;
|
|
54
56
|
|
|
55
57
|
// Initialize Fan Service
|
|
56
58
|
this.Fan.Service
|
|
@@ -75,16 +77,17 @@ export class Fan extends deviceBase {
|
|
|
75
77
|
return this.Fan.SwingMode;
|
|
76
78
|
})
|
|
77
79
|
.onSet(this.SwingModeSet.bind(this));
|
|
78
|
-
accessory.context.FanName = this.Fan.Name;
|
|
79
80
|
|
|
80
|
-
// Initialize Battery
|
|
81
|
+
// Initialize Battery Service
|
|
82
|
+
accessory.context.Battery = accessory.context.Battery ?? {};
|
|
81
83
|
this.Battery = {
|
|
82
|
-
Name: accessory.context.
|
|
84
|
+
Name: accessory.context.Battery.Name ?? accessory.displayName,
|
|
83
85
|
Service: accessory.getService(this.hap.Service.Battery) ?? accessory.addService(this.hap.Service.Battery) as Service,
|
|
84
86
|
BatteryLevel: accessory.context.BatteryLevel ?? 100,
|
|
85
87
|
StatusLowBattery: accessory.context.StatusLowBattery ?? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL,
|
|
86
88
|
ChargingState: accessory.context.ChargingState ?? this.hap.Characteristic.ChargingState.NOT_CHARGING,
|
|
87
89
|
};
|
|
90
|
+
accessory.context.Battery = this.Battery as object;
|
|
88
91
|
|
|
89
92
|
// Initialize Battery Service
|
|
90
93
|
this.Battery.Service
|
|
@@ -107,7 +110,6 @@ export class Fan extends deviceBase {
|
|
|
107
110
|
.onGet(() => {
|
|
108
111
|
return this.Battery.StatusLowBattery;
|
|
109
112
|
});
|
|
110
|
-
accessory.context.BatteryName = this.Battery.Name;
|
|
111
113
|
|
|
112
114
|
// Retrieve initial values and updateHomekit
|
|
113
115
|
this.refreshStatus();
|