@switchbot/homebridge-switchbot 3.5.0-beta.26 → 3.5.0-beta.27
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 +17 -14
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.js +13 -13
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.js +3 -3
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.js +3 -3
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.js +5 -5
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +12 -12
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +6 -6
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.js +4 -4
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.js +5 -5
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.js +3 -3
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.js +6 -6
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.js +5 -5
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.js +5 -5
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.js +5 -6
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.js +3 -3
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.js +4 -4
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +9 -16
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +4 -14
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +226 -234
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +3 -6
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +65 -56
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +2 -3
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +24 -27
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +2 -7
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +57 -61
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/irdevice.js +1 -1
- package/dist/irdevice/irdevice.js.map +1 -1
- package/dist/irdevice/light.d.ts +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +13 -15
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.js +51 -50
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.js +2 -2
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +1 -1
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.js +1 -1
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +22 -1
- package/dist/platform.js.map +1 -1
- package/package.json +2 -2
- package/src/custom.d.ts +1 -0
- package/src/device/blindtilt.ts +20 -18
- package/src/device/bot.ts +14 -14
- package/src/device/ceilinglight.ts +4 -4
- package/src/device/colorbulb.ts +4 -4
- package/src/device/contact.ts +6 -6
- package/src/device/curtain.ts +14 -13
- package/src/device/hub.ts +7 -6
- package/src/device/humidifier.ts +5 -5
- package/src/device/iosensor.ts +6 -6
- package/src/device/lightstrip.ts +4 -4
- package/src/device/lock.ts +7 -7
- package/src/device/meter.ts +6 -6
- package/src/device/meterplus.ts +6 -6
- package/src/device/motion.ts +6 -6
- package/src/device/plug.ts +4 -4
- package/src/device/robotvacuumcleaner.ts +5 -5
- package/src/device/waterdetector.ts +9 -17
- package/src/irdevice/airconditioner.ts +239 -238
- package/src/irdevice/airpurifier.ts +75 -56
- package/src/irdevice/camera.ts +27 -27
- package/src/irdevice/fan.ts +63 -63
- package/src/irdevice/irdevice.ts +1 -1
- package/src/irdevice/light.ts +17 -15
- package/src/irdevice/other.ts +51 -51
- package/src/irdevice/tv.ts +2 -2
- package/src/irdevice/vacuumcleaner.ts +1 -1
- package/src/irdevice/waterheater.ts +1 -1
- package/src/platform.ts +21 -4
|
@@ -15,17 +15,24 @@ import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
|
|
|
15
15
|
*/
|
|
16
16
|
export class AirPurifier extends irdeviceBase {
|
|
17
17
|
// Services
|
|
18
|
-
|
|
18
|
+
private AirPurifier: {
|
|
19
|
+
Service: Service;
|
|
20
|
+
Active: CharacteristicValue;
|
|
21
|
+
RotationSpeed: CharacteristicValue;
|
|
22
|
+
CurrentAirPurifierState: CharacteristicValue;
|
|
23
|
+
TargetAirPurifierState: CharacteristicValue;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
private TemperatureSensor: {
|
|
27
|
+
Service: Service;
|
|
28
|
+
CurrentTemperature: CharacteristicValue;
|
|
29
|
+
};
|
|
19
30
|
|
|
20
31
|
// Characteristic Values
|
|
21
|
-
Active!: CharacteristicValue;
|
|
22
32
|
APActive!: CharacteristicValue;
|
|
23
33
|
CurrentAPTemp!: CharacteristicValue;
|
|
24
34
|
CurrentAPMode!: CharacteristicValue;
|
|
25
|
-
RotationSpeed!: CharacteristicValue;
|
|
26
35
|
CurrentAPFanSpeed!: CharacteristicValue;
|
|
27
|
-
CurrentTemperature!: CharacteristicValue;
|
|
28
|
-
CurrentAirPurifierState!: CharacteristicValue;
|
|
29
36
|
CurrentHeaterCoolerState!: CharacteristicValue;
|
|
30
37
|
|
|
31
38
|
// Others
|
|
@@ -45,40 +52,43 @@ export class AirPurifier extends irdeviceBase {
|
|
|
45
52
|
) {
|
|
46
53
|
super(platform, accessory, device);
|
|
47
54
|
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
// Initialize AirPurifier property
|
|
56
|
+
this.AirPurifier = {
|
|
57
|
+
Service: accessory.getService(this.hap.Service.Switch)!,
|
|
58
|
+
Active: accessory.context.Active || this.hap.Characteristic.Active.INACTIVE,
|
|
59
|
+
RotationSpeed: accessory.context.RotationSpeed || 0,
|
|
60
|
+
CurrentAirPurifierState: accessory.context.CurrentAirPurifierState || this.hap.Characteristic.CurrentAirPurifierState.INACTIVE,
|
|
61
|
+
TargetAirPurifierState: accessory.context.TargetAirPurifierState || this.hap.Characteristic.TargetAirPurifierState.AUTO,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// Initialize TemperatureSensor property
|
|
65
|
+
this.TemperatureSensor = {
|
|
66
|
+
Service: accessory.getService(this.hap.Service.TemperatureSensor)!,
|
|
67
|
+
CurrentTemperature: accessory.context.CurrentTemperature || 24,
|
|
68
|
+
};
|
|
59
69
|
|
|
60
70
|
// get the Television service if it exists, otherwise create a new Television service
|
|
61
71
|
// you can create multiple services for each accessory
|
|
62
|
-
const
|
|
63
|
-
(this.
|
|
64
|
-
|| accessory.addService(this.hap.Service.AirPurifier)),
|
|
72
|
+
const AirPurifierService = `${accessory.displayName} Air Purifier`;
|
|
73
|
+
(this.AirPurifier.Service = accessory.getService(this.hap.Service.AirPurifier)
|
|
74
|
+
|| accessory.addService(this.hap.Service.AirPurifier)), AirPurifierService;
|
|
65
75
|
|
|
66
|
-
this.
|
|
76
|
+
this.AirPurifier.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
|
|
67
77
|
// handle on / off events using the Active characteristic
|
|
68
|
-
this.
|
|
78
|
+
this.AirPurifier.Service.getCharacteristic(this.hap.Characteristic.Active).onSet(this.ActiveSet.bind(this));
|
|
69
79
|
|
|
70
|
-
this.
|
|
80
|
+
this.AirPurifier.Service.getCharacteristic(this.hap.Characteristic.CurrentAirPurifierState).onGet(() => {
|
|
71
81
|
return this.CurrentAirPurifierStateGet();
|
|
72
82
|
});
|
|
73
83
|
|
|
74
|
-
this.
|
|
84
|
+
this.AirPurifier.Service.getCharacteristic(this.hap.Characteristic.TargetAirPurifierState).onSet(this.TargetAirPurifierStateSet.bind(this));
|
|
75
85
|
}
|
|
76
86
|
|
|
77
87
|
async ActiveSet(value: CharacteristicValue): Promise<void> {
|
|
78
88
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set Active: ${value}`);
|
|
79
89
|
|
|
80
|
-
this.Active = value;
|
|
81
|
-
if (this.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
90
|
+
this.AirPurifier.Active = value;
|
|
91
|
+
if (this.AirPurifier.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
82
92
|
this.pushAirPurifierOnChanges();
|
|
83
93
|
} else {
|
|
84
94
|
this.pushAirPurifierOffChanges();
|
|
@@ -102,12 +112,12 @@ export class AirPurifier extends irdeviceBase {
|
|
|
102
112
|
}
|
|
103
113
|
|
|
104
114
|
async CurrentAirPurifierStateGet(): Promise<number> {
|
|
105
|
-
if (this.Active === 1) {
|
|
106
|
-
this.CurrentAirPurifierState = this.hap.Characteristic.CurrentAirPurifierState.PURIFYING_AIR;
|
|
115
|
+
if (this.AirPurifier.Active === 1) {
|
|
116
|
+
this.AirPurifier.CurrentAirPurifierState = this.hap.Characteristic.CurrentAirPurifierState.PURIFYING_AIR;
|
|
107
117
|
} else {
|
|
108
|
-
this.CurrentAirPurifierState = this.hap.Characteristic.CurrentAirPurifierState.INACTIVE;
|
|
118
|
+
this.AirPurifier.CurrentAirPurifierState = this.hap.Characteristic.CurrentAirPurifierState.INACTIVE;
|
|
109
119
|
}
|
|
110
|
-
return this.CurrentAirPurifierState;
|
|
120
|
+
return this.AirPurifier.CurrentAirPurifierState;
|
|
111
121
|
}
|
|
112
122
|
|
|
113
123
|
/**
|
|
@@ -123,10 +133,10 @@ export class AirPurifier extends irdeviceBase {
|
|
|
123
133
|
*/
|
|
124
134
|
async pushAirPurifierOnChanges(): Promise<void> {
|
|
125
135
|
this.debugLog(
|
|
126
|
-
`${this.device.remoteType}: ${this.accessory.displayName} pushAirPurifierOnChanges Active: ${this.Active},` +
|
|
136
|
+
`${this.device.remoteType}: ${this.accessory.displayName} pushAirPurifierOnChanges Active: ${this.AirPurifier.Active},` +
|
|
127
137
|
` disablePushOn: ${this.disablePushOn}`,
|
|
128
138
|
);
|
|
129
|
-
if (this.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
139
|
+
if (this.AirPurifier.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
130
140
|
const commandType: string = await this.commandType();
|
|
131
141
|
const command: string = await this.commandOn();
|
|
132
142
|
const bodyChange = JSON.stringify({
|
|
@@ -140,10 +150,10 @@ export class AirPurifier extends irdeviceBase {
|
|
|
140
150
|
|
|
141
151
|
async pushAirPurifierOffChanges(): Promise<void> {
|
|
142
152
|
this.debugLog(
|
|
143
|
-
`${this.device.remoteType}: ${this.accessory.displayName} pushAirPurifierOffChanges Active: ${this.Active},` +
|
|
153
|
+
`${this.device.remoteType}: ${this.accessory.displayName} pushAirPurifierOffChanges Active: ${this.AirPurifier.Active},` +
|
|
144
154
|
` disablePushOff: ${this.disablePushOff}`,
|
|
145
155
|
);
|
|
146
|
-
if (this.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOn) {
|
|
156
|
+
if (this.AirPurifier.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOn) {
|
|
147
157
|
const commandType: string = await this.commandType();
|
|
148
158
|
const command: string = await this.commandOff();
|
|
149
159
|
const bodyChange = JSON.stringify({
|
|
@@ -157,7 +167,7 @@ export class AirPurifier extends irdeviceBase {
|
|
|
157
167
|
|
|
158
168
|
async pushAirPurifierStatusChanges(): Promise<void> {
|
|
159
169
|
this.debugLog(
|
|
160
|
-
`${this.device.remoteType}: ${this.accessory.displayName} pushAirPurifierStatusChanges Active: ${this.Active},` +
|
|
170
|
+
`${this.device.remoteType}: ${this.accessory.displayName} pushAirPurifierStatusChanges Active: ${this.AirPurifier.Active},` +
|
|
161
171
|
` disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`,
|
|
162
172
|
);
|
|
163
173
|
if (!this.Busy) {
|
|
@@ -172,21 +182,21 @@ export class AirPurifier extends irdeviceBase {
|
|
|
172
182
|
|
|
173
183
|
async pushAirPurifierDetailsChanges(): Promise<void> {
|
|
174
184
|
this.debugLog(
|
|
175
|
-
`${this.device.remoteType}: ${this.accessory.displayName} pushAirPurifierDetailsChanges Active: ${this.Active},` +
|
|
185
|
+
`${this.device.remoteType}: ${this.accessory.displayName} pushAirPurifierDetailsChanges Active: ${this.AirPurifier.Active},` +
|
|
176
186
|
` disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`,
|
|
177
187
|
);
|
|
178
|
-
this.CurrentAPTemp = this.CurrentTemperature || 24;
|
|
188
|
+
this.CurrentAPTemp = this.TemperatureSensor!.CurrentTemperature || 24;
|
|
179
189
|
this.CurrentAPMode = this.CurrentMode || 1;
|
|
180
190
|
this.CurrentAPFanSpeed = this.CurrentFanSpeed || 1;
|
|
181
|
-
this.APActive = this.Active === 1 ? 'on' : 'off';
|
|
191
|
+
this.APActive = this.AirPurifier.Active === 1 ? 'on' : 'off';
|
|
182
192
|
const parameter = `${this.CurrentAPTemp},${this.CurrentAPMode},${this.CurrentAPFanSpeed},${this.APActive}`;
|
|
183
193
|
const bodyChange = JSON.stringify({
|
|
184
194
|
command: 'setAll',
|
|
185
195
|
parameter: `${parameter}`,
|
|
186
196
|
commandType: 'command',
|
|
187
197
|
});
|
|
188
|
-
if (this.Active === 1) {
|
|
189
|
-
if ((Number(this.CurrentTemperature) || 24) < (this.LastTemperature || 30)) {
|
|
198
|
+
if (this.AirPurifier.Active === 1) {
|
|
199
|
+
if ((Number(this.TemperatureSensor!.CurrentTemperature) || 24) < (this.LastTemperature || 30)) {
|
|
190
200
|
this.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.COOLING;
|
|
191
201
|
} else {
|
|
192
202
|
this.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.HEATING;
|
|
@@ -237,40 +247,49 @@ export class AirPurifier extends irdeviceBase {
|
|
|
237
247
|
|
|
238
248
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
239
249
|
// Active
|
|
240
|
-
if (this.Active === undefined) {
|
|
241
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
250
|
+
if (this.AirPurifier.Active === undefined) {
|
|
251
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.AirPurifier.Active}`);
|
|
242
252
|
} else {
|
|
243
|
-
this.accessory.context.Active = this.Active;
|
|
244
|
-
this.
|
|
245
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
253
|
+
this.accessory.context.Active = this.AirPurifier.Active;
|
|
254
|
+
this.AirPurifier.Service.updateCharacteristic(this.hap.Characteristic.Active, this.AirPurifier.Active);
|
|
255
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.AirPurifier.Active}`);
|
|
246
256
|
}
|
|
247
257
|
// CurrentAirPurifierState
|
|
248
|
-
if (this.CurrentAirPurifierState === undefined) {
|
|
249
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentAirPurifierState: ${this.CurrentAirPurifierState}`);
|
|
258
|
+
if (this.AirPurifier.CurrentAirPurifierState === undefined) {
|
|
259
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentAirPurifierState: ${this.AirPurifier.CurrentAirPurifierState}`);
|
|
250
260
|
} else {
|
|
251
|
-
this.accessory.context.CurrentAirPurifierState = this.CurrentAirPurifierState;
|
|
252
|
-
this.
|
|
253
|
-
this.debugLog(
|
|
254
|
-
|
|
255
|
-
);
|
|
261
|
+
this.accessory.context.CurrentAirPurifierState = this.AirPurifier.CurrentAirPurifierState;
|
|
262
|
+
this.AirPurifier.Service.updateCharacteristic(this.hap.Characteristic.CurrentAirPurifierState, this.AirPurifier.CurrentAirPurifierState);
|
|
263
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
264
|
+
+ ` CurrentAirPurifierState: ${this.AirPurifier.CurrentAirPurifierState}`);
|
|
256
265
|
}
|
|
257
266
|
// CurrentHeaterCoolerState
|
|
258
267
|
if (this.CurrentHeaterCoolerState === undefined) {
|
|
259
268
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
|
|
260
269
|
} else {
|
|
261
270
|
this.accessory.context.CurrentHeaterCoolerState = this.CurrentHeaterCoolerState;
|
|
262
|
-
this.
|
|
271
|
+
this.AirPurifier.Service.updateCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState, this.CurrentHeaterCoolerState);
|
|
263
272
|
this.debugLog(
|
|
264
273
|
`${this.device.remoteType}: ${this.accessory.displayName}` +
|
|
265
274
|
` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`,
|
|
266
275
|
);
|
|
267
276
|
}
|
|
277
|
+
// CurrentTemperature
|
|
278
|
+
if (this.TemperatureSensor.CurrentTemperature === undefined) {
|
|
279
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentTemperature: ${this.TemperatureSensor.CurrentTemperature}`);
|
|
280
|
+
} else {
|
|
281
|
+
this.accessory.context.CurrentTemperature = this.TemperatureSensor.CurrentTemperature;
|
|
282
|
+
this.TemperatureSensor.Service.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, this.TemperatureSensor.CurrentTemperature);
|
|
283
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic`
|
|
284
|
+
+ ` CurrentTemperature: ${this.TemperatureSensor.CurrentTemperature}`);
|
|
285
|
+
}
|
|
268
286
|
}
|
|
269
287
|
|
|
270
288
|
async apiError(e: any): Promise<void> {
|
|
271
|
-
this.
|
|
272
|
-
this.
|
|
273
|
-
this.
|
|
274
|
-
this.
|
|
289
|
+
this.AirPurifier.Service.updateCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState, e);
|
|
290
|
+
this.AirPurifier.Service.updateCharacteristic(this.hap.Characteristic.CurrentAirPurifierState, e);
|
|
291
|
+
this.AirPurifier.Service.updateCharacteristic(this.hap.Characteristic.TargetAirPurifierState, e);
|
|
292
|
+
this.AirPurifier.Service.updateCharacteristic(this.hap.Characteristic.Active, e);
|
|
293
|
+
this.TemperatureSensor.Service.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, e);
|
|
275
294
|
}
|
|
276
295
|
}
|
package/src/irdevice/camera.ts
CHANGED
|
@@ -15,10 +15,10 @@ import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
|
|
|
15
15
|
*/
|
|
16
16
|
export class Camera extends irdeviceBase {
|
|
17
17
|
// Services
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
private Switch: {
|
|
19
|
+
Service: Service;
|
|
20
|
+
On: CharacteristicValue;
|
|
21
|
+
};
|
|
22
22
|
|
|
23
23
|
constructor(
|
|
24
24
|
readonly platform: SwitchBotPlatform,
|
|
@@ -27,30 +27,29 @@ export class Camera extends irdeviceBase {
|
|
|
27
27
|
) {
|
|
28
28
|
super(platform, accessory, device);
|
|
29
29
|
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
this.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
30
|
+
// Initialize Switch property
|
|
31
|
+
this.Switch = {
|
|
32
|
+
Service: accessory.getService(this.hap.Service.Switch)!,
|
|
33
|
+
On: accessory.context.On || false,
|
|
34
|
+
};
|
|
36
35
|
|
|
37
36
|
// get the Television service if it exists, otherwise create a new Television service
|
|
38
37
|
// you can create multiple services for each accessory
|
|
39
|
-
const
|
|
40
|
-
(this.
|
|
41
|
-
|| accessory.addService(this.hap.Service.Switch)),
|
|
38
|
+
const SwitchService = `${accessory.displayName} Camera`;
|
|
39
|
+
(this.Switch.Service = accessory.getService(this.hap.Service.Switch)
|
|
40
|
+
|| accessory.addService(this.hap.Service.Switch)), SwitchService;
|
|
42
41
|
|
|
43
|
-
this.
|
|
42
|
+
this.Switch.Service.setCharacteristic(this.hap.Characteristic.Name, SwitchService);
|
|
44
43
|
|
|
45
44
|
// handle on / off events using the On characteristic
|
|
46
|
-
this.
|
|
45
|
+
this.Switch.Service.getCharacteristic(this.hap.Characteristic.On).onSet(this.OnSet.bind(this));
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
async OnSet(value: CharacteristicValue): Promise<void> {
|
|
50
49
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${value}`);
|
|
51
50
|
|
|
52
|
-
this.On = value;
|
|
53
|
-
if (this.On) {
|
|
51
|
+
this.Switch.On = value;
|
|
52
|
+
if (this.Switch.On) {
|
|
54
53
|
this.pushOnChanges();
|
|
55
54
|
} else {
|
|
56
55
|
this.pushOffChanges();
|
|
@@ -68,8 +67,9 @@ export class Camera extends irdeviceBase {
|
|
|
68
67
|
* Camera - "command" "channelSub" "default" = previous channel
|
|
69
68
|
*/
|
|
70
69
|
async pushOnChanges(): Promise<void> {
|
|
71
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushOnChanges On: ${this.On},`
|
|
72
|
-
|
|
70
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushOnChanges On: ${this.Switch.On},`
|
|
71
|
+
+ ` disablePushOn: ${this.disablePushOn}`);
|
|
72
|
+
if (this.Switch.On && !this.disablePushOn) {
|
|
73
73
|
const commandType: string = await this.commandType();
|
|
74
74
|
const command: string = await this.commandOn();
|
|
75
75
|
const bodyChange = JSON.stringify({
|
|
@@ -83,9 +83,9 @@ export class Camera extends irdeviceBase {
|
|
|
83
83
|
|
|
84
84
|
async pushOffChanges(): Promise<void> {
|
|
85
85
|
this.debugLog(
|
|
86
|
-
`${this.device.remoteType}: ${this.accessory.displayName} pushOffChanges On: ${this.On},` + ` disablePushOff: ${this.disablePushOff}`,
|
|
86
|
+
`${this.device.remoteType}: ${this.accessory.displayName} pushOffChanges On: ${this.Switch.On},` + ` disablePushOff: ${this.disablePushOff}`,
|
|
87
87
|
);
|
|
88
|
-
if (!this.On && !this.disablePushOff) {
|
|
88
|
+
if (!this.Switch.On && !this.disablePushOff) {
|
|
89
89
|
const commandType: string = await this.commandType();
|
|
90
90
|
const command: string = await this.commandOff();
|
|
91
91
|
const bodyChange = JSON.stringify({
|
|
@@ -137,16 +137,16 @@ export class Camera extends irdeviceBase {
|
|
|
137
137
|
|
|
138
138
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
139
139
|
// On
|
|
140
|
-
if (this.On === undefined) {
|
|
141
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
140
|
+
if (this.Switch.On === undefined) {
|
|
141
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.Switch.On}`);
|
|
142
142
|
} else {
|
|
143
|
-
this.accessory.context.On = this.On;
|
|
144
|
-
this.
|
|
145
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
143
|
+
this.accessory.context.On = this.Switch.On;
|
|
144
|
+
this.Switch.Service?.updateCharacteristic(this.hap.Characteristic.On, this.Switch.On);
|
|
145
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.Switch.On}`);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
async apiError(e: any): Promise<void> {
|
|
150
|
-
this.
|
|
150
|
+
this.Switch.Service.updateCharacteristic(this.hap.Characteristic.On, e);
|
|
151
151
|
}
|
|
152
152
|
}
|
package/src/irdevice/fan.ts
CHANGED
|
@@ -15,14 +15,13 @@ import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
|
|
|
15
15
|
*/
|
|
16
16
|
export class Fan extends irdeviceBase {
|
|
17
17
|
// Services
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
RotationDirection!: CharacteristicValue;
|
|
18
|
+
private Fan: {
|
|
19
|
+
Service: Service;
|
|
20
|
+
Active: CharacteristicValue;
|
|
21
|
+
SwingMode: CharacteristicValue;
|
|
22
|
+
RotationSpeed: CharacteristicValue;
|
|
23
|
+
RotationDirection: CharacteristicValue;
|
|
24
|
+
};
|
|
26
25
|
|
|
27
26
|
// Config
|
|
28
27
|
minStep?: number;
|
|
@@ -36,23 +35,25 @@ export class Fan extends irdeviceBase {
|
|
|
36
35
|
) {
|
|
37
36
|
super(platform, accessory, device);
|
|
38
37
|
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
// Initialize Switch property
|
|
39
|
+
this.Fan = {
|
|
40
|
+
Service: accessory.getService(this.hap.Service.Lightbulb)!,
|
|
41
|
+
Active: accessory.context.Active || this.hap.Characteristic.Active.INACTIVE,
|
|
42
|
+
SwingMode: accessory.context.SwingMode || this.hap.Characteristic.SwingMode.SWING_DISABLED,
|
|
43
|
+
RotationSpeed: accessory.context.RotationSpeed || 0,
|
|
44
|
+
RotationDirection: accessory.context.On || this.hap.Characteristic.RotationDirection.CLOCKWISE,
|
|
45
|
+
};
|
|
45
46
|
|
|
46
47
|
// get the Television service if it exists, otherwise create a new Television service
|
|
47
48
|
// you can create multiple services for each accessory
|
|
48
|
-
const
|
|
49
|
-
(this.
|
|
50
|
-
|| accessory.addService(this.hap.Service.Fanv2)),
|
|
49
|
+
const FanService = `${accessory.displayName} Fan`;
|
|
50
|
+
(this.Fan.Service = accessory.getService(this.hap.Service.Fanv2)
|
|
51
|
+
|| accessory.addService(this.hap.Service.Fanv2)), FanService;
|
|
51
52
|
|
|
52
|
-
this.
|
|
53
|
+
this.Fan.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
|
|
53
54
|
|
|
54
55
|
// handle on / off events using the Active characteristic
|
|
55
|
-
this.
|
|
56
|
+
this.Fan.Service.getCharacteristic(this.hap.Characteristic.Active).onSet(this.ActiveSet.bind(this));
|
|
56
57
|
|
|
57
58
|
if (device.irfan?.rotation_speed) {
|
|
58
59
|
if (device.irfan?.set_minStep) {
|
|
@@ -71,7 +72,7 @@ export class Fan extends irdeviceBase {
|
|
|
71
72
|
this.maxValue = 100;
|
|
72
73
|
}
|
|
73
74
|
// handle Rotation Speed events using the RotationSpeed characteristic
|
|
74
|
-
this.
|
|
75
|
+
this.Fan.Service
|
|
75
76
|
.getCharacteristic(this.hap.Characteristic.RotationSpeed)
|
|
76
77
|
.setProps({
|
|
77
78
|
minStep: this.minStep,
|
|
@@ -79,9 +80,9 @@ export class Fan extends irdeviceBase {
|
|
|
79
80
|
maxValue: this.maxValue,
|
|
80
81
|
})
|
|
81
82
|
.onSet(this.RotationSpeedSet.bind(this));
|
|
82
|
-
} else if (this.
|
|
83
|
-
const characteristic = this.
|
|
84
|
-
this.
|
|
83
|
+
} else if (this.Fan.Service.testCharacteristic(this.hap.Characteristic.RotationSpeed) && !device.irfan?.swing_mode) {
|
|
84
|
+
const characteristic = this.Fan.Service.getCharacteristic(this.hap.Characteristic.RotationSpeed);
|
|
85
|
+
this.Fan.Service.removeCharacteristic(characteristic);
|
|
85
86
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Rotation Speed Characteristic was removed.`);
|
|
86
87
|
} else {
|
|
87
88
|
// eslint-disable-next-line max-len
|
|
@@ -93,10 +94,10 @@ export class Fan extends irdeviceBase {
|
|
|
93
94
|
|
|
94
95
|
if (device.irfan?.swing_mode) {
|
|
95
96
|
// handle Osolcation events using the SwingMode characteristic
|
|
96
|
-
this.
|
|
97
|
-
} else if (this.
|
|
98
|
-
const characteristic = this.
|
|
99
|
-
this.
|
|
97
|
+
this.Fan.Service.getCharacteristic(this.hap.Characteristic.SwingMode).onSet(this.SwingModeSet.bind(this));
|
|
98
|
+
} else if (this.Fan.Service.testCharacteristic(this.hap.Characteristic.SwingMode) && !device.irfan?.swing_mode) {
|
|
99
|
+
const characteristic = this.Fan.Service.getCharacteristic(this.hap.Characteristic.SwingMode);
|
|
100
|
+
this.Fan.Service.removeCharacteristic(characteristic);
|
|
100
101
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Swing Mode Characteristic was removed.`);
|
|
101
102
|
} else {
|
|
102
103
|
// eslint-disable-next-line max-len
|
|
@@ -109,38 +110,38 @@ export class Fan extends irdeviceBase {
|
|
|
109
110
|
|
|
110
111
|
async SwingModeSet(value: CharacteristicValue): Promise<void> {
|
|
111
112
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} SwingMode: ${value}`);
|
|
112
|
-
if (value > this.SwingMode) {
|
|
113
|
-
this.SwingMode = 1;
|
|
113
|
+
if (value > this.Fan.SwingMode) {
|
|
114
|
+
this.Fan.SwingMode = 1;
|
|
114
115
|
await this.pushFanOnChanges();
|
|
115
116
|
await this.pushFanSwingChanges();
|
|
116
117
|
} else {
|
|
117
|
-
this.SwingMode = 0;
|
|
118
|
+
this.Fan.SwingMode = 0;
|
|
118
119
|
await this.pushFanOnChanges();
|
|
119
120
|
await this.pushFanSwingChanges();
|
|
120
121
|
}
|
|
121
|
-
this.SwingMode = value;
|
|
122
|
-
this.accessory.context.SwingMode = this.SwingMode;
|
|
122
|
+
this.Fan.SwingMode = value;
|
|
123
|
+
this.accessory.context.SwingMode = this.Fan.SwingMode;
|
|
123
124
|
}
|
|
124
125
|
|
|
125
126
|
async RotationSpeedSet(value: CharacteristicValue): Promise<void> {
|
|
126
127
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} RotationSpeed: ${value}`);
|
|
127
|
-
if (value > this.RotationSpeed) {
|
|
128
|
-
this.RotationSpeed = 1;
|
|
128
|
+
if (value > this.Fan.RotationSpeed) {
|
|
129
|
+
this.Fan.RotationSpeed = 1;
|
|
129
130
|
this.pushFanSpeedUpChanges();
|
|
130
131
|
this.pushFanOnChanges();
|
|
131
132
|
} else {
|
|
132
|
-
this.RotationSpeed = 0;
|
|
133
|
+
this.Fan.RotationSpeed = 0;
|
|
133
134
|
this.pushFanSpeedDownChanges();
|
|
134
135
|
}
|
|
135
|
-
this.RotationSpeed = value;
|
|
136
|
-
this.accessory.context.RotationSpeed = this.RotationSpeed;
|
|
136
|
+
this.Fan.RotationSpeed = value;
|
|
137
|
+
this.accessory.context.RotationSpeed = this.Fan.RotationSpeed;
|
|
137
138
|
}
|
|
138
139
|
|
|
139
140
|
async ActiveSet(value: CharacteristicValue): Promise<void> {
|
|
140
141
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${value}`);
|
|
141
142
|
|
|
142
|
-
this.Active = value;
|
|
143
|
-
if (this.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
143
|
+
this.Fan.Active = value;
|
|
144
|
+
if (this.Fan.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
144
145
|
this.pushFanOnChanges();
|
|
145
146
|
} else {
|
|
146
147
|
this.pushFanOffChanges();
|
|
@@ -157,10 +158,9 @@ export class Fan extends irdeviceBase {
|
|
|
157
158
|
* Fan - "command" "highSpeed" "default" = fan speed to high
|
|
158
159
|
*/
|
|
159
160
|
async pushFanOnChanges(): Promise<void> {
|
|
160
|
-
this.debugLog(
|
|
161
|
-
|
|
162
|
-
)
|
|
163
|
-
if (this.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
161
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushFanOnChanges Active: ${this.Fan.Active},`
|
|
162
|
+
+ ` disablePushOn: ${this.disablePushOn}`);
|
|
163
|
+
if (this.Fan.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
164
164
|
const commandType: string = await this.commandType();
|
|
165
165
|
const command: string = await this.commandOn();
|
|
166
166
|
const bodyChange = JSON.stringify({
|
|
@@ -174,10 +174,10 @@ export class Fan extends irdeviceBase {
|
|
|
174
174
|
|
|
175
175
|
async pushFanOffChanges(): Promise<void> {
|
|
176
176
|
this.debugLog(
|
|
177
|
-
`${this.device.remoteType}: ${this.accessory.displayName} pushLightOffChanges Active: ${this.Active},` +
|
|
177
|
+
`${this.device.remoteType}: ${this.accessory.displayName} pushLightOffChanges Active: ${this.Fan.Active},` +
|
|
178
178
|
` disablePushOff: ${this.disablePushOff}`,
|
|
179
179
|
);
|
|
180
|
-
if (this.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
|
|
180
|
+
if (this.Fan.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
|
|
181
181
|
const commandType: string = await this.commandType();
|
|
182
182
|
const command: string = await this.commandOff();
|
|
183
183
|
const bodyChange = JSON.stringify({
|
|
@@ -255,32 +255,32 @@ export class Fan extends irdeviceBase {
|
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
258
|
-
if (this.Active === undefined) {
|
|
259
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
258
|
+
if (this.Fan.Active === undefined) {
|
|
259
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Fan.Active}`);
|
|
260
260
|
} else {
|
|
261
|
-
this.accessory.context.Active = this.Active;
|
|
262
|
-
this.
|
|
263
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
261
|
+
this.accessory.context.Active = this.Fan.Active;
|
|
262
|
+
this.Fan.Service?.updateCharacteristic(this.hap.Characteristic.Active, this.Fan.Active);
|
|
263
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Fan.Active}`);
|
|
264
264
|
}
|
|
265
|
-
if (this.SwingMode === undefined) {
|
|
266
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} SwingMode: ${this.SwingMode}`);
|
|
265
|
+
if (this.Fan.SwingMode === undefined) {
|
|
266
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} SwingMode: ${this.Fan.SwingMode}`);
|
|
267
267
|
} else {
|
|
268
|
-
this.accessory.context.SwingMode = this.SwingMode;
|
|
269
|
-
this.
|
|
270
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic SwingMode: ${this.SwingMode}`);
|
|
268
|
+
this.accessory.context.SwingMode = this.Fan.SwingMode;
|
|
269
|
+
this.Fan.Service?.updateCharacteristic(this.hap.Characteristic.SwingMode, this.Fan.SwingMode);
|
|
270
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic SwingMode: ${this.Fan.SwingMode}`);
|
|
271
271
|
}
|
|
272
|
-
if (this.RotationSpeed === undefined) {
|
|
273
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} RotationSpeed: ${this.RotationSpeed}`);
|
|
272
|
+
if (this.Fan.RotationSpeed === undefined) {
|
|
273
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} RotationSpeed: ${this.Fan.RotationSpeed}`);
|
|
274
274
|
} else {
|
|
275
|
-
this.accessory.context.RotationSpeed = this.RotationSpeed;
|
|
276
|
-
this.
|
|
277
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.RotationSpeed}`);
|
|
275
|
+
this.accessory.context.RotationSpeed = this.Fan.RotationSpeed;
|
|
276
|
+
this.Fan.Service?.updateCharacteristic(this.hap.Characteristic.RotationSpeed, this.Fan.RotationSpeed);
|
|
277
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.Fan.RotationSpeed}`);
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
async apiError(e: any): Promise<void> {
|
|
282
|
-
this.
|
|
283
|
-
this.
|
|
284
|
-
this.
|
|
282
|
+
this.Fan.Service.updateCharacteristic(this.hap.Characteristic.Active, e);
|
|
283
|
+
this.Fan.Service.updateCharacteristic(this.hap.Characteristic.RotationSpeed, e);
|
|
284
|
+
this.Fan.Service.updateCharacteristic(this.hap.Characteristic.SwingMode, e);
|
|
285
285
|
}
|
|
286
286
|
}
|
package/src/irdevice/irdevice.ts
CHANGED
|
@@ -322,7 +322,7 @@ export abstract class irdeviceBase {
|
|
|
322
322
|
|
|
323
323
|
async getDeviceContext(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): Promise<void> {
|
|
324
324
|
accessory.context.name = device.deviceName;
|
|
325
|
-
accessory.context.model = device.
|
|
325
|
+
accessory.context.model = device.remoteType;
|
|
326
326
|
accessory.context.deviceId = device.deviceId;
|
|
327
327
|
accessory.context.remoteType = device.remoteType;
|
|
328
328
|
if (device.firmware === undefined) {
|
package/src/irdevice/light.ts
CHANGED
|
@@ -15,7 +15,11 @@ import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
|
|
|
15
15
|
*/
|
|
16
16
|
export class Light extends irdeviceBase {
|
|
17
17
|
// Services
|
|
18
|
-
|
|
18
|
+
private LightBulb!: {
|
|
19
|
+
Service: Service;
|
|
20
|
+
On: CharacteristicValue;
|
|
21
|
+
};
|
|
22
|
+
|
|
19
23
|
ProgrammableSwitchServiceOn?: Service;
|
|
20
24
|
ProgrammableSwitchServiceOff?: Service;
|
|
21
25
|
|
|
@@ -33,25 +37,23 @@ export class Light extends irdeviceBase {
|
|
|
33
37
|
) {
|
|
34
38
|
super(platform, accessory, device);
|
|
35
39
|
|
|
36
|
-
// default placeholders
|
|
37
|
-
if (this.On === undefined) {
|
|
38
|
-
this.On = false;
|
|
39
|
-
} else {
|
|
40
|
-
this.On = accessory.context.On;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
40
|
if (!device.irlight?.stateless) {
|
|
41
|
+
// Initialize LightBulb property
|
|
42
|
+
this.LightBulb = {
|
|
43
|
+
Service: accessory.getService(this.hap.Service.Lightbulb)!,
|
|
44
|
+
On: accessory.context.On || false,
|
|
45
|
+
};
|
|
44
46
|
// get the Light service if it exists, otherwise create a new Light service
|
|
45
47
|
// you can create multiple services for each accessory
|
|
46
|
-
const
|
|
47
|
-
(this.
|
|
48
|
-
|| accessory.addService(this.hap.Service.Lightbulb)),
|
|
48
|
+
const LightBulbService = `${accessory.displayName} ${device.remoteType}`;
|
|
49
|
+
(this.LightBulb.Service = accessory.getService(this.hap.Service.Lightbulb)
|
|
50
|
+
|| accessory.addService(this.hap.Service.Lightbulb)), LightBulbService;
|
|
49
51
|
|
|
50
52
|
|
|
51
|
-
this.
|
|
53
|
+
this.LightBulb.Service.setCharacteristic(this.hap.Characteristic.Name, accessory.displayName);
|
|
52
54
|
|
|
53
55
|
// handle on / off events using the On characteristic
|
|
54
|
-
this.
|
|
56
|
+
this.LightBulb.Service.getCharacteristic(this.hap.Characteristic.On).onSet(this.OnSet.bind(this));
|
|
55
57
|
} else {
|
|
56
58
|
|
|
57
59
|
// create a new Stateful Programmable Switch On service
|
|
@@ -252,7 +254,7 @@ export class Light extends irdeviceBase {
|
|
|
252
254
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
253
255
|
} else {
|
|
254
256
|
this.accessory.context.On = this.On;
|
|
255
|
-
this.
|
|
257
|
+
this.LightBulb.Service?.updateCharacteristic(this.hap.Characteristic.On, this.On);
|
|
256
258
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
257
259
|
}
|
|
258
260
|
} else {
|
|
@@ -283,7 +285,7 @@ export class Light extends irdeviceBase {
|
|
|
283
285
|
|
|
284
286
|
async apiError(e: any): Promise<void> {
|
|
285
287
|
if (this.device.irlight?.stateless) {
|
|
286
|
-
this.
|
|
288
|
+
this.LightBulb.Service?.updateCharacteristic(this.hap.Characteristic.On, e);
|
|
287
289
|
} else {
|
|
288
290
|
this.ProgrammableSwitchServiceOn?.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchEvent, e);
|
|
289
291
|
this.ProgrammableSwitchServiceOn?.updateCharacteristic(this.hap.Characteristic.ProgrammableSwitchOutputState, e);
|