@switchbot/homebridge-switchbot 1.2.4-beta.0 → 1.2.6-beta.1
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 +14 -0
- package/dist/devices/bots.js +4 -4
- package/dist/devices/bots.js.map +1 -1
- package/dist/devices/contact.js +4 -4
- package/dist/devices/contact.js.map +1 -1
- package/dist/devices/curtains.d.ts.map +1 -1
- package/dist/devices/curtains.js +41 -29
- package/dist/devices/curtains.js.map +1 -1
- package/dist/devices/humidifiers.js +2 -2
- package/dist/devices/humidifiers.js.map +1 -1
- package/dist/irdevices/airconditioners.d.ts +1 -4
- package/dist/irdevices/airconditioners.d.ts.map +1 -1
- package/dist/irdevices/airconditioners.js +32 -18
- package/dist/irdevices/airconditioners.js.map +1 -1
- package/dist/irdevices/airpurifiers.js +3 -3
- package/dist/irdevices/airpurifiers.js.map +1 -1
- package/dist/irdevices/cameras.js +1 -1
- package/dist/irdevices/cameras.js.map +1 -1
- package/dist/irdevices/fans.js +3 -3
- package/dist/irdevices/fans.js.map +1 -1
- package/dist/irdevices/lights.js +1 -1
- package/dist/irdevices/lights.js.map +1 -1
- package/dist/irdevices/others.js +2 -2
- package/dist/irdevices/others.js.map +1 -1
- package/dist/irdevices/tvs.js +2 -2
- package/dist/irdevices/tvs.js.map +1 -1
- package/dist/irdevices/vacuumcleaners.js +1 -1
- package/dist/irdevices/vacuumcleaners.js.map +1 -1
- package/dist/irdevices/waterheaters.js +1 -1
- package/dist/irdevices/waterheaters.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +3 -0
- package/dist/platform.js.map +1 -1
- package/package.json +4 -4
- package/src/devices/bots.ts +4 -4
- package/src/devices/contact.ts +4 -4
- package/src/devices/curtains.ts +39 -29
- package/src/devices/humidifiers.ts +2 -2
- package/src/irdevices/airconditioners.ts +33 -24
- package/src/irdevices/airpurifiers.ts +3 -3
- package/src/irdevices/cameras.ts +1 -1
- package/src/irdevices/fans.ts +3 -3
- package/src/irdevices/lights.ts +1 -1
- package/src/irdevices/others.ts +2 -2
- package/src/irdevices/tvs.ts +2 -2
- package/src/irdevices/vacuumcleaners.ts +1 -1
- package/src/irdevices/waterheaters.ts +1 -1
- package/src/platform.ts +2 -0
package/src/devices/curtains.ts
CHANGED
|
@@ -373,14 +373,16 @@ export class Curtain {
|
|
|
373
373
|
+ ` TargetPosition: ${this.TargetPosition}, PositionState: ${this.PositionState},`);
|
|
374
374
|
|
|
375
375
|
if (!this.device.curtain?.hide_lightsensor) {
|
|
376
|
+
this.set_minLux = this.minLux();
|
|
377
|
+
this.set_maxLux = this.maxLux();
|
|
376
378
|
// Brightness
|
|
377
379
|
switch (this.deviceStatus.body.brightness) {
|
|
378
380
|
case 'dim':
|
|
379
|
-
this.CurrentAmbientLightLevel =
|
|
381
|
+
this.CurrentAmbientLightLevel = this.set_minLux;
|
|
380
382
|
break;
|
|
381
383
|
case 'bright':
|
|
382
384
|
default:
|
|
383
|
-
this.CurrentAmbientLightLevel =
|
|
385
|
+
this.CurrentAmbientLightLevel = this.set_maxLux;
|
|
384
386
|
}
|
|
385
387
|
this.platform.debug(`Curtain: ${this.accessory.displayName} CurrentAmbientLightLevel: ${this.CurrentAmbientLightLevel}`);
|
|
386
388
|
}
|
|
@@ -489,29 +491,34 @@ export class Curtain {
|
|
|
489
491
|
}
|
|
490
492
|
|
|
491
493
|
private async BLEpushChanges() {
|
|
492
|
-
this.
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
this.
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
this.
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
this.platform.
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
494
|
+
if (this.TargetPosition !== this.CurrentPosition) {
|
|
495
|
+
this.platform.debug(`Curtain: ${this.accessory.displayName} BLE pushChanges`);
|
|
496
|
+
const switchbot = this.connectBLE();
|
|
497
|
+
switchbot.discover({ model: 'c', quick: true, id: this.device.bleMac }).then((device_list) => {
|
|
498
|
+
this.platform.log.info(`${this.accessory.displayName} Target Position: ${this.TargetPosition}`);
|
|
499
|
+
return device_list[0].runToPos(100 - Number(this.TargetPosition));
|
|
500
|
+
}).then(() => {
|
|
501
|
+
this.platform.device(`Curtain: ${this.accessory.displayName} Done.`);
|
|
502
|
+
}).catch(async (e: any) => {
|
|
503
|
+
this.platform.log.error(`Curtain: ${this.accessory.displayName} failed pushChanges with BLE Connection`);
|
|
504
|
+
if (this.deviceDebug) {
|
|
505
|
+
this.platform.log.error(`Curtain: ${this.accessory.displayName} failed pushChanges with BLE Connection,`
|
|
506
|
+
+ ` Error Message: ${JSON.stringify(e.message)}`);
|
|
507
|
+
}
|
|
508
|
+
if (this.debugDebug) {
|
|
509
|
+
this.platform.log.error(`Curtain: ${this.accessory.displayName} failed pushChanges with BLE Connection,`
|
|
510
|
+
+ ` Error: ${JSON.stringify(e)}`);
|
|
511
|
+
}
|
|
512
|
+
if (this.platform.config.credentials?.openToken) {
|
|
513
|
+
this.platform.log.warn(`Curtain: ${this.accessory.displayName} Using OpenAPI Connection`);
|
|
514
|
+
await this.OpenAPIpushChanges();
|
|
515
|
+
}
|
|
516
|
+
this.apiError(e);
|
|
517
|
+
});
|
|
518
|
+
} else {
|
|
519
|
+
this.platform.debug(`Curtain: ${this.accessory.displayName} No BLE Changes, CurrentPosition & TargetPosition Are the Same.`
|
|
520
|
+
+ ` CurrentPosition: ${this.CurrentPosition}, TargetPosition ${this.TargetPosition}`);
|
|
521
|
+
}
|
|
515
522
|
}
|
|
516
523
|
|
|
517
524
|
private async OpenAPIpushChanges() {
|
|
@@ -534,6 +541,9 @@ export class Curtain {
|
|
|
534
541
|
const push: any = (await this.platform.axios.post(`${DeviceURL}/${this.device.deviceId!}/commands`, payload));
|
|
535
542
|
this.platform.debug(`Curtain: ${this.accessory.displayName} pushchanges: ${JSON.stringify(push.data)}`);
|
|
536
543
|
this.statusCode(push);
|
|
544
|
+
} else {
|
|
545
|
+
this.platform.debug(`Curtain: ${this.accessory.displayName} No OpenAPI Changes, CurrentPosition & TargetPosition Are the Same.`
|
|
546
|
+
+ ` CurrentPosition: ${this.CurrentPosition}, TargetPosition ${this.TargetPosition}`);
|
|
537
547
|
}
|
|
538
548
|
} catch (e: any) {
|
|
539
549
|
this.platform.log.error(`Curtain: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
|
|
@@ -573,7 +583,7 @@ export class Curtain {
|
|
|
573
583
|
if (this.CurrentAmbientLightLevel === undefined || Number.isNaN(this.CurrentAmbientLightLevel)) {
|
|
574
584
|
this.platform.debug(`Curtain: ${this.accessory.displayName} CurrentAmbientLightLevel: ${this.CurrentAmbientLightLevel}`);
|
|
575
585
|
} else {
|
|
576
|
-
this.lightSensorService
|
|
586
|
+
this.lightSensorService?.updateCharacteristic(this.platform.Characteristic.CurrentAmbientLightLevel, this.CurrentAmbientLightLevel);
|
|
577
587
|
this.platform.device(`Curtain: ${this.accessory.displayName}`
|
|
578
588
|
+ ` updateCharacteristic CurrentAmbientLightLevel: ${this.CurrentAmbientLightLevel}`);
|
|
579
589
|
}
|
|
@@ -599,11 +609,11 @@ export class Curtain {
|
|
|
599
609
|
this.service.updateCharacteristic(this.platform.Characteristic.PositionState, e);
|
|
600
610
|
this.service.updateCharacteristic(this.platform.Characteristic.TargetPosition, e);
|
|
601
611
|
if (!this.device.curtain?.hide_lightsensor) {
|
|
602
|
-
this.lightSensorService
|
|
612
|
+
this.lightSensorService?.updateCharacteristic(this.platform.Characteristic.CurrentAmbientLightLevel, e);
|
|
603
613
|
}
|
|
604
614
|
if (this.device.ble) {
|
|
605
|
-
this.batteryService
|
|
606
|
-
this.batteryService
|
|
615
|
+
this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, e);
|
|
616
|
+
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
|
|
607
617
|
}
|
|
608
618
|
}
|
|
609
619
|
|
|
@@ -595,7 +595,7 @@ export class Humidifier {
|
|
|
595
595
|
if (this.CurrentTemperature === undefined) {
|
|
596
596
|
this.platform.debug(`Humidifier: ${this.accessory.displayName} CurrentTemperature: ${this.CurrentTemperature}`);
|
|
597
597
|
} else {
|
|
598
|
-
this.temperatureservice
|
|
598
|
+
this.temperatureservice?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.CurrentTemperature);
|
|
599
599
|
this.platform.device(`Humidifier: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
|
|
600
600
|
}
|
|
601
601
|
}
|
|
@@ -611,7 +611,7 @@ export class Humidifier {
|
|
|
611
611
|
this.service.updateCharacteristic(this.platform.Characteristic.Active, e);
|
|
612
612
|
this.service.updateCharacteristic(this.platform.Characteristic.RelativeHumidityHumidifierThreshold, e);
|
|
613
613
|
if (!this.device.humidifier?.hide_temperature && !this.device.ble) {
|
|
614
|
-
this.temperatureservice
|
|
614
|
+
this.temperatureservice?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, e);
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
617
|
|
|
@@ -14,18 +14,15 @@ export class AirConditioner {
|
|
|
14
14
|
|
|
15
15
|
// Characteristic Values
|
|
16
16
|
Active!: CharacteristicValue;
|
|
17
|
-
ARActive!: CharacteristicValue;
|
|
18
17
|
RotationSpeed!: CharacteristicValue;
|
|
19
|
-
CurrentARTemp!: CharacteristicValue;
|
|
20
|
-
CurrentARMode!: CharacteristicValue;
|
|
21
18
|
LastTemperature!: CharacteristicValue;
|
|
22
|
-
CurrentARFanSpeed!: CharacteristicValue;
|
|
23
19
|
CurrentTemperature!: CharacteristicValue;
|
|
24
20
|
TargetHeaterCoolerState?: CharacteristicValue;
|
|
25
21
|
CurrentHeaterCoolerState!: CharacteristicValue;
|
|
26
22
|
HeatingThresholdTemperature?: CharacteristicValue;
|
|
27
23
|
|
|
28
24
|
// Others
|
|
25
|
+
state!: string;
|
|
29
26
|
Busy: any;
|
|
30
27
|
Timeout: any = null;
|
|
31
28
|
CurrentMode!: number;
|
|
@@ -158,8 +155,10 @@ export class AirConditioner {
|
|
|
158
155
|
|
|
159
156
|
if (value === this.platform.Characteristic.Active.INACTIVE) {
|
|
160
157
|
this.pushAirConditionerOffChanges();
|
|
158
|
+
this.platform.device(`Air Conditioner: ${this.accessory.displayName} pushAirConditionerOffChanges, Active: ${this.Active}`);
|
|
161
159
|
} else {
|
|
162
160
|
this.pushAirConditionerOnChanges();
|
|
161
|
+
this.platform.device(`Air Conditioner: ${this.accessory.displayName} pushAirConditionerOffChanges, Active: ${this.Active}`);
|
|
163
162
|
}
|
|
164
163
|
this.Active = value;
|
|
165
164
|
}
|
|
@@ -168,48 +167,47 @@ export class AirConditioner {
|
|
|
168
167
|
if (this.Active === undefined) {
|
|
169
168
|
this.platform.debug(`Air Conditioner: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
170
169
|
} else {
|
|
171
|
-
this.service
|
|
170
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
|
|
172
171
|
this.platform.device(`Air Conditioner: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
173
172
|
}
|
|
174
173
|
if (this.RotationSpeed === undefined) {
|
|
175
174
|
this.platform.debug(`Air Conditioner: ${this.accessory.displayName} RotationSpeed: ${this.RotationSpeed}`);
|
|
176
175
|
} else {
|
|
177
|
-
this.service
|
|
176
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.RotationSpeed);
|
|
178
177
|
this.platform.device(`Air Conditioner: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.RotationSpeed}`);
|
|
179
178
|
}
|
|
180
179
|
if (this.CurrentTemperature === undefined) {
|
|
181
180
|
this.platform.debug(`Air Conditioner: ${this.accessory.displayName} CurrentTemperature: ${this.CurrentTemperature}`);
|
|
182
181
|
} else {
|
|
183
|
-
this.service
|
|
182
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.CurrentTemperature);
|
|
184
183
|
this.platform.device(`Air Conditioner: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
|
|
185
184
|
}
|
|
186
185
|
if (this.TargetHeaterCoolerState === undefined) {
|
|
187
186
|
this.platform.debug(`Air Conditioner: ${this.accessory.displayName} TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
|
|
188
187
|
} else {
|
|
189
|
-
this.service
|
|
188
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.TargetHeaterCoolerState, this.TargetHeaterCoolerState);
|
|
190
189
|
this.platform.device(`Air Conditioner: ${this.accessory.displayName}`
|
|
191
190
|
+ ` updateCharacteristic TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
|
|
192
191
|
}
|
|
193
192
|
if (this.CurrentHeaterCoolerState === undefined) {
|
|
194
193
|
this.platform.debug(`Air Conditioner: ${this.accessory.displayName} CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
|
|
195
194
|
} else {
|
|
196
|
-
this.service
|
|
195
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState, this.CurrentHeaterCoolerState);
|
|
197
196
|
this.platform.device(`Air Conditioner: ${this.accessory.displayName}`
|
|
198
197
|
+ ` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
|
|
199
198
|
}
|
|
200
199
|
if (this.HeatingThresholdTemperature === undefined) {
|
|
201
200
|
this.platform.debug(`Air Conditioner: ${this.accessory.displayName} HeatingThresholdTemperature: ${this.HeatingThresholdTemperature}`);
|
|
202
201
|
} else {
|
|
203
|
-
this.service
|
|
202
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature, this.HeatingThresholdTemperature);
|
|
204
203
|
this.platform.device(`Air Conditioner: ${this.accessory.displayName}`
|
|
205
204
|
+ ` updateCharacteristic HeatingThresholdTemperature: ${this.HeatingThresholdTemperature}`);
|
|
206
205
|
}
|
|
207
206
|
}
|
|
208
207
|
|
|
209
208
|
private CurrentTemperatureGet(value: CharacteristicValue) {
|
|
210
|
-
this.platform.debug('Trigger Get CurrentTemperture');
|
|
211
|
-
|
|
212
209
|
value = Number(this.CurrentTemperature) || 24;
|
|
210
|
+
this.platform.debug(`Air Conditioner: ${this.accessory.displayName} Trigger Get CurrentTemperature: ${value}` );
|
|
213
211
|
|
|
214
212
|
this.service
|
|
215
213
|
.getCharacteristic(this.platform.Characteristic.CurrentTemperature)
|
|
@@ -236,7 +234,7 @@ export class AirConditioner {
|
|
|
236
234
|
}
|
|
237
235
|
|
|
238
236
|
private CurrentHeaterCoolerStateGet() {
|
|
239
|
-
if (this.Active ===
|
|
237
|
+
if (this.Active === this.platform.Characteristic.Active.ACTIVE) {
|
|
240
238
|
if ((this.CurrentTemperature || 24) < (this.LastTemperature || 30)) {
|
|
241
239
|
this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.COOLING;
|
|
242
240
|
} else {
|
|
@@ -273,7 +271,7 @@ export class AirConditioner {
|
|
|
273
271
|
* AirConditioner: "command" "highSpeed" "default" = fan speed to high
|
|
274
272
|
*/
|
|
275
273
|
async pushAirConditionerOnChanges() {
|
|
276
|
-
if (this.Active !==
|
|
274
|
+
if (this.Active !== this.platform.Characteristic.Active.ACTIVE) {
|
|
277
275
|
const payload = {
|
|
278
276
|
commandType: 'command',
|
|
279
277
|
parameter: 'default',
|
|
@@ -284,7 +282,7 @@ export class AirConditioner {
|
|
|
284
282
|
}
|
|
285
283
|
|
|
286
284
|
async pushAirConditionerOffChanges() {
|
|
287
|
-
if (this.Active !==
|
|
285
|
+
if (this.Active !== this.platform.Characteristic.Active.INACTIVE) {
|
|
288
286
|
const payload = {
|
|
289
287
|
commandType: 'command',
|
|
290
288
|
parameter: 'default',
|
|
@@ -311,14 +309,25 @@ export class AirConditioner {
|
|
|
311
309
|
command: 'setAll',
|
|
312
310
|
} as any;
|
|
313
311
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
312
|
+
if (this.CurrentTemperature === undefined) {
|
|
313
|
+
this.CurrentTemperature = 24;
|
|
314
|
+
}
|
|
315
|
+
if (this.CurrentMode === undefined) {
|
|
316
|
+
this.CurrentMode = 1;
|
|
317
|
+
}
|
|
318
|
+
if (this.CurrentFanSpeed === undefined) {
|
|
319
|
+
this.CurrentFanSpeed = 1;
|
|
320
|
+
}
|
|
321
|
+
this.Active = this.platform.Characteristic.Active.ACTIVE;
|
|
322
|
+
if (this.Active === this.platform.Characteristic.Active.ACTIVE) {
|
|
323
|
+
this.state = 'on';
|
|
324
|
+
} else {
|
|
325
|
+
this.state = 'off';
|
|
326
|
+
}
|
|
327
|
+
payload.parameter = `${this.CurrentTemperature},${this.CurrentMode},${this.CurrentFanSpeed},${this.state}`;
|
|
319
328
|
|
|
320
329
|
|
|
321
|
-
if (this.Active ===
|
|
330
|
+
if (this.Active === this.platform.Characteristic.Active.ACTIVE) {
|
|
322
331
|
if ((this.CurrentTemperature || 24) < (this.LastTemperature || 30)) {
|
|
323
332
|
this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.COOLING;
|
|
324
333
|
} else {
|
|
@@ -334,11 +343,11 @@ export class AirConditioner {
|
|
|
334
343
|
public async pushChanges(payload: payload) {
|
|
335
344
|
try {
|
|
336
345
|
this.platform.log.info(`Air Conditioner: ${this.accessory.displayName} Sending request to SwitchBot API. command: ${payload.command},`
|
|
337
|
-
+ ` parameter: ${payload.parameter}, commandType: ${payload.commandType}`);
|
|
346
|
+
+ ` parameter: [${payload.parameter}], commandType: ${payload.commandType}`);
|
|
338
347
|
|
|
339
348
|
// Make the API request
|
|
340
|
-
const push = await this.platform.axios.post(`${DeviceURL}/${this.device.deviceId}/commands`, payload);
|
|
341
|
-
this.platform.
|
|
349
|
+
const push: any = await this.platform.axios.post(`${DeviceURL}/${this.device.deviceId}/commands`, payload);
|
|
350
|
+
this.platform.log.error(`Air Conditioner: ${this.accessory.displayName} pushChanges: ${JSON.stringify(push.data)}`);
|
|
342
351
|
this.statusCode(push);
|
|
343
352
|
this.updateHomeKitCharacteristics();
|
|
344
353
|
} catch (e: any) {
|
|
@@ -87,20 +87,20 @@ export class AirPurifier {
|
|
|
87
87
|
if (this.Active === undefined) {
|
|
88
88
|
this.platform.debug(`Air Purifier: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
89
89
|
} else {
|
|
90
|
-
this.service
|
|
90
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
|
|
91
91
|
this.platform.device(`Air Purifier: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
92
92
|
}
|
|
93
93
|
if (this.CurrentAirPurifierState === undefined) {
|
|
94
94
|
this.platform.debug(`Air Purifier: ${this.accessory.displayName} CurrentAirPurifierState: ${this.CurrentAirPurifierState}`);
|
|
95
95
|
} else {
|
|
96
|
-
this.service
|
|
96
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.CurrentAirPurifierState, this.CurrentAirPurifierState);
|
|
97
97
|
this.platform.device(`Air Purifier: ${this.accessory.displayName}`
|
|
98
98
|
+ ` updateCharacteristic CurrentAirPurifierState: ${this.CurrentAirPurifierState}`);
|
|
99
99
|
}
|
|
100
100
|
if (this.CurrentHeaterCoolerState === undefined) {
|
|
101
101
|
this.platform.debug(`Air Purifier: ${this.accessory.displayName} CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
|
|
102
102
|
} else {
|
|
103
|
-
this.service
|
|
103
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState, this.CurrentHeaterCoolerState);
|
|
104
104
|
this.platform.device(`Air Purifier: ${this.accessory.displayName}`
|
|
105
105
|
+ ` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
|
|
106
106
|
}
|
package/src/irdevices/cameras.ts
CHANGED
|
@@ -63,7 +63,7 @@ export class Camera {
|
|
|
63
63
|
if (this.On === undefined) {
|
|
64
64
|
this.platform.debug(`Camera: ${this.accessory.displayName} On: ${this.On}`);
|
|
65
65
|
} else {
|
|
66
|
-
this.service
|
|
66
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.On, this.On);
|
|
67
67
|
this.platform.device(`Camera: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
68
68
|
}
|
|
69
69
|
}
|
package/src/irdevices/fans.ts
CHANGED
|
@@ -126,19 +126,19 @@ export class Fan {
|
|
|
126
126
|
if (this.Active === undefined) {
|
|
127
127
|
this.platform.debug(`Fan: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
128
128
|
} else {
|
|
129
|
-
this.service
|
|
129
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
|
|
130
130
|
this.platform.device(`Fan: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
131
131
|
}
|
|
132
132
|
if (this.SwingMode === undefined) {
|
|
133
133
|
this.platform.debug(`Fan: ${this.accessory.displayName} SwingMode: ${this.SwingMode}`);
|
|
134
134
|
} else {
|
|
135
|
-
this.service
|
|
135
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.SwingMode, this.SwingMode);
|
|
136
136
|
this.platform.device(`Fan: ${this.accessory.displayName} updateCharacteristic SwingMode: ${this.SwingMode}`);
|
|
137
137
|
}
|
|
138
138
|
if (this.RotationSpeed === undefined) {
|
|
139
139
|
this.platform.debug(`Fan: ${this.accessory.displayName} RotationSpeed: ${this.RotationSpeed}`);
|
|
140
140
|
} else {
|
|
141
|
-
this.service
|
|
141
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.RotationSpeed);
|
|
142
142
|
this.platform.device(`Fan: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.RotationSpeed}`);
|
|
143
143
|
}
|
|
144
144
|
}
|
package/src/irdevices/lights.ts
CHANGED
|
@@ -78,7 +78,7 @@ export class Light {
|
|
|
78
78
|
if (this.On === undefined) {
|
|
79
79
|
this.platform.debug(`Light: ${this.accessory.displayName} On: ${this.On}`);
|
|
80
80
|
} else {
|
|
81
|
-
this.service
|
|
81
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.On, this.On);
|
|
82
82
|
this.platform.device(`Light: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
83
83
|
}
|
|
84
84
|
}
|
package/src/irdevices/others.ts
CHANGED
|
@@ -60,7 +60,7 @@ export class Others {
|
|
|
60
60
|
if (this.Active === undefined) {
|
|
61
61
|
this.platform.debug(`Other: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
62
62
|
} else {
|
|
63
|
-
this.service
|
|
63
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
|
|
64
64
|
this.platform.device(`Other: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -175,6 +175,6 @@ export class Others {
|
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
public apiError(e: any) {
|
|
178
|
-
this.service
|
|
178
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.Active, e);
|
|
179
179
|
}
|
|
180
180
|
}
|
package/src/irdevices/tvs.ts
CHANGED
|
@@ -214,13 +214,13 @@ export class TV {
|
|
|
214
214
|
if (this.Active === undefined) {
|
|
215
215
|
this.platform.debug(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
216
216
|
} else {
|
|
217
|
-
this.service
|
|
217
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
|
|
218
218
|
this.platform.device(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
219
219
|
}
|
|
220
220
|
if (this.ActiveIdentifier === undefined) {
|
|
221
221
|
this.platform.debug(`${this.device.remoteType}: ${this.accessory.displayName} ActiveIdentifier: ${this.ActiveIdentifier}`);
|
|
222
222
|
} else {
|
|
223
|
-
this.service
|
|
223
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.ActiveIdentifier, this.ActiveIdentifier);
|
|
224
224
|
this.platform.device(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
225
225
|
+ ` updateCharacteristic ActiveIdentifier: ${this.ActiveIdentifier}`);
|
|
226
226
|
}
|
|
@@ -63,7 +63,7 @@ export class VacuumCleaner {
|
|
|
63
63
|
if (this.On === undefined) {
|
|
64
64
|
this.platform.debug(`Vacuum Cleaner: ${this.accessory.displayName} On: ${this.On}`);
|
|
65
65
|
} else {
|
|
66
|
-
this.service
|
|
66
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.On, this.On);
|
|
67
67
|
this.platform.device(`Vacuum Cleaner: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -77,7 +77,7 @@ export class WaterHeater {
|
|
|
77
77
|
if (this.Active === undefined) {
|
|
78
78
|
this.platform.debug(`Water Heater: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
79
79
|
} else {
|
|
80
|
-
this.service
|
|
80
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
|
|
81
81
|
this.platform.device(`Water Heater: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
82
82
|
}
|
|
83
83
|
}
|
package/src/platform.ts
CHANGED
|
@@ -1451,6 +1451,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1451
1451
|
device(...log: any[]) {
|
|
1452
1452
|
if (this.config.options!.debug === 'device') {
|
|
1453
1453
|
this.log.warn('[DEVICE]', String(...log));
|
|
1454
|
+
} else if (this.config.options!.debug === 'debug') {
|
|
1455
|
+
this.log.info('[DEBUG]', String(...log));
|
|
1454
1456
|
} else {
|
|
1455
1457
|
this.log.debug(String(...log));
|
|
1456
1458
|
}
|