@switchbot/homebridge-switchbot 3.6.1-beta.0 → 3.6.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/config.schema.json +11 -0
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +36 -18
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +1 -2
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +186 -396
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +36 -19
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +36 -19
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +36 -19
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +37 -18
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.js +2 -2
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.d.ts.map +1 -1
- package/dist/device/fan.js +36 -19
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +36 -17
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +36 -17
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +36 -17
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +36 -17
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +37 -18
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +36 -17
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +36 -17
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +36 -17
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +37 -18
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +36 -17
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +36 -17
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/irdevice/other.d.ts +1 -0
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +186 -228
- package/dist/irdevice/other.js.map +1 -1
- package/dist/platform.d.ts +4 -0
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +32 -0
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +1 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/package.json +3 -3
- package/src/device/blindtilt.ts +33 -18
- package/src/device/bot.ts +179 -406
- package/src/device/ceilinglight.ts +33 -20
- package/src/device/colorbulb.ts +33 -20
- package/src/device/contact.ts +33 -20
- package/src/device/curtain.ts +34 -18
- package/src/device/device.ts +2 -2
- package/src/device/fan.ts +33 -20
- package/src/device/hub.ts +33 -17
- package/src/device/humidifier.ts +33 -17
- package/src/device/iosensor.ts +33 -17
- package/src/device/lightstrip.ts +33 -17
- package/src/device/lock.ts +34 -18
- package/src/device/meter.ts +33 -17
- package/src/device/meterplus.ts +33 -17
- package/src/device/motion.ts +33 -17
- package/src/device/plug.ts +34 -18
- package/src/device/robotvacuumcleaner.ts +33 -17
- package/src/device/waterdetector.ts +33 -17
- package/src/irdevice/other.ts +214 -283
- package/src/platform.ts +30 -0
- package/src/settings.ts +1 -0
package/dist/irdevice/other.js
CHANGED
|
@@ -21,32 +21,30 @@ export class Others extends irdeviceBase {
|
|
|
21
21
|
Fan;
|
|
22
22
|
StatefulProgrammableSwitch;
|
|
23
23
|
Outlet;
|
|
24
|
+
On;
|
|
24
25
|
// Config
|
|
25
26
|
otherDeviceType;
|
|
26
27
|
constructor(platform, accessory, device) {
|
|
27
28
|
super(platform, accessory, device);
|
|
28
29
|
this.platform = platform;
|
|
29
|
-
// Set category
|
|
30
|
-
accessory.category = 1 /* this.hap.Categories.OTHER */;
|
|
31
30
|
// default placeholders
|
|
32
31
|
this.getOtherConfigSettings(device);
|
|
33
32
|
// deviceType
|
|
34
33
|
if (this.otherDeviceType === 'switch') {
|
|
34
|
+
// Set category
|
|
35
|
+
accessory.category = 8 /* this.hap.Categories.SWITCH */;
|
|
35
36
|
// Initialize Switch Service
|
|
36
37
|
accessory.context.Switch = accessory.context.Switch ?? {};
|
|
37
38
|
this.Switch = {
|
|
38
|
-
Name: accessory.context.Switch.Name ??
|
|
39
|
+
Name: accessory.context.Switch.Name ?? accessory.displayName,
|
|
39
40
|
Service: accessory.getService(this.hap.Service.Switch) ?? accessory.addService(this.hap.Service.Switch),
|
|
40
|
-
On: accessory.context.On ?? false,
|
|
41
41
|
};
|
|
42
42
|
accessory.context.Switch = this.Switch;
|
|
43
|
-
this.
|
|
43
|
+
this.debugLog('Displaying as Switch');
|
|
44
|
+
// Initialize Switch Characteristics
|
|
44
45
|
this.Switch.Service
|
|
45
|
-
.setCharacteristic(this.hap.Characteristic.Name,
|
|
46
|
+
.setCharacteristic(this.hap.Characteristic.Name, this.Switch.Name)
|
|
46
47
|
.getCharacteristic(this.hap.Characteristic.On)
|
|
47
|
-
.onGet(() => {
|
|
48
|
-
return this.Switch.On;
|
|
49
|
-
})
|
|
50
48
|
.onSet(this.OnSet.bind(this));
|
|
51
49
|
// Remove other services
|
|
52
50
|
this.removeFanService(accessory);
|
|
@@ -60,21 +58,26 @@ export class Others extends irdeviceBase {
|
|
|
60
58
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
61
59
|
}
|
|
62
60
|
else if (this.otherDeviceType === 'garagedoor') {
|
|
63
|
-
//
|
|
61
|
+
// Set category
|
|
62
|
+
accessory.category = 4 /* this.hap.Categories.GARAGE_DOOR_OPENER */;
|
|
63
|
+
// Initialize GarageDoor Service
|
|
64
64
|
accessory.context.GarageDoor = accessory.context.GarageDoor ?? {};
|
|
65
65
|
this.GarageDoor = {
|
|
66
|
-
Name: accessory.context.GarageDoor.Name ??
|
|
66
|
+
Name: accessory.context.GarageDoor.Name ?? accessory.displayName,
|
|
67
67
|
Service: accessory.getService(this.hap.Service.GarageDoorOpener) ?? accessory.addService(this.hap.Service.GarageDoorOpener),
|
|
68
|
-
On: accessory.context.On ?? false,
|
|
69
68
|
};
|
|
70
69
|
accessory.context.GarageDoor = this.GarageDoor;
|
|
71
|
-
this.
|
|
70
|
+
this.debugLog('Displaying as Garage Door Opener');
|
|
71
|
+
// Initialize GarageDoor Characteristics
|
|
72
72
|
this.GarageDoor.Service
|
|
73
|
-
.setCharacteristic(this.hap.Characteristic.Name,
|
|
73
|
+
.setCharacteristic(this.hap.Characteristic.Name, this.GarageDoor.Name)
|
|
74
74
|
.setCharacteristic(this.hap.Characteristic.ObstructionDetected, false)
|
|
75
75
|
.getCharacteristic(this.hap.Characteristic.TargetDoorState)
|
|
76
|
-
.
|
|
77
|
-
|
|
76
|
+
.setProps({
|
|
77
|
+
validValues: [0, 100],
|
|
78
|
+
minValue: 0,
|
|
79
|
+
maxValue: 100,
|
|
80
|
+
minStep: 100,
|
|
78
81
|
})
|
|
79
82
|
.onSet(this.OnSet.bind(this));
|
|
80
83
|
// Remove other services
|
|
@@ -89,27 +92,25 @@ export class Others extends irdeviceBase {
|
|
|
89
92
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
90
93
|
}
|
|
91
94
|
else if (this.otherDeviceType === 'door') {
|
|
95
|
+
// Set category
|
|
96
|
+
accessory.category = 12 /* this.hap.Categories.DOOR */;
|
|
92
97
|
// Initialize Door Service
|
|
93
98
|
accessory.context.Door = accessory.context.Door ?? {};
|
|
94
99
|
this.Door = {
|
|
95
|
-
Name: accessory.context.Door.Name ??
|
|
100
|
+
Name: accessory.context.Door.Name ?? accessory.displayName,
|
|
96
101
|
Service: accessory.getService(this.hap.Service.Door) ?? accessory.addService(this.hap.Service.Door),
|
|
97
|
-
On: accessory.context.On ?? false,
|
|
98
102
|
};
|
|
99
103
|
accessory.context.Door = this.Door;
|
|
100
|
-
this.
|
|
104
|
+
this.debugLog('Displaying as Door');
|
|
105
|
+
// Initialize Door Characteristics
|
|
101
106
|
this.Door.Service
|
|
102
|
-
.setCharacteristic(this.hap.Characteristic.Name,
|
|
107
|
+
.setCharacteristic(this.hap.Characteristic.Name, this.Door.Name)
|
|
103
108
|
.setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
|
|
104
|
-
.getCharacteristic(this.hap.Characteristic.TargetPosition)
|
|
105
|
-
.setProps({
|
|
109
|
+
.getCharacteristic(this.hap.Characteristic.TargetPosition).setProps({
|
|
106
110
|
validValues: [0, 100],
|
|
107
111
|
minValue: 0,
|
|
108
112
|
maxValue: 100,
|
|
109
113
|
minStep: 100,
|
|
110
|
-
})
|
|
111
|
-
.onGet(() => {
|
|
112
|
-
return this.GarageDoor.On;
|
|
113
114
|
})
|
|
114
115
|
.onSet(this.OnSet.bind(this));
|
|
115
116
|
// Remove other services
|
|
@@ -124,26 +125,25 @@ export class Others extends irdeviceBase {
|
|
|
124
125
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
125
126
|
}
|
|
126
127
|
else if (this.otherDeviceType === 'window') {
|
|
128
|
+
// Set category
|
|
129
|
+
accessory.category = 13 /* this.hap.Categories.WINDOW */;
|
|
127
130
|
// Initialize Window Service
|
|
128
131
|
accessory.context.Window = accessory.context.Window ?? {};
|
|
129
132
|
this.Window = {
|
|
130
|
-
Name: accessory.context.Window.Name ??
|
|
133
|
+
Name: accessory.context.Window.Name ?? accessory.displayName,
|
|
131
134
|
Service: accessory.getService(this.hap.Service.Window) ?? accessory.addService(this.hap.Service.Window),
|
|
132
|
-
On: accessory.context.On ?? false,
|
|
133
135
|
};
|
|
134
136
|
accessory.context.Window = this.Window;
|
|
135
|
-
this.
|
|
136
|
-
|
|
137
|
+
this.debugLog('Displaying as Window');
|
|
138
|
+
// Initialize Window Characteristics
|
|
139
|
+
this.Window.Service
|
|
140
|
+
.setCharacteristic(this.hap.Characteristic.Name, this.Window.Name)
|
|
137
141
|
.setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
|
|
138
|
-
.getCharacteristic(this.hap.Characteristic.TargetPosition)
|
|
139
|
-
.setProps({
|
|
142
|
+
.getCharacteristic(this.hap.Characteristic.TargetPosition).setProps({
|
|
140
143
|
validValues: [0, 100],
|
|
141
144
|
minValue: 0,
|
|
142
145
|
maxValue: 100,
|
|
143
146
|
minStep: 100,
|
|
144
|
-
})
|
|
145
|
-
.onGet(() => {
|
|
146
|
-
return this.GarageDoor.On;
|
|
147
147
|
})
|
|
148
148
|
.onSet(this.OnSet.bind(this));
|
|
149
149
|
// Remove other services
|
|
@@ -158,17 +158,19 @@ export class Others extends irdeviceBase {
|
|
|
158
158
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
159
159
|
}
|
|
160
160
|
else if (this.otherDeviceType === 'windowcovering') {
|
|
161
|
+
// Set category
|
|
162
|
+
accessory.category = 14 /* this.hap.Categories.WINDOW_COVERING */;
|
|
161
163
|
// Initialize WindowCovering Service
|
|
162
164
|
accessory.context.WindowCovering = accessory.context.WindowCovering ?? {};
|
|
163
165
|
this.WindowCovering = {
|
|
164
|
-
Name: accessory.context.WindowCovering.Name ??
|
|
166
|
+
Name: accessory.context.WindowCovering.Name ?? accessory.displayName,
|
|
165
167
|
Service: accessory.getService(this.hap.Service.WindowCovering) ?? accessory.addService(this.hap.Service.WindowCovering),
|
|
166
|
-
On: accessory.context.On ?? false,
|
|
167
168
|
};
|
|
168
169
|
accessory.context.WindowCovering = this.WindowCovering;
|
|
169
|
-
this.
|
|
170
|
+
this.debugLog('Displaying as Window Covering');
|
|
171
|
+
// Initialize WindowCovering Characteristics
|
|
170
172
|
this.WindowCovering.Service
|
|
171
|
-
.setCharacteristic(this.hap.Characteristic.Name,
|
|
173
|
+
.setCharacteristic(this.hap.Characteristic.Name, this.WindowCovering.Name)
|
|
172
174
|
.setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
|
|
173
175
|
.getCharacteristic(this.hap.Characteristic.TargetPosition)
|
|
174
176
|
.setProps({
|
|
@@ -176,9 +178,6 @@ export class Others extends irdeviceBase {
|
|
|
176
178
|
minValue: 0,
|
|
177
179
|
maxValue: 100,
|
|
178
180
|
minStep: 100,
|
|
179
|
-
})
|
|
180
|
-
.onGet(() => {
|
|
181
|
-
return this.WindowCovering.On;
|
|
182
181
|
})
|
|
183
182
|
.onSet(this.OnSet.bind(this));
|
|
184
183
|
// Remove other services
|
|
@@ -193,21 +192,21 @@ export class Others extends irdeviceBase {
|
|
|
193
192
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
194
193
|
}
|
|
195
194
|
else if (this.otherDeviceType === 'lock') {
|
|
196
|
-
//
|
|
195
|
+
// Set category
|
|
196
|
+
accessory.category = 6 /* this.hap.Categories.DOOR_LOCK */;
|
|
197
|
+
// Initialize Lock Service
|
|
197
198
|
accessory.context.LockMechanism = accessory.context.LockMechanism ?? {};
|
|
198
199
|
this.LockMechanism = {
|
|
199
|
-
Name: accessory.context.LockMechanism.Name ??
|
|
200
|
+
Name: accessory.context.LockMechanism.Name ?? accessory.displayName,
|
|
200
201
|
Service: accessory.getService(this.hap.Service.LockMechanism) ?? accessory.addService(this.hap.Service.LockMechanism),
|
|
201
|
-
On: accessory.context.On ?? false,
|
|
202
202
|
};
|
|
203
203
|
accessory.context.LockMechanism = this.LockMechanism;
|
|
204
|
-
this.
|
|
204
|
+
this.debugLog('Displaying as Lock');
|
|
205
|
+
// Initialize Lock Characteristics
|
|
205
206
|
this.LockMechanism.Service
|
|
206
|
-
.setCharacteristic(this.hap.Characteristic.Name,
|
|
207
|
+
.setCharacteristic(this.hap.Characteristic.Name, this.LockMechanism.Name)
|
|
208
|
+
.setCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED)
|
|
207
209
|
.getCharacteristic(this.hap.Characteristic.LockTargetState)
|
|
208
|
-
.onGet(() => {
|
|
209
|
-
return this.LockMechanism.On;
|
|
210
|
-
})
|
|
211
210
|
.onSet(this.OnSet.bind(this));
|
|
212
211
|
// Remove other services
|
|
213
212
|
this.removeFanService(accessory);
|
|
@@ -221,21 +220,20 @@ export class Others extends irdeviceBase {
|
|
|
221
220
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
222
221
|
}
|
|
223
222
|
else if (this.otherDeviceType === 'faucet') {
|
|
223
|
+
// Set category
|
|
224
|
+
accessory.category = 29 /* this.hap.Categories.FAUCET */;
|
|
224
225
|
// Initialize Faucet Service
|
|
225
226
|
accessory.context.Faucet = accessory.context.Faucet ?? {};
|
|
226
227
|
this.Faucet = {
|
|
227
|
-
Name: accessory.context.Faucet.Name ??
|
|
228
|
+
Name: accessory.context.Faucet.Name ?? accessory.displayName,
|
|
228
229
|
Service: accessory.getService(this.hap.Service.Faucet) ?? accessory.addService(this.hap.Service.Faucet),
|
|
229
|
-
On: accessory.context.On ?? false,
|
|
230
230
|
};
|
|
231
231
|
accessory.context.Faucet = this.Faucet;
|
|
232
|
-
this.
|
|
232
|
+
this.debugLog('Displaying as Faucet');
|
|
233
|
+
// Initialize Faucet Characteristics
|
|
233
234
|
this.Faucet.Service
|
|
234
|
-
.setCharacteristic(this.hap.Characteristic.Name,
|
|
235
|
+
.setCharacteristic(this.hap.Characteristic.Name, this.Faucet.Name)
|
|
235
236
|
.getCharacteristic(this.hap.Characteristic.Active)
|
|
236
|
-
.onGet(() => {
|
|
237
|
-
return this.Faucet.On;
|
|
238
|
-
})
|
|
239
237
|
.onSet(this.OnSet.bind(this));
|
|
240
238
|
// Remove other services
|
|
241
239
|
this.removeFanService(accessory);
|
|
@@ -249,21 +247,20 @@ export class Others extends irdeviceBase {
|
|
|
249
247
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
250
248
|
}
|
|
251
249
|
else if (this.otherDeviceType === 'fan') {
|
|
250
|
+
// Set category
|
|
251
|
+
accessory.category = 3 /* this.hap.Categories.FAN */;
|
|
252
252
|
// Initialize Fan Service
|
|
253
253
|
accessory.context.Fan = accessory.context.Fan ?? {};
|
|
254
254
|
this.Fan = {
|
|
255
|
-
Name: accessory.context.Fan.Name ??
|
|
255
|
+
Name: accessory.context.Fan.Name ?? accessory.displayName,
|
|
256
256
|
Service: accessory.getService(this.hap.Service.Fanv2) ?? accessory.addService(this.hap.Service.Fanv2),
|
|
257
|
-
On: accessory.context.On ?? false,
|
|
258
257
|
};
|
|
259
258
|
accessory.context.Fan = this.Fan;
|
|
260
|
-
this.
|
|
259
|
+
this.debugLog('Displaying as Fan');
|
|
260
|
+
// Initialize Fan Characteristics
|
|
261
261
|
this.Fan.Service
|
|
262
|
-
.setCharacteristic(this.hap.Characteristic.Name,
|
|
263
|
-
.getCharacteristic(this.hap.Characteristic.
|
|
264
|
-
.onGet(() => {
|
|
265
|
-
return this.Fan.On;
|
|
266
|
-
})
|
|
262
|
+
.setCharacteristic(this.hap.Characteristic.Name, this.Fan.Name)
|
|
263
|
+
.getCharacteristic(this.hap.Characteristic.Active)
|
|
267
264
|
.onSet(this.OnSet.bind(this));
|
|
268
265
|
// Remove other services
|
|
269
266
|
this.removeLockService(accessory);
|
|
@@ -277,22 +274,21 @@ export class Others extends irdeviceBase {
|
|
|
277
274
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
278
275
|
}
|
|
279
276
|
else if (this.otherDeviceType === 'stateful') {
|
|
277
|
+
// Set category
|
|
278
|
+
accessory.category = 15 /* this.hap.Categories.PROGRAMMABLE_SWITCH */;
|
|
280
279
|
// Initialize StatefulProgrammableSwitch Service
|
|
281
280
|
accessory.context.StatefulProgrammableSwitch = accessory.context.StatefulProgrammableSwitch ?? {};
|
|
282
281
|
this.StatefulProgrammableSwitch = {
|
|
283
|
-
Name: accessory.context.StatefulProgrammableSwitch.Name ??
|
|
282
|
+
Name: accessory.context.StatefulProgrammableSwitch.Name ?? accessory.displayName,
|
|
284
283
|
Service: accessory.getService(this.hap.Service.StatefulProgrammableSwitch)
|
|
285
284
|
?? accessory.addService(this.hap.Service.StatefulProgrammableSwitch),
|
|
286
|
-
On: accessory.context.On ?? false,
|
|
287
285
|
};
|
|
288
286
|
accessory.context.StatefulProgrammableSwitch = this.StatefulProgrammableSwitch;
|
|
289
|
-
this.
|
|
287
|
+
this.debugLog('Displaying as Stateful Programmable Switch');
|
|
288
|
+
// Initialize StatefulProgrammableSwitch Characteristics
|
|
290
289
|
this.StatefulProgrammableSwitch.Service
|
|
291
|
-
.setCharacteristic(this.hap.Characteristic.Name,
|
|
290
|
+
.setCharacteristic(this.hap.Characteristic.Name, this.StatefulProgrammableSwitch.Name)
|
|
292
291
|
.getCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState)
|
|
293
|
-
.onGet(() => {
|
|
294
|
-
return this.StatefulProgrammableSwitch.On;
|
|
295
|
-
})
|
|
296
292
|
.onSet(this.OnSet.bind(this));
|
|
297
293
|
// Remove other services
|
|
298
294
|
this.removeFanService(accessory);
|
|
@@ -305,22 +301,21 @@ export class Others extends irdeviceBase {
|
|
|
305
301
|
this.removeGarageDoorService(accessory);
|
|
306
302
|
this.removeWindowCoveringService(accessory);
|
|
307
303
|
}
|
|
308
|
-
else {
|
|
309
|
-
//
|
|
304
|
+
else if (this.otherDeviceType === 'outlet') {
|
|
305
|
+
// Set category
|
|
306
|
+
accessory.category = 7 /* this.hap.Categories.OUTLET */;
|
|
307
|
+
// Initialize Switch property
|
|
310
308
|
accessory.context.Outlet = accessory.context.Outlet ?? {};
|
|
311
309
|
this.Outlet = {
|
|
312
|
-
Name: accessory.context.Outlet.Name ??
|
|
310
|
+
Name: accessory.context.Outlet.Name ?? accessory.displayName,
|
|
313
311
|
Service: accessory.getService(this.hap.Service.Outlet) ?? accessory.addService(this.hap.Service.Outlet),
|
|
314
|
-
On: accessory.context.On ?? false,
|
|
315
312
|
};
|
|
316
313
|
accessory.context.Outlet = this.Outlet;
|
|
317
|
-
this.
|
|
314
|
+
this.debugLog('Displaying as Outlet');
|
|
315
|
+
// Initialize Outlet Characteristics
|
|
318
316
|
this.Outlet.Service
|
|
319
|
-
.setCharacteristic(this.hap.Characteristic.Name,
|
|
317
|
+
.setCharacteristic(this.hap.Characteristic.Name, this.Outlet.Name)
|
|
320
318
|
.getCharacteristic(this.hap.Characteristic.On)
|
|
321
|
-
.onGet(() => {
|
|
322
|
-
return this.Outlet.On;
|
|
323
|
-
})
|
|
324
319
|
.onSet(this.OnSet.bind(this));
|
|
325
320
|
// Remove other services
|
|
326
321
|
this.removeFanService(accessory);
|
|
@@ -333,93 +328,74 @@ export class Others extends irdeviceBase {
|
|
|
333
328
|
this.removeWindowCoveringService(accessory);
|
|
334
329
|
this.removeStatefulProgrammableSwitchService(accessory);
|
|
335
330
|
}
|
|
331
|
+
else {
|
|
332
|
+
this.errorLog('Device Type not set');
|
|
333
|
+
}
|
|
336
334
|
}
|
|
337
335
|
/**
|
|
338
336
|
* Handle requests to set the "On" characteristic
|
|
339
337
|
*/
|
|
340
338
|
async OnSet(value) {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
this.GarageDoor.On = false;
|
|
339
|
+
if (this.otherDeviceType === 'switch') {
|
|
340
|
+
if (this.Switch) {
|
|
341
|
+
await this.debugLog(`Set On: ${value}`);
|
|
342
|
+
this.On = value === false ? false : true;
|
|
346
343
|
}
|
|
347
|
-
|
|
348
|
-
|
|
344
|
+
}
|
|
345
|
+
else if (this.otherDeviceType === 'garagedoor') {
|
|
346
|
+
if (this.GarageDoor) {
|
|
347
|
+
await this.debugLog(`Set TargetDoorState: ${value}`);
|
|
348
|
+
this.On = value === this.hap.Characteristic.TargetDoorState.CLOSED ? false : true;
|
|
349
349
|
}
|
|
350
|
-
On = this.GarageDoor.On;
|
|
351
350
|
}
|
|
352
351
|
else if (this.otherDeviceType === 'door') {
|
|
353
|
-
this.
|
|
354
|
-
|
|
355
|
-
this.
|
|
356
|
-
}
|
|
357
|
-
else {
|
|
358
|
-
this.Door.On = true;
|
|
352
|
+
if (this.Door) {
|
|
353
|
+
await this.debugLog(`Set TargetPosition: ${value}`);
|
|
354
|
+
this.On = value === 0 ? false : true;
|
|
359
355
|
}
|
|
360
|
-
On = this.Door.On;
|
|
361
356
|
}
|
|
362
357
|
else if (this.otherDeviceType === 'window') {
|
|
363
|
-
this.
|
|
364
|
-
|
|
365
|
-
this.
|
|
366
|
-
}
|
|
367
|
-
else {
|
|
368
|
-
this.Window.On = true;
|
|
358
|
+
if (this.Window) {
|
|
359
|
+
await this.debugLog(`Set TargetPosition: ${value}`);
|
|
360
|
+
this.On = value === 0 ? false : true;
|
|
369
361
|
}
|
|
370
|
-
On = this.Window.On;
|
|
371
362
|
}
|
|
372
363
|
else if (this.otherDeviceType === 'windowcovering') {
|
|
373
|
-
this.
|
|
374
|
-
|
|
375
|
-
this.
|
|
376
|
-
}
|
|
377
|
-
else {
|
|
378
|
-
this.WindowCovering.On = true;
|
|
364
|
+
if (this.WindowCovering) {
|
|
365
|
+
await this.debugLog(`Set TargetPosition: ${value}`);
|
|
366
|
+
this.On = value === 0 ? false : true;
|
|
379
367
|
}
|
|
380
|
-
On = this.WindowCovering.On;
|
|
381
368
|
}
|
|
382
369
|
else if (this.otherDeviceType === 'lock') {
|
|
383
|
-
this.
|
|
384
|
-
|
|
385
|
-
this.
|
|
386
|
-
}
|
|
387
|
-
else {
|
|
388
|
-
this.LockMechanism.On = true;
|
|
370
|
+
if (this.LockMechanism) {
|
|
371
|
+
await this.debugLog(`Set LockTargetState: ${value}`);
|
|
372
|
+
this.On = value === this.hap.Characteristic.LockTargetState.SECURED ? false : true;
|
|
389
373
|
}
|
|
390
|
-
On = this.LockMechanism.On;
|
|
391
374
|
}
|
|
392
375
|
else if (this.otherDeviceType === 'faucet') {
|
|
393
|
-
this.
|
|
394
|
-
|
|
395
|
-
this.
|
|
396
|
-
}
|
|
397
|
-
else {
|
|
398
|
-
this.Faucet.On = true;
|
|
376
|
+
if (this.Faucet) {
|
|
377
|
+
await this.debugLog(`Set Active: ${value}`);
|
|
378
|
+
this.On = value === this.hap.Characteristic.Active.INACTIVE ? false : true;
|
|
399
379
|
}
|
|
400
|
-
On = this.Faucet.On;
|
|
401
380
|
}
|
|
402
381
|
else if (this.otherDeviceType === 'stateful') {
|
|
403
|
-
this.
|
|
404
|
-
|
|
405
|
-
this.
|
|
406
|
-
}
|
|
407
|
-
else {
|
|
408
|
-
this.StatefulProgrammableSwitch.On = true;
|
|
382
|
+
if (this.StatefulProgrammableSwitch) {
|
|
383
|
+
await this.debugLog(`Set ProgrammableSwitchOutputState: ${value}`);
|
|
384
|
+
this.On = value === 0 ? false : true;
|
|
409
385
|
}
|
|
410
|
-
On = this.StatefulProgrammableSwitch.On;
|
|
411
386
|
}
|
|
412
387
|
else {
|
|
413
|
-
this.
|
|
414
|
-
|
|
415
|
-
|
|
388
|
+
if (this.Outlet) {
|
|
389
|
+
await this.debugLog(`Set On: ${value}`);
|
|
390
|
+
this.On = value === false ? false : true;
|
|
391
|
+
}
|
|
416
392
|
}
|
|
417
393
|
//pushChanges
|
|
418
|
-
if (On === true) {
|
|
419
|
-
await this.pushOnChanges(On);
|
|
394
|
+
if (this.On === true) {
|
|
395
|
+
await this.pushOnChanges(this.On);
|
|
420
396
|
}
|
|
421
397
|
else {
|
|
422
|
-
await this.pushOffChanges(On);
|
|
398
|
+
await this.pushOffChanges(this.On);
|
|
423
399
|
}
|
|
424
400
|
}
|
|
425
401
|
/**
|
|
@@ -498,181 +474,173 @@ export class Others extends irdeviceBase {
|
|
|
498
474
|
}
|
|
499
475
|
async updateHomeKitCharacteristics() {
|
|
500
476
|
await this.debugLog('updateHomeKitCharacteristics');
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
477
|
+
// State
|
|
478
|
+
if (this.otherDeviceType === 'switch' && this.Switch) {
|
|
479
|
+
if (this.On === undefined) {
|
|
480
|
+
await this.debugLog(`On: ${this.On}`);
|
|
481
|
+
}
|
|
482
|
+
else {
|
|
483
|
+
this.Switch.Service.updateCharacteristic(this.hap.Characteristic.On, this.On);
|
|
484
|
+
await this.debugLog(`updateCharacteristic On: ${this.On}`);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
else if (this.otherDeviceType === 'garagedoor' && this.GarageDoor) {
|
|
488
|
+
if (this.On === undefined) {
|
|
489
|
+
await this.debugLog(`On: ${this.On}`);
|
|
504
490
|
}
|
|
505
491
|
else {
|
|
506
|
-
if (this.
|
|
492
|
+
if (this.On) {
|
|
507
493
|
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, this.hap.Characteristic.TargetDoorState.OPEN);
|
|
508
494
|
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, this.hap.Characteristic.CurrentDoorState.OPEN);
|
|
509
|
-
await this.debugLog(
|
|
510
|
-
+ ` TargetDoorState: Open, CurrentDoorState: Open (${this.GarageDoor.On})`);
|
|
495
|
+
await this.debugLog(`updateCharacteristic TargetDoorState: Open, CurrentDoorState: Open (${this.On})`);
|
|
511
496
|
}
|
|
512
497
|
else {
|
|
513
498
|
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.TargetDoorState, this.hap.Characteristic.TargetDoorState.CLOSED);
|
|
514
499
|
this.GarageDoor.Service.updateCharacteristic(this.hap.Characteristic.CurrentDoorState, this.hap.Characteristic.CurrentDoorState.CLOSED);
|
|
515
|
-
await this.debugLog(
|
|
516
|
-
+ ` TargetDoorState: Closed, CurrentDoorState: Closed (${this.GarageDoor.On})`);
|
|
500
|
+
await this.debugLog(`updateCharacteristicc TargetDoorState: Closed, CurrentDoorState: Closed (${this.On})`);
|
|
517
501
|
}
|
|
518
502
|
}
|
|
519
|
-
await this.debugLog(`Garage Door On: ${this.
|
|
503
|
+
await this.debugLog(`Garage Door On: ${this.On}`);
|
|
520
504
|
}
|
|
521
|
-
else if (this.otherDeviceType === 'door') {
|
|
522
|
-
if (this.
|
|
523
|
-
await this.debugLog(`On: ${this.
|
|
505
|
+
else if (this.otherDeviceType === 'door' && this.Door) {
|
|
506
|
+
if (this.On === undefined) {
|
|
507
|
+
await this.debugLog(`On: ${this.On}`);
|
|
524
508
|
}
|
|
525
509
|
else {
|
|
526
|
-
if (this.
|
|
510
|
+
if (this.On) {
|
|
527
511
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
|
|
528
512
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
|
|
529
513
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
530
|
-
await this.debugLog(
|
|
531
|
-
+ ` TargetPosition: 100, CurrentPosition: 100 (${this.Door.On})`);
|
|
514
|
+
await this.debugLog(`updateCharacteristicc TargetPosition: 100, CurrentPosition: 100 (${this.On})`);
|
|
532
515
|
}
|
|
533
516
|
else {
|
|
534
517
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
|
|
535
518
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
|
|
536
519
|
this.Door.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
537
|
-
await this.debugLog(
|
|
538
|
-
+ ` TargetPosition: 0, CurrentPosition: 0 (${this.Door.On})`);
|
|
520
|
+
await this.debugLog(`updateCharacteristicc TargetPosition: 0, CurrentPosition: 0 (${this.On})`);
|
|
539
521
|
}
|
|
540
522
|
}
|
|
541
|
-
await this.debugLog(`Door On: ${this.
|
|
523
|
+
await this.debugLog(`Door On: ${this.On}`);
|
|
542
524
|
}
|
|
543
|
-
else if (this.otherDeviceType === 'window') {
|
|
544
|
-
if (this.
|
|
545
|
-
await this.debugLog(`On: ${this.
|
|
525
|
+
else if (this.otherDeviceType === 'window' && this.Window) {
|
|
526
|
+
if (this.On === undefined) {
|
|
527
|
+
await this.debugLog(`On: ${this.On}`);
|
|
546
528
|
}
|
|
547
529
|
else {
|
|
548
|
-
if (this.
|
|
530
|
+
if (this.On) {
|
|
549
531
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
|
|
550
532
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
|
|
551
533
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
552
|
-
await this.debugLog(
|
|
553
|
-
+ ` TargetPosition: 100, CurrentPosition: 100 (${this.Window.On})`);
|
|
534
|
+
await this.debugLog(`updateCharacteristicc TargetPosition: 100, CurrentPosition: 100 (${this.On})`);
|
|
554
535
|
}
|
|
555
536
|
else {
|
|
556
537
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
|
|
557
538
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
|
|
558
539
|
this.Window.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
559
|
-
await this.debugLog(
|
|
560
|
-
+ ` TargetPosition: 0, CurrentPosition: 0 (${this.Window.On})`);
|
|
540
|
+
await this.debugLog(`updateCharacteristicc TargetPosition: 0, CurrentPosition: 0 (${this.On})`);
|
|
561
541
|
}
|
|
562
542
|
}
|
|
563
|
-
await this.debugLog(`Window On: ${this.
|
|
543
|
+
await this.debugLog(`Window On: ${this.On}`);
|
|
564
544
|
}
|
|
565
|
-
else if (this.otherDeviceType === 'windowcovering') {
|
|
566
|
-
if (this.
|
|
567
|
-
await this.debugLog(`On: ${this.
|
|
545
|
+
else if (this.otherDeviceType === 'windowcovering' && this.WindowCovering) {
|
|
546
|
+
if (this.On === undefined) {
|
|
547
|
+
await this.debugLog(`On: ${this.On}`);
|
|
568
548
|
}
|
|
569
549
|
else {
|
|
570
|
-
if (this.
|
|
550
|
+
if (this.On) {
|
|
571
551
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 100);
|
|
572
552
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 100);
|
|
573
553
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
574
|
-
await this.debugLog(
|
|
575
|
-
+ ` TargetPosition: 100, CurrentPosition: 100 (${this.WindowCovering.On})`);
|
|
554
|
+
await this.debugLog(`updateCharacteristicc TargetPosition: 100, CurrentPosition: 100 (${this.On})`);
|
|
576
555
|
}
|
|
577
556
|
else {
|
|
578
557
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.TargetPosition, 0);
|
|
579
558
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.CurrentPosition, 0);
|
|
580
559
|
this.WindowCovering.Service.updateCharacteristic(this.hap.Characteristic.PositionState, this.hap.Characteristic.PositionState.STOPPED);
|
|
581
|
-
await this.debugLog(
|
|
582
|
-
+ ` TargetPosition: 0, CurrentPosition: 0 (${this.WindowCovering.On})`);
|
|
560
|
+
await this.debugLog(`updateCharacteristicc TargetPosition: 0, CurrentPosition: 0 (${this.On})`);
|
|
583
561
|
}
|
|
584
562
|
}
|
|
585
|
-
await this.debugLog(`Window Covering On: ${this.
|
|
563
|
+
await this.debugLog(`Window Covering On: ${this.On}`);
|
|
586
564
|
}
|
|
587
|
-
else if (this.otherDeviceType === 'lock') {
|
|
588
|
-
if (this.
|
|
589
|
-
await this.debugLog(`On: ${this.
|
|
565
|
+
else if (this.otherDeviceType === 'lock' && this.LockMechanism) {
|
|
566
|
+
if (this.On === undefined) {
|
|
567
|
+
await this.debugLog(`On: ${this.On}`);
|
|
590
568
|
}
|
|
591
569
|
else {
|
|
592
|
-
if (this.
|
|
570
|
+
if (this.On) {
|
|
593
571
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState, this.hap.Characteristic.LockTargetState.UNSECURED);
|
|
594
572
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState, this.hap.Characteristic.LockCurrentState.UNSECURED);
|
|
595
|
-
await this.debugLog(
|
|
596
|
-
+ ` LockTargetState: UNSECURED, LockCurrentState: UNSECURE (${this.LockMechanism.On})`);
|
|
573
|
+
await this.debugLog(`updateCharacteristicc LockTargetState: UNSECURED, LockCurrentState: UNSECURED (${this.On})`);
|
|
597
574
|
}
|
|
598
575
|
else {
|
|
599
576
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockTargetState, this.hap.Characteristic.LockTargetState.SECURED);
|
|
600
577
|
this.LockMechanism.Service.updateCharacteristic(this.hap.Characteristic.LockCurrentState, this.hap.Characteristic.LockCurrentState.SECURED);
|
|
601
|
-
await this.debugLog(
|
|
602
|
-
+ ` LockTargetState: SECURED, LockCurrentState: SECURED (${this.LockMechanism.On})`);
|
|
578
|
+
await this.debugLog(`updateCharacteristic LockTargetState: SECURED, LockCurrentState: SECURED (${this.On})`);
|
|
603
579
|
}
|
|
604
580
|
}
|
|
605
|
-
await this.debugLog(`Lock On: ${this.
|
|
581
|
+
await this.debugLog(`Lock On: ${this.On}`);
|
|
606
582
|
}
|
|
607
|
-
else if (this.otherDeviceType === 'faucet') {
|
|
608
|
-
if (this.
|
|
609
|
-
await this.debugLog(`On: ${this.
|
|
583
|
+
else if (this.otherDeviceType === 'faucet' && this.Faucet) {
|
|
584
|
+
if (this.On === undefined) {
|
|
585
|
+
await this.debugLog(`On: ${this.On}`);
|
|
610
586
|
}
|
|
611
587
|
else {
|
|
612
|
-
if (this.
|
|
588
|
+
if (this.On) {
|
|
613
589
|
this.Faucet.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.ACTIVE);
|
|
614
|
-
await this.debugLog(`updateCharacteristic Active: ${this.
|
|
590
|
+
await this.debugLog(`updateCharacteristic Active: ${this.On}`);
|
|
615
591
|
}
|
|
616
592
|
else {
|
|
617
593
|
this.Faucet.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.INACTIVE);
|
|
618
|
-
await this.debugLog(`updateCharacteristic Active: ${this.
|
|
594
|
+
await this.debugLog(`updateCharacteristic Active: ${this.On}`);
|
|
619
595
|
}
|
|
620
596
|
}
|
|
621
|
-
await this.debugLog(`Faucet On: ${this.
|
|
597
|
+
await this.debugLog(`Faucet On: ${this.On}`);
|
|
622
598
|
}
|
|
623
|
-
else if (this.otherDeviceType === 'fan') {
|
|
624
|
-
if (this.
|
|
625
|
-
await this.debugLog(`On: ${this.
|
|
599
|
+
else if (this.otherDeviceType === 'fan' && this.Fan) {
|
|
600
|
+
if (this.On === undefined) {
|
|
601
|
+
await this.debugLog(`On: ${this.On}`);
|
|
626
602
|
}
|
|
627
603
|
else {
|
|
628
|
-
if (this.
|
|
629
|
-
this.Fan.Service.updateCharacteristic(this.hap.Characteristic.
|
|
630
|
-
await this.debugLog(`updateCharacteristic
|
|
604
|
+
if (this.On) {
|
|
605
|
+
this.Fan.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.ACTIVE);
|
|
606
|
+
await this.debugLog(`updateCharacteristic Active: ${this.On}`);
|
|
631
607
|
}
|
|
632
608
|
else {
|
|
633
|
-
this.Fan.Service.updateCharacteristic(this.hap.Characteristic.
|
|
634
|
-
await this.debugLog(`updateCharacteristic
|
|
609
|
+
this.Fan.Service.updateCharacteristic(this.hap.Characteristic.Active, this.hap.Characteristic.Active.INACTIVE);
|
|
610
|
+
await this.debugLog(`updateCharacteristic Active: ${this.On}`);
|
|
635
611
|
}
|
|
636
612
|
}
|
|
637
|
-
await this.debugLog(`Fan On: ${this.
|
|
613
|
+
await this.debugLog(`Fan On: ${this.On}`);
|
|
638
614
|
}
|
|
639
|
-
else if (this.otherDeviceType === 'stateful') {
|
|
640
|
-
if (this.
|
|
641
|
-
await this.debugLog(`On: ${this.
|
|
615
|
+
else if (this.otherDeviceType === 'stateful' && this.StatefulProgrammableSwitch) {
|
|
616
|
+
if (this.On === undefined) {
|
|
617
|
+
await this.debugLog(`On: ${this.On}`);
|
|
642
618
|
}
|
|
643
619
|
else {
|
|
644
|
-
if (this.
|
|
620
|
+
if (this.On) {
|
|
645
621
|
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent, this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);
|
|
646
622
|
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, 1);
|
|
647
|
-
await this.debugLog(
|
|
648
|
-
+ ` ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 1 (${this.StatefulProgrammableSwitch.On})`);
|
|
623
|
+
await this.debugLog(`updateCharacteristic ProgrammableSwitchEvent: ProgrammableSwitchOutputState: (${this.On})`);
|
|
649
624
|
}
|
|
650
625
|
else {
|
|
651
626
|
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent, this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);
|
|
652
627
|
this.StatefulProgrammableSwitch.Service.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, 0);
|
|
653
|
-
await this.debugLog(
|
|
654
|
-
+ ` ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 0 (${this.StatefulProgrammableSwitch.On})`);
|
|
628
|
+
await this.debugLog(`updateCharacteristic ProgrammableSwitchEvent: ProgrammableSwitchOutputState: (${this.On})`);
|
|
655
629
|
}
|
|
656
630
|
}
|
|
657
|
-
await this.debugLog(`StatefulProgrammableSwitch On: ${this.
|
|
631
|
+
await this.debugLog(`StatefulProgrammableSwitch On: ${this.On}`);
|
|
658
632
|
}
|
|
659
|
-
else if (this.otherDeviceType === '
|
|
660
|
-
if (this.
|
|
661
|
-
await this.debugLog(`On: ${this.
|
|
633
|
+
else if (this.otherDeviceType === 'outlet' && this.Outlet) {
|
|
634
|
+
if (this.On === undefined) {
|
|
635
|
+
await this.debugLog(`On: ${this.On}`);
|
|
662
636
|
}
|
|
663
637
|
else {
|
|
664
|
-
this.
|
|
665
|
-
await this.debugLog(`updateCharacteristic On: ${this.
|
|
638
|
+
this.Outlet.Service.updateCharacteristic(this.hap.Characteristic.On, this.On);
|
|
639
|
+
await this.debugLog(`updateCharacteristic On: ${this.On}`);
|
|
666
640
|
}
|
|
667
641
|
}
|
|
668
642
|
else {
|
|
669
|
-
|
|
670
|
-
await this.debugLog(`On: ${this.Outlet.On}`);
|
|
671
|
-
}
|
|
672
|
-
else {
|
|
673
|
-
this.Outlet.Service.updateCharacteristic(this.hap.Characteristic.On, this.Outlet.On);
|
|
674
|
-
await this.debugLog(`updateCharacteristic On: ${this.Outlet.On}`);
|
|
675
|
-
}
|
|
643
|
+
await this.errorLog(`otherDeviceType: ${this.otherDeviceType}, On: ${this.On}`);
|
|
676
644
|
}
|
|
677
645
|
}
|
|
678
646
|
async apiError(e) {
|
|
@@ -743,7 +711,6 @@ export class Others extends irdeviceBase {
|
|
|
743
711
|
this.Outlet = {
|
|
744
712
|
Name: accessory.context.Outlet.Name ?? `${accessory.displayName} Outlet`,
|
|
745
713
|
Service: accessory.getService(this.hap.Service.Outlet),
|
|
746
|
-
On: accessory.context.On ?? false,
|
|
747
714
|
};
|
|
748
715
|
accessory.context.Outlet = this.Outlet;
|
|
749
716
|
this.warnLog('Removing any leftover Outlet Service');
|
|
@@ -755,7 +722,6 @@ export class Others extends irdeviceBase {
|
|
|
755
722
|
this.GarageDoor = {
|
|
756
723
|
Name: accessory.context.GarageDoor.Name ?? `${accessory.displayName} Garage Door`,
|
|
757
724
|
Service: accessory.getService(this.hap.Service.GarageDoorOpener),
|
|
758
|
-
On: accessory.context.On ?? false,
|
|
759
725
|
};
|
|
760
726
|
accessory.context.GarageDoor = this.GarageDoor;
|
|
761
727
|
this.warnLog('Removing any leftover Garage Door Service');
|
|
@@ -767,7 +733,6 @@ export class Others extends irdeviceBase {
|
|
|
767
733
|
this.Door = {
|
|
768
734
|
Name: accessory.context.Door.Name ?? `${accessory.displayName} Door`,
|
|
769
735
|
Service: accessory.getService(this.hap.Service.Door),
|
|
770
|
-
On: accessory.context.On ?? false,
|
|
771
736
|
};
|
|
772
737
|
accessory.context.Door = this.Door;
|
|
773
738
|
this.warnLog('Removing any leftover Door Service');
|
|
@@ -779,7 +744,6 @@ export class Others extends irdeviceBase {
|
|
|
779
744
|
this.LockMechanism = {
|
|
780
745
|
Name: accessory.context.LockMechanism.Name ?? `${accessory.displayName} Lock`,
|
|
781
746
|
Service: accessory.getService(this.hap.Service.LockMechanism),
|
|
782
|
-
On: accessory.context.On ?? false,
|
|
783
747
|
};
|
|
784
748
|
accessory.context.LockMechanism = this.LockMechanism;
|
|
785
749
|
this.warnLog('Removing any leftover Lock Service');
|
|
@@ -791,7 +755,6 @@ export class Others extends irdeviceBase {
|
|
|
791
755
|
this.Faucet = {
|
|
792
756
|
Name: accessory.context.Faucet.Name ?? `${accessory.displayName} Faucet`,
|
|
793
757
|
Service: accessory.getService(this.hap.Service.Faucet),
|
|
794
|
-
On: accessory.context.On ?? false,
|
|
795
758
|
};
|
|
796
759
|
accessory.context.Faucet = this.Faucet;
|
|
797
760
|
this.warnLog('Removing any leftover Faucet Service');
|
|
@@ -803,7 +766,6 @@ export class Others extends irdeviceBase {
|
|
|
803
766
|
this.Fan = {
|
|
804
767
|
Name: accessory.context.Fan.Name ?? `${accessory.displayName} Fan`,
|
|
805
768
|
Service: accessory.getService(this.hap.Service.Fanv2),
|
|
806
|
-
On: accessory.context.On ?? false,
|
|
807
769
|
};
|
|
808
770
|
accessory.context.Fan = this.Fan;
|
|
809
771
|
this.warnLog('Removing any leftover Fan Service');
|
|
@@ -815,7 +777,6 @@ export class Others extends irdeviceBase {
|
|
|
815
777
|
this.Window = {
|
|
816
778
|
Name: accessory.context.Window.Name ?? `${accessory.displayName} Window`,
|
|
817
779
|
Service: accessory.getService(this.hap.Service.Window),
|
|
818
|
-
On: accessory.context.On ?? false,
|
|
819
780
|
};
|
|
820
781
|
accessory.context.Window = this.Window;
|
|
821
782
|
this.warnLog('Removing any leftover Window Service');
|
|
@@ -827,7 +788,6 @@ export class Others extends irdeviceBase {
|
|
|
827
788
|
this.WindowCovering = {
|
|
828
789
|
Name: accessory.context.WindowCovering.Name ?? `${accessory.displayName} Window Covering`,
|
|
829
790
|
Service: accessory.getService(this.hap.Service.WindowCovering),
|
|
830
|
-
On: accessory.context.On ?? false,
|
|
831
791
|
};
|
|
832
792
|
accessory.context.WindowCovering = this.WindowCovering;
|
|
833
793
|
this.warnLog('Removing any leftover Window Covering Service');
|
|
@@ -839,7 +799,6 @@ export class Others extends irdeviceBase {
|
|
|
839
799
|
this.StatefulProgrammableSwitch = {
|
|
840
800
|
Name: accessory.context.StatefulProgrammableSwitch.Name ?? `${accessory.displayName} Stateful Programmable Switch`,
|
|
841
801
|
Service: accessory.getService(this.hap.Service.StatefulProgrammableSwitch),
|
|
842
|
-
On: accessory.context.On ?? false,
|
|
843
802
|
};
|
|
844
803
|
accessory.context.StatefulProgrammableSwitch = this.StatefulProgrammableSwitch;
|
|
845
804
|
this.warnLog('Removing any leftover Stateful Programmable Switch Service');
|
|
@@ -851,7 +810,6 @@ export class Others extends irdeviceBase {
|
|
|
851
810
|
this.Switch = {
|
|
852
811
|
Name: accessory.context.Switch.Name ?? `${accessory.displayName} Switch`,
|
|
853
812
|
Service: accessory.getService(this.hap.Service.Switch),
|
|
854
|
-
On: accessory.context.On ?? false,
|
|
855
813
|
};
|
|
856
814
|
accessory.context.Switch = this.Switch;
|
|
857
815
|
this.warnLog('Removing any leftover Switch Service');
|