@switchbot/homebridge-switchbot 3.5.0-beta.63 → 3.5.0-beta.65
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 +15 -9
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +37 -24
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +10 -6
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +7 -6
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +20 -13
- 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 +47 -18
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.d.ts.map +1 -1
- package/dist/device/fan.js +13 -8
- package/dist/device/fan.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 +12 -7
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +16 -9
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +9 -5
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +18 -11
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +14 -8
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +15 -9
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +15 -8
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +9 -5
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +12 -7
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +10 -5
- 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 +15 -9
- package/src/device/bot.ts +37 -24
- package/src/device/ceilinglight.ts +10 -6
- package/src/device/colorbulb.ts +7 -6
- package/src/device/contact.ts +20 -13
- package/src/device/curtain.ts +8 -7
- package/src/device/device.ts +44 -18
- package/src/device/fan.ts +13 -8
- package/src/device/hub.ts +15 -9
- package/src/device/humidifier.ts +12 -7
- package/src/device/iosensor.ts +17 -9
- package/src/device/lightstrip.ts +9 -5
- package/src/device/lock.ts +18 -11
- package/src/device/meter.ts +14 -8
- package/src/device/meterplus.ts +16 -9
- package/src/device/motion.ts +15 -8
- package/src/device/plug.ts +9 -5
- package/src/device/robotvacuumcleaner.ts +12 -7
- package/src/device/waterdetector.ts +10 -5
- 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
package/src/irdevice/fan.ts
CHANGED
|
@@ -33,11 +33,8 @@ export class IRFan extends irdeviceBase {
|
|
|
33
33
|
) {
|
|
34
34
|
super(platform, accessory, device);
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Initialize Switch property
|
|
36
|
+
// Initialize Switch Service
|
|
37
|
+
accessory.context.Fan = accessory.context.Fan ?? {};
|
|
41
38
|
this.Fan = {
|
|
42
39
|
Name: accessory.context.Fan.Name ?? `${accessory.displayName} Fan`,
|
|
43
40
|
Service: accessory.getService(this.hap.Service.Fanv2) ?? accessory.addService(this.hap.Service.Fanv2) as Service,
|
|
@@ -46,6 +43,7 @@ export class IRFan extends irdeviceBase {
|
|
|
46
43
|
RotationSpeed: accessory.context.RotationSpeed ?? 0,
|
|
47
44
|
RotationDirection: accessory.context.RotationDirection ?? this.hap.Characteristic.RotationDirection.CLOCKWISE,
|
|
48
45
|
};
|
|
46
|
+
accessory.context.Fan = this.Fan as object;
|
|
49
47
|
|
|
50
48
|
this.Fan.Service
|
|
51
49
|
.setCharacteristic(this.hap.Characteristic.Name, this.Fan.Name)
|
|
@@ -54,7 +52,6 @@ export class IRFan extends irdeviceBase {
|
|
|
54
52
|
return this.Fan.Active;
|
|
55
53
|
})
|
|
56
54
|
.onSet(this.ActiveSet.bind(this));
|
|
57
|
-
accessory.context.Fan.Name = this.Fan.Name;
|
|
58
55
|
|
|
59
56
|
if (device.irfan?.rotation_speed) {
|
|
60
57
|
// handle Rotation Speed events using the RotationSpeed characteristic
|
|
@@ -98,7 +95,6 @@ export class IRFan extends irdeviceBase {
|
|
|
98
95
|
`Clear Cache on ${this.accessory.displayName} To Remove Chracteristic`,
|
|
99
96
|
);
|
|
100
97
|
}
|
|
101
|
-
accessory.context.Fan.Name = this.Fan.Name;
|
|
102
98
|
}
|
|
103
99
|
|
|
104
100
|
async minStep(device: irdevice & irDevicesConfig): Promise<number> {
|
package/src/irdevice/light.ts
CHANGED
|
@@ -44,18 +44,15 @@ export class Light extends irdeviceBase {
|
|
|
44
44
|
) {
|
|
45
45
|
super(platform, accessory, device);
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
47
|
if (!device.irlight?.stateless) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
// Initialize LightBulb property
|
|
48
|
+
// Initialize LightBulb Service
|
|
49
|
+
accessory.context.LightBulb = accessory.context.LightBulb ?? {};
|
|
54
50
|
this.LightBulb = {
|
|
55
51
|
Name: accessory.context.LightBulb.Name ?? `${accessory.displayName} ${device.remoteType}`,
|
|
56
52
|
Service: accessory.getService(this.hap.Service.Lightbulb) ?? accessory.addService(this.hap.Service.Lightbulb) as Service,
|
|
57
53
|
On: accessory.context.On || false,
|
|
58
54
|
};
|
|
55
|
+
accessory.context.LightBulb = this.LightBulb as object;
|
|
59
56
|
|
|
60
57
|
this.LightBulb.Service
|
|
61
58
|
.setCharacteristic(this.hap.Characteristic.Name, this.LightBulb.Name)
|
|
@@ -64,12 +61,9 @@ export class Light extends irdeviceBase {
|
|
|
64
61
|
return this.LightBulb!.On;
|
|
65
62
|
})
|
|
66
63
|
.onSet(this.OnSet.bind(this));
|
|
67
|
-
accessory.context.LightBulb.Name = this.LightBulb.Name;
|
|
68
64
|
} else {
|
|
69
65
|
// Initialize ProgrammableSwitchOn Service
|
|
70
|
-
|
|
71
|
-
accessory.context.ProgrammableSwitchOn = {};
|
|
72
|
-
}
|
|
66
|
+
accessory.context.ProgrammableSwitchOn = accessory.context.ProgrammableSwitchOn ?? {};
|
|
73
67
|
this.ProgrammableSwitchOn = {
|
|
74
68
|
Name: accessory.context.ProgrammableSwitchOn.Name ?? `${accessory.displayName} ${device.remoteType} On`,
|
|
75
69
|
Service: accessory.getService(this.hap.Service.StatefulProgrammableSwitch)
|
|
@@ -77,6 +71,7 @@ export class Light extends irdeviceBase {
|
|
|
77
71
|
ProgrammableSwitchEvent: accessory.context.ProgrammableSwitchEvent ?? this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS,
|
|
78
72
|
ProgrammableSwitchOutputState: accessory.context.ProgrammableSwitchOutputState ?? 0,
|
|
79
73
|
};
|
|
74
|
+
accessory.context.ProgrammableSwitchOn = this.ProgrammableSwitchOn as object;
|
|
80
75
|
|
|
81
76
|
// Initialize ProgrammableSwitchOn Characteristics
|
|
82
77
|
this.ProgrammableSwitchOn?.Service
|
|
@@ -97,12 +92,9 @@ export class Light extends irdeviceBase {
|
|
|
97
92
|
return this.ProgrammableSwitchOn!.ProgrammableSwitchOutputState;
|
|
98
93
|
})
|
|
99
94
|
.onSet(this.ProgrammableSwitchOutputStateSetOn.bind(this));
|
|
100
|
-
accessory.context.ProgrammableSwitchOn.Name = this.ProgrammableSwitchOn.Name;
|
|
101
95
|
|
|
102
96
|
// Initialize ProgrammableSwitchOff Service
|
|
103
|
-
|
|
104
|
-
accessory.context.ProgrammableSwitchOff = {};
|
|
105
|
-
}
|
|
97
|
+
accessory.context.ProgrammableSwitchOff = accessory.context.ProgrammableSwitchOff ?? {};
|
|
106
98
|
this.ProgrammableSwitchOff = {
|
|
107
99
|
Name: accessory.context.ProgrammableSwitchOff.Name ?? `${accessory.displayName} ${device.remoteType} Off`,
|
|
108
100
|
Service: accessory.getService(this.hap.Service.StatefulProgrammableSwitch)
|
|
@@ -110,6 +102,7 @@ export class Light extends irdeviceBase {
|
|
|
110
102
|
ProgrammableSwitchEvent: accessory.context.ProgrammableSwitchEvent ?? this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS,
|
|
111
103
|
ProgrammableSwitchOutputState: accessory.context.ProgrammableSwitchOutputState ?? 0,
|
|
112
104
|
};
|
|
105
|
+
accessory.context.ProgrammableSwitchOff = this.ProgrammableSwitchOff as object;
|
|
113
106
|
|
|
114
107
|
// Initialize ProgrammableSwitchOff Characteristics
|
|
115
108
|
this.ProgrammableSwitchOff?.Service
|
|
@@ -130,7 +123,6 @@ export class Light extends irdeviceBase {
|
|
|
130
123
|
return this.ProgrammableSwitchOff!.ProgrammableSwitchOutputState;
|
|
131
124
|
})
|
|
132
125
|
.onSet(this.ProgrammableSwitchOutputStateSetOff.bind(this));
|
|
133
|
-
accessory.context.ProgrammableSwitchOff.Name = this.ProgrammableSwitchOff.Name;
|
|
134
126
|
}
|
|
135
127
|
|
|
136
128
|
}
|
package/src/irdevice/other.ts
CHANGED
|
@@ -93,14 +93,13 @@ export class Others extends irdeviceBase {
|
|
|
93
93
|
// deviceType
|
|
94
94
|
if (this.otherDeviceType === 'switch') {
|
|
95
95
|
// Initialize Switch Service
|
|
96
|
-
|
|
97
|
-
accessory.context.Switch = {};
|
|
98
|
-
}
|
|
96
|
+
accessory.context.Switch = accessory.context.Switch ?? {};
|
|
99
97
|
this.Switch = {
|
|
100
|
-
Name: accessory.context.Name ?? `${accessory.displayName} Switch`,
|
|
98
|
+
Name: accessory.context.Switch.Name ?? `${accessory.displayName} Switch`,
|
|
101
99
|
Service: accessory.getService(this.hap.Service.Switch) ?? accessory.addService(this.hap.Service.Switch) as Service,
|
|
102
100
|
On: accessory.context.On ?? false,
|
|
103
101
|
};
|
|
102
|
+
accessory.context.Switch = this.Switch as object;
|
|
104
103
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Switch`);
|
|
105
104
|
|
|
106
105
|
this.Switch.Service
|
|
@@ -110,7 +109,6 @@ export class Others extends irdeviceBase {
|
|
|
110
109
|
return this.Switch!.On;
|
|
111
110
|
})
|
|
112
111
|
.onSet(this.OnSet.bind(this));
|
|
113
|
-
accessory.context.Name = this.Switch.Name;
|
|
114
112
|
|
|
115
113
|
// Remove other services
|
|
116
114
|
this.removeFanService(accessory);
|
|
@@ -124,14 +122,13 @@ export class Others extends irdeviceBase {
|
|
|
124
122
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
125
123
|
} else if (this.otherDeviceType === 'garagedoor') {
|
|
126
124
|
// Initialize Garage Door Service
|
|
127
|
-
|
|
128
|
-
accessory.context.GarageDoor = {};
|
|
129
|
-
}
|
|
125
|
+
accessory.context.GarageDoor = accessory.context.GarageDoor ?? {};
|
|
130
126
|
this.GarageDoor = {
|
|
131
|
-
Name: accessory.context.Name ?? `${accessory.displayName} Garage Door`,
|
|
127
|
+
Name: accessory.context.GarageDoor.Name ?? `${accessory.displayName} Garage Door`,
|
|
132
128
|
Service: accessory.getService(this.hap.Service.GarageDoorOpener) ?? accessory.addService(this.hap.Service.GarageDoorOpener) as Service,
|
|
133
129
|
On: accessory.context.On ?? false,
|
|
134
130
|
};
|
|
131
|
+
accessory.context.GarageDoor = this.GarageDoor as object;
|
|
135
132
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Garage Door Opener`);
|
|
136
133
|
|
|
137
134
|
this.GarageDoor.Service
|
|
@@ -142,7 +139,6 @@ export class Others extends irdeviceBase {
|
|
|
142
139
|
return this.GarageDoor!.On;
|
|
143
140
|
})
|
|
144
141
|
.onSet(this.OnSet.bind(this));
|
|
145
|
-
accessory.context.Name = this.GarageDoor.Name;
|
|
146
142
|
|
|
147
143
|
// Remove other services
|
|
148
144
|
this.removeFanService(accessory);
|
|
@@ -156,14 +152,13 @@ export class Others extends irdeviceBase {
|
|
|
156
152
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
157
153
|
} else if (this.otherDeviceType === 'door') {
|
|
158
154
|
// Initialize Door Service
|
|
159
|
-
|
|
160
|
-
accessory.context.Door = {};
|
|
161
|
-
}
|
|
155
|
+
accessory.context.Door = accessory.context.Door ?? {};
|
|
162
156
|
this.Door = {
|
|
163
|
-
Name: accessory.context.Name ?? `${accessory.displayName} Door`,
|
|
157
|
+
Name: accessory.context.Door.Name ?? `${accessory.displayName} Door`,
|
|
164
158
|
Service: accessory.getService(this.hap.Service.Door) ?? accessory.addService(this.hap.Service.Door) as Service,
|
|
165
159
|
On: accessory.context.On ?? false,
|
|
166
160
|
};
|
|
161
|
+
accessory.context.Door = this.Door as object;
|
|
167
162
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Door`);
|
|
168
163
|
|
|
169
164
|
this.Door!.Service
|
|
@@ -180,7 +175,6 @@ export class Others extends irdeviceBase {
|
|
|
180
175
|
return this.GarageDoor!.On;
|
|
181
176
|
})
|
|
182
177
|
.onSet(this.OnSet.bind(this));
|
|
183
|
-
accessory.context.Name = this.Door.Name;
|
|
184
178
|
|
|
185
179
|
// Remove other services
|
|
186
180
|
this.removeFanService(accessory);
|
|
@@ -194,14 +188,13 @@ export class Others extends irdeviceBase {
|
|
|
194
188
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
195
189
|
} else if (this.otherDeviceType === 'window') {
|
|
196
190
|
// Initialize Window Service
|
|
197
|
-
|
|
198
|
-
accessory.context.Window = {};
|
|
199
|
-
}
|
|
191
|
+
accessory.context.Window = accessory.context.Window ?? {};
|
|
200
192
|
this.Window = {
|
|
201
|
-
Name: accessory.context.Name ?? `${accessory.displayName} Window`,
|
|
193
|
+
Name: accessory.context.Window.Name ?? `${accessory.displayName} Window`,
|
|
202
194
|
Service: accessory.getService(this.hap.Service.Window) ?? accessory.addService(this.hap.Service.Window) as Service,
|
|
203
195
|
On: accessory.context.On ?? false,
|
|
204
196
|
};
|
|
197
|
+
accessory.context.Window = this.Window as object;
|
|
205
198
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Window`);
|
|
206
199
|
|
|
207
200
|
this.Window!.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
@@ -217,7 +210,6 @@ export class Others extends irdeviceBase {
|
|
|
217
210
|
return this.GarageDoor!.On;
|
|
218
211
|
})
|
|
219
212
|
.onSet(this.OnSet.bind(this));
|
|
220
|
-
accessory.context.Name = this.Window.Name;
|
|
221
213
|
|
|
222
214
|
// Remove other services
|
|
223
215
|
this.removeFanService(accessory);
|
|
@@ -231,18 +223,18 @@ export class Others extends irdeviceBase {
|
|
|
231
223
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
232
224
|
} else if (this.otherDeviceType === 'windowcovering') {
|
|
233
225
|
// Initialize WindowCovering Service
|
|
234
|
-
|
|
235
|
-
accessory.context.WindowCovering = {};
|
|
236
|
-
}
|
|
226
|
+
accessory.context.WindowCovering = accessory.context.WindowCovering ?? {};
|
|
237
227
|
this.WindowCovering = {
|
|
238
|
-
Name: accessory.context.Name ?? `${accessory.displayName} Window Covering`,
|
|
228
|
+
Name: accessory.context.WindowCovering.Name ?? `${accessory.displayName} Window Covering`,
|
|
239
229
|
Service: accessory.getService(this.hap.Service.WindowCovering) ?? accessory.addService(this.hap.Service.WindowCovering) as Service,
|
|
240
230
|
On: accessory.context.On ?? false,
|
|
241
231
|
};
|
|
232
|
+
accessory.context.WindowCovering = this.WindowCovering as object;
|
|
242
233
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Window Covering`);
|
|
243
234
|
|
|
244
|
-
this.WindowCovering.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
|
|
245
235
|
this.WindowCovering.Service
|
|
236
|
+
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
237
|
+
.setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
|
|
246
238
|
.getCharacteristic(this.hap.Characteristic.TargetPosition)
|
|
247
239
|
.setProps({
|
|
248
240
|
validValues: [0, 100],
|
|
@@ -254,8 +246,6 @@ export class Others extends irdeviceBase {
|
|
|
254
246
|
return this.WindowCovering!.On;
|
|
255
247
|
})
|
|
256
248
|
.onSet(this.OnSet.bind(this));
|
|
257
|
-
this.WindowCovering.Service.setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
258
|
-
accessory.context.Name = this.WindowCovering.Name;
|
|
259
249
|
|
|
260
250
|
// Remove other services
|
|
261
251
|
this.removeFanService(accessory);
|
|
@@ -268,15 +258,14 @@ export class Others extends irdeviceBase {
|
|
|
268
258
|
this.removeGarageDoorService(accessory);
|
|
269
259
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
270
260
|
} else if (this.otherDeviceType === 'lock') {
|
|
271
|
-
// Initialize
|
|
272
|
-
|
|
273
|
-
accessory.context.LockMechanism = {};
|
|
274
|
-
}
|
|
261
|
+
// Initialize LockMechanism Service
|
|
262
|
+
accessory.context.LockMechanism = accessory.context.LockMechanism ?? {};
|
|
275
263
|
this.LockMechanism = {
|
|
276
|
-
Name: accessory.context.Name ?? `${accessory.displayName} Lock`,
|
|
264
|
+
Name: accessory.context.LockMechanism.Name ?? `${accessory.displayName} Lock`,
|
|
277
265
|
Service: accessory.getService(this.hap.Service.LockMechanism) ?? accessory.addService(this.hap.Service.LockMechanism) as Service,
|
|
278
266
|
On: accessory.context.On ?? false,
|
|
279
267
|
};
|
|
268
|
+
accessory.context.LockMechanism = this.LockMechanism as object;
|
|
280
269
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Lock`);
|
|
281
270
|
|
|
282
271
|
this.LockMechanism.Service
|
|
@@ -286,7 +275,6 @@ export class Others extends irdeviceBase {
|
|
|
286
275
|
return this.LockMechanism!.On;
|
|
287
276
|
})
|
|
288
277
|
.onSet(this.OnSet.bind(this));
|
|
289
|
-
accessory.context.Name = this.LockMechanism.Name;
|
|
290
278
|
|
|
291
279
|
// Remove other services
|
|
292
280
|
this.removeFanService(accessory);
|
|
@@ -300,14 +288,13 @@ export class Others extends irdeviceBase {
|
|
|
300
288
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
301
289
|
} else if (this.otherDeviceType === 'faucet') {
|
|
302
290
|
// Initialize Faucet Service
|
|
303
|
-
|
|
304
|
-
accessory.context.Faucet = {};
|
|
305
|
-
}
|
|
291
|
+
accessory.context.Faucet = accessory.context.Faucet ?? {};
|
|
306
292
|
this.Faucet = {
|
|
307
|
-
Name: accessory.context.Name ?? `${accessory.displayName} Faucet`,
|
|
293
|
+
Name: accessory.context.Faucet.Name ?? `${accessory.displayName} Faucet`,
|
|
308
294
|
Service: accessory.getService(this.hap.Service.Faucet) ?? accessory.addService(this.hap.Service.Faucet) as Service,
|
|
309
295
|
On: accessory.context.On ?? false,
|
|
310
296
|
};
|
|
297
|
+
accessory.context.Faucet = this.Faucet as object;
|
|
311
298
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Faucet`);
|
|
312
299
|
|
|
313
300
|
this.Faucet.Service
|
|
@@ -317,7 +304,6 @@ export class Others extends irdeviceBase {
|
|
|
317
304
|
return this.Faucet!.On;
|
|
318
305
|
})
|
|
319
306
|
.onSet(this.OnSet.bind(this));
|
|
320
|
-
accessory.context.Name = this.Faucet.Name;
|
|
321
307
|
|
|
322
308
|
// Remove other services
|
|
323
309
|
this.removeFanService(accessory);
|
|
@@ -331,14 +317,13 @@ export class Others extends irdeviceBase {
|
|
|
331
317
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
332
318
|
} else if (this.otherDeviceType === 'fan') {
|
|
333
319
|
// Initialize Fan Service
|
|
334
|
-
|
|
335
|
-
accessory.context.Fan = {};
|
|
336
|
-
}
|
|
320
|
+
accessory.context.Fan = accessory.context.Fan ?? {};
|
|
337
321
|
this.Fan = {
|
|
338
|
-
Name: accessory.context.Name ?? `${accessory.displayName} Fan`,
|
|
322
|
+
Name: accessory.context.Fan.Name ?? `${accessory.displayName} Fan`,
|
|
339
323
|
Service: accessory.getService(this.hap.Service.Fanv2) ?? accessory.addService(this.hap.Service.Fanv2) as Service,
|
|
340
324
|
On: accessory.context.On ?? false,
|
|
341
325
|
};
|
|
326
|
+
accessory.context.Fan = this.Fan as object;
|
|
342
327
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Fan`);
|
|
343
328
|
|
|
344
329
|
this.Fan.Service
|
|
@@ -348,7 +333,6 @@ export class Others extends irdeviceBase {
|
|
|
348
333
|
return this.Fan!.On;
|
|
349
334
|
})
|
|
350
335
|
.onSet(this.OnSet.bind(this));
|
|
351
|
-
accessory.context.Name = this.Fan.Name;
|
|
352
336
|
|
|
353
337
|
// Remove other services
|
|
354
338
|
this.removeLockService(accessory);
|
|
@@ -361,17 +345,15 @@ export class Others extends irdeviceBase {
|
|
|
361
345
|
this.removeWindowCoveringService(accessory);
|
|
362
346
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
363
347
|
} else if (this.otherDeviceType === 'stateful') {
|
|
364
|
-
// Initialize
|
|
365
|
-
|
|
366
|
-
accessory.context.StatefulProgrammableSwitch = {};
|
|
367
|
-
}
|
|
368
|
-
// Initialize StatefulProgrammableSwitch property
|
|
348
|
+
// Initialize StatefulProgrammableSwitch Service
|
|
349
|
+
accessory.context.StatefulProgrammableSwitch = accessory.context.StatefulProgrammableSwitch ?? {};
|
|
369
350
|
this.StatefulProgrammableSwitch = {
|
|
370
|
-
Name: accessory.context.Name ?? `${accessory.displayName} Stateful Programmable Switch`,
|
|
351
|
+
Name: accessory.context.StatefulProgrammableSwitch.Name ?? `${accessory.displayName} Stateful Programmable Switch`,
|
|
371
352
|
Service: accessory.getService(this.hap.Service.StatefulProgrammableSwitch)
|
|
372
353
|
?? accessory.addService(this.hap.Service.StatefulProgrammableSwitch) as Service,
|
|
373
354
|
On: accessory.context.On ?? false,
|
|
374
355
|
};
|
|
356
|
+
accessory.context.StatefulProgrammableSwitch = this.StatefulProgrammableSwitch as object;
|
|
375
357
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Stateful Programmable Switch`);
|
|
376
358
|
|
|
377
359
|
this.StatefulProgrammableSwitch.Service
|
|
@@ -381,7 +363,6 @@ export class Others extends irdeviceBase {
|
|
|
381
363
|
return this.StatefulProgrammableSwitch!.On;
|
|
382
364
|
})
|
|
383
365
|
.onSet(this.OnSet.bind(this));
|
|
384
|
-
accessory.context.Name = this.StatefulProgrammableSwitch.Name;
|
|
385
366
|
|
|
386
367
|
// Remove other services
|
|
387
368
|
this.removeFanService(accessory);
|
|
@@ -395,14 +376,13 @@ export class Others extends irdeviceBase {
|
|
|
395
376
|
this.removeWindowCoveringService(accessory);
|
|
396
377
|
} else {
|
|
397
378
|
// Initialize Outlet Service
|
|
398
|
-
|
|
399
|
-
accessory.context.Outlet = {};
|
|
400
|
-
}
|
|
379
|
+
accessory.context.Outlet = accessory.context.Outlet ?? {};
|
|
401
380
|
this.Outlet = {
|
|
402
|
-
Name: accessory.context.Name ?? `${accessory.displayName} Outlet`,
|
|
381
|
+
Name: accessory.context.Outlet.Name ?? `${accessory.displayName} Outlet`,
|
|
403
382
|
Service: accessory.getService(this.hap.Service.Outlet) ?? accessory.addService(this.hap.Service.Outlet) as Service,
|
|
404
383
|
On: accessory.context.On ?? false,
|
|
405
384
|
};
|
|
385
|
+
accessory.context.Outlet = this.Outlet as object;
|
|
406
386
|
this.debugWarnLog(`${this.device.remoteType}: ${accessory.displayName} Displaying as Outlet`);
|
|
407
387
|
|
|
408
388
|
this.Outlet.Service
|
|
@@ -412,7 +392,6 @@ export class Others extends irdeviceBase {
|
|
|
412
392
|
return this.Outlet!.On;
|
|
413
393
|
})
|
|
414
394
|
.onSet(this.OnSet.bind(this));
|
|
415
|
-
accessory.context.Name = this.Outlet.Name;
|
|
416
395
|
|
|
417
396
|
// Remove other services
|
|
418
397
|
this.removeFanService(accessory);
|
package/src/irdevice/tv.ts
CHANGED
|
@@ -45,9 +45,7 @@ export class TV extends irdeviceBase {
|
|
|
45
45
|
super(platform, accessory, device);
|
|
46
46
|
|
|
47
47
|
// Initialize Television Service
|
|
48
|
-
|
|
49
|
-
accessory.context.Television = {};
|
|
50
|
-
}
|
|
48
|
+
accessory.context.Television = accessory.context.Television ?? {};
|
|
51
49
|
this.Television = {
|
|
52
50
|
Name: accessory.context.Television.Name ?? `${accessory.displayName} ${device.remoteType}`,
|
|
53
51
|
ConfiguredName: accessory.context.Television.ConfiguredName ?? `${accessory.displayName} ${device.remoteType}`,
|
|
@@ -57,6 +55,7 @@ export class TV extends irdeviceBase {
|
|
|
57
55
|
SleepDiscoveryMode: accessory.context.SleepDiscoveryMode ?? this.hap.Characteristic.SleepDiscoveryMode.ALWAYS_DISCOVERABLE,
|
|
58
56
|
RemoteKey: accessory.context.RemoteKey ?? this.hap.Characteristic.RemoteKey.EXIT,
|
|
59
57
|
};
|
|
58
|
+
accessory.context.Television = this.Television as object;
|
|
60
59
|
|
|
61
60
|
switch (device.remoteType) {
|
|
62
61
|
case 'Speaker':
|
|
@@ -103,12 +102,9 @@ export class TV extends irdeviceBase {
|
|
|
103
102
|
return this.Television.RemoteKey;
|
|
104
103
|
})
|
|
105
104
|
.onSet(this.RemoteKeySet.bind(this));
|
|
106
|
-
accessory.context.Television.Name = this.Television.Name;
|
|
107
105
|
|
|
108
106
|
// Initialize TelevisionSpeaker Service
|
|
109
|
-
|
|
110
|
-
accessory.context.TelevisionSpeaker = {};
|
|
111
|
-
}
|
|
107
|
+
accessory.context.TelevisionSpeaker = accessory.context.TelevisionSpeaker ?? {};
|
|
112
108
|
this.TelevisionSpeaker = {
|
|
113
109
|
Name: accessory.context.TelevisionSpeaker.Name ?? `${accessory.displayName} ${device.remoteType} Speaker`,
|
|
114
110
|
Service: accessory.getService(this.hap.Service.TelevisionSpeaker) ?? accessory.addService(this.hap.Service.TelevisionSpeaker) as Service,
|
|
@@ -116,6 +112,7 @@ export class TV extends irdeviceBase {
|
|
|
116
112
|
VolumeControlType: accessory.context.VolumeControlType ?? this.hap.Characteristic.VolumeControlType.ABSOLUTE,
|
|
117
113
|
VolumeSelector: accessory.context.VolumeSelector ?? this.hap.Characteristic.VolumeSelector.INCREMENT,
|
|
118
114
|
};
|
|
115
|
+
accessory.context.TelevisionSpeaker = this.TelevisionSpeaker as object;
|
|
119
116
|
|
|
120
117
|
this.TelevisionSpeaker.Service
|
|
121
118
|
.setCharacteristic(this.hap.Characteristic.Name, this.TelevisionSpeaker.Name)
|
|
@@ -126,7 +123,6 @@ export class TV extends irdeviceBase {
|
|
|
126
123
|
return this.TelevisionSpeaker.VolumeSelector;
|
|
127
124
|
})
|
|
128
125
|
.onSet(this.VolumeSelectorSet.bind(this));
|
|
129
|
-
accessory.context.TelevisionSpeaker.Name = this.TelevisionSpeaker.Name;
|
|
130
126
|
}
|
|
131
127
|
|
|
132
128
|
async VolumeSelectorSet(value: CharacteristicValue): Promise<void> {
|
|
@@ -31,14 +31,13 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
31
31
|
super(platform, accessory, device);
|
|
32
32
|
|
|
33
33
|
// Initialize Switch Service
|
|
34
|
-
|
|
35
|
-
accessory.context.Switch = {};
|
|
36
|
-
}
|
|
34
|
+
accessory.context.Switch = accessory.context.Switch ?? {};
|
|
37
35
|
this.Switch = {
|
|
38
|
-
Name: accessory.context.Name ?? `${accessory.displayName} ${device.remoteType}`,
|
|
36
|
+
Name: accessory.context.Switch.Name ?? `${accessory.displayName} ${device.remoteType}`,
|
|
39
37
|
Service: accessory.getService(this.hap.Service.Switch) ?? accessory.addService(this.hap.Service.Switch) as Service,
|
|
40
38
|
On: accessory.context.On ?? false,
|
|
41
39
|
};
|
|
40
|
+
accessory.context.Switch = this.Switch as object;
|
|
42
41
|
|
|
43
42
|
this.Switch.Service
|
|
44
43
|
.setCharacteristic(this.hap.Characteristic.Name, this.Switch.Name)
|
|
@@ -47,7 +46,6 @@ export class VacuumCleaner extends irdeviceBase {
|
|
|
47
46
|
return this.Switch.On;
|
|
48
47
|
})
|
|
49
48
|
.onSet(this.OnSet.bind(this));
|
|
50
|
-
accessory.context.Switch.Name = this.Switch.Name;
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
async OnSet(value: CharacteristicValue): Promise<void> {
|
|
@@ -31,14 +31,13 @@ export class WaterHeater extends irdeviceBase {
|
|
|
31
31
|
super(platform, accessory, device);
|
|
32
32
|
|
|
33
33
|
// Initialize Switch Service
|
|
34
|
-
|
|
35
|
-
accessory.context.Valve = {};
|
|
36
|
-
}
|
|
34
|
+
accessory.context.Valve = accessory.context.Valve ?? {};
|
|
37
35
|
this.Valve = {
|
|
38
|
-
Name: accessory.context.Name ?? `${accessory.displayName} ${device.remoteType}`,
|
|
36
|
+
Name: accessory.context.Valve.Name ?? `${accessory.displayName} ${device.remoteType}`,
|
|
39
37
|
Service: accessory.getService(this.hap.Service.Valve) ?? accessory.addService(this.hap.Service.Valve) as Service,
|
|
40
38
|
Active: accessory.context.Active ?? this.hap.Characteristic.Active.INACTIVE,
|
|
41
39
|
};
|
|
40
|
+
accessory.context.Valve = this.Valve as object;
|
|
42
41
|
|
|
43
42
|
this.Valve.Service
|
|
44
43
|
.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
|
|
@@ -48,7 +47,6 @@ export class WaterHeater extends irdeviceBase {
|
|
|
48
47
|
return this.Valve.Active;
|
|
49
48
|
})
|
|
50
49
|
.onSet(this.ActiveSet.bind(this));
|
|
51
|
-
accessory.context.Valve.Name = this.Valve.Name;
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
async ActiveSet(value: CharacteristicValue): Promise<void> {
|