@switchbot/homebridge-switchbot 2.2.2 → 2.2.3-beta.0
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/.github/npm-version-script.js +81 -0
- package/config.schema.json +9 -0
- package/dist/irdevice/airconditioner.d.ts +4 -0
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +29 -22
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/tv.d.ts +4 -0
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +93 -54
- package/dist/irdevice/tv.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 +7 -7
- package/src/irdevice/airconditioner.ts +31 -22
- package/src/irdevice/tv.ts +94 -54
- package/src/settings.ts +1 -0
|
@@ -38,6 +38,7 @@ export class AirConditioner {
|
|
|
38
38
|
// Config
|
|
39
39
|
disablePushOn?: boolean;
|
|
40
40
|
disablePushOff?: boolean;
|
|
41
|
+
disablePushDetail?: boolean;
|
|
41
42
|
deviceLogging!: string;
|
|
42
43
|
hide_automode?: boolean;
|
|
43
44
|
|
|
@@ -51,6 +52,7 @@ export class AirConditioner {
|
|
|
51
52
|
this.context();
|
|
52
53
|
this.disablePushOnChanges({ device });
|
|
53
54
|
this.disablePushOffChanges({ device });
|
|
55
|
+
this.disablePushDetailChanges({ device });
|
|
54
56
|
|
|
55
57
|
// set accessory information
|
|
56
58
|
accessory
|
|
@@ -210,7 +212,7 @@ export class AirConditioner {
|
|
|
210
212
|
async pushAirConditionerDetailsChanges(): Promise<void> {
|
|
211
213
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushAirConditionerDetailsChanges Active: ${this.Active},`
|
|
212
214
|
+ ` disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`);
|
|
213
|
-
await this.context();
|
|
215
|
+
//await this.context();
|
|
214
216
|
if (this.CurrentMode === undefined) {
|
|
215
217
|
this.CurrentMode = 1;
|
|
216
218
|
}
|
|
@@ -251,7 +253,7 @@ export class AirConditioner {
|
|
|
251
253
|
}
|
|
252
254
|
|
|
253
255
|
async pushChanges(body: Array<body>): Promise<void> {
|
|
254
|
-
if (this.device.connectionType === 'OpenAPI') {
|
|
256
|
+
if (this.device.connectionType === 'OpenAPI' && !this.disablePushDetail) {
|
|
255
257
|
try {
|
|
256
258
|
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${body}`);
|
|
257
259
|
// Make Push On request to the API
|
|
@@ -291,11 +293,6 @@ export class AirConditioner {
|
|
|
291
293
|
req.write(body);
|
|
292
294
|
req.end();
|
|
293
295
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushchanges: ${superStringify(req)}`);
|
|
294
|
-
this.accessory.context.CurrentTemperature = this.CurrentTemperature;
|
|
295
|
-
this.HeatingThresholdTemperature = this.CurrentTemperature;
|
|
296
|
-
this.CoolingThresholdTemperature = this.CurrentTemperature;
|
|
297
|
-
this.accessory.context.HeatingThresholdTemperature = this.HeatingThresholdTemperature;
|
|
298
|
-
this.accessory.context.CoolingThresholdTemperature = this.CoolingThresholdTemperature;
|
|
299
296
|
this.updateHomeKitCharacteristics();
|
|
300
297
|
} catch (e: any) {
|
|
301
298
|
this.apiError({ e });
|
|
@@ -306,18 +303,19 @@ export class AirConditioner {
|
|
|
306
303
|
} else {
|
|
307
304
|
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
308
305
|
+ ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
306
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
307
|
+
+ ` Connection Type: ${this.device.connectionType}, disablePushDetials: ${this.disablePushDetail}`);
|
|
308
|
+
this.updateHomeKitCharacteristics();
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
async CurrentTemperatureGet(): Promise<CharacteristicValue> {
|
|
313
313
|
if (this.CurrentTemperature === undefined) {
|
|
314
314
|
this.CurrentTemperature = 24;
|
|
315
|
-
this.accessory.context.CurrentTemperature = this.CurrentTemperature;
|
|
316
315
|
} else {
|
|
317
|
-
this.
|
|
316
|
+
this.CurrentTemperature = this.accessory.context.CurrentTemperature;
|
|
318
317
|
}
|
|
319
318
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get CurrentTemperature: ${this.CurrentTemperature}`);
|
|
320
|
-
this.accessory.context.CurrentTemperature = this.CurrentTemperature;
|
|
321
319
|
return this.CurrentTemperature;
|
|
322
320
|
}
|
|
323
321
|
|
|
@@ -330,7 +328,6 @@ export class AirConditioner {
|
|
|
330
328
|
this.RotationSpeed = this.CurrentFanSpeed - 1;
|
|
331
329
|
}
|
|
332
330
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get RotationSpeed: ${this.RotationSpeed}`);
|
|
333
|
-
this.accessory.context.RotationSpeed = this.RotationSpeed;
|
|
334
331
|
return this.RotationSpeed;
|
|
335
332
|
}
|
|
336
333
|
|
|
@@ -381,7 +378,6 @@ export class AirConditioner {
|
|
|
381
378
|
` ValidValues: ${this.ValidValues}`,
|
|
382
379
|
);
|
|
383
380
|
}
|
|
384
|
-
this.accessory.context.TargetHeaterCoolerState = this.TargetHeaterCoolerState;
|
|
385
381
|
return this.TargetHeaterCoolerState;
|
|
386
382
|
}
|
|
387
383
|
|
|
@@ -437,7 +433,6 @@ export class AirConditioner {
|
|
|
437
433
|
|
|
438
434
|
async CurrentHeaterCoolerStateGet(): Promise<CharacteristicValue> {
|
|
439
435
|
if (this.Active === this.platform.Characteristic.Active.ACTIVE) {
|
|
440
|
-
await this.context();
|
|
441
436
|
if (this.CurrentTemperature < this.accessory.context.CurrentTemperature) {
|
|
442
437
|
this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.COOLING;
|
|
443
438
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
@@ -452,15 +447,11 @@ export class AirConditioner {
|
|
|
452
447
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
453
448
|
+` Get (INACTIVE) CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
|
|
454
449
|
}
|
|
455
|
-
this.accessory.context.CurrentHeaterCoolerState = this.CurrentHeaterCoolerState;
|
|
456
450
|
return this.CurrentHeaterCoolerState;
|
|
457
451
|
}
|
|
458
452
|
|
|
459
453
|
async HeatingThresholdTemperatureGet(): Promise<CharacteristicValue> {
|
|
460
454
|
await this.context();
|
|
461
|
-
this.CurrentTemperature = this.accessory.context.CurrentTemperature;
|
|
462
|
-
this.HeatingThresholdTemperature = this.accessory.context.CurrentTemperature;
|
|
463
|
-
this.accessory.context.HeatingThresholdTemperature = this.HeatingThresholdTemperature;
|
|
464
455
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get HeatingThresholdTemperature: ${this.HeatingThresholdTemperature}`);
|
|
465
456
|
return this.HeatingThresholdTemperature;
|
|
466
457
|
}
|
|
@@ -474,9 +465,6 @@ export class AirConditioner {
|
|
|
474
465
|
|
|
475
466
|
async CoolingThresholdTemperatureGet(): Promise<CharacteristicValue> {
|
|
476
467
|
await this.context();
|
|
477
|
-
this.CurrentTemperature = this.accessory.context.CurrentTemperature;
|
|
478
|
-
this.CoolingThresholdTemperature = this.accessory.context.CurrentTemperature;
|
|
479
|
-
this.accessory.context.CoolingThresholdTemperature = this.CoolingThresholdTemperature;
|
|
480
468
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get CoolingThresholdTemperature: ${this.CoolingThresholdTemperature}`);
|
|
481
469
|
return this.CoolingThresholdTemperature;
|
|
482
470
|
}
|
|
@@ -567,6 +555,14 @@ export class AirConditioner {
|
|
|
567
555
|
}
|
|
568
556
|
}
|
|
569
557
|
|
|
558
|
+
async disablePushDetailChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
559
|
+
if (device.disablePushDetail === undefined) {
|
|
560
|
+
this.disablePushDetail = false;
|
|
561
|
+
} else {
|
|
562
|
+
this.disablePushDetail = device.disablePushDetail;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
570
566
|
async commandType(): Promise<string> {
|
|
571
567
|
let commandType: string;
|
|
572
568
|
if (this.device.customize) {
|
|
@@ -664,12 +660,22 @@ export class AirConditioner {
|
|
|
664
660
|
}
|
|
665
661
|
if (this.CurrentTemperature === undefined) {
|
|
666
662
|
this.CurrentTemperature = 24;
|
|
663
|
+
} else if (this.CurrentTemperature) {
|
|
664
|
+
this.CurrentTemperature;
|
|
665
|
+
} else if (this.accessory.context.CurrentTemperature === undefined) {
|
|
666
|
+
this.CurrentTemperature = 24;
|
|
667
667
|
} else {
|
|
668
668
|
this.CurrentTemperature = this.accessory.context.CurrentTemperature;
|
|
669
669
|
}
|
|
670
|
-
|
|
671
|
-
|
|
670
|
+
|
|
671
|
+
if (this.CoolingThresholdTemperature === undefined) {
|
|
672
|
+
this.CoolingThresholdTemperature = this.CurrentTemperature;
|
|
672
673
|
}
|
|
674
|
+
|
|
675
|
+
if (this.HeatingThresholdTemperature === undefined) {
|
|
676
|
+
this.HeatingThresholdTemperature = this.CurrentTemperature;
|
|
677
|
+
}
|
|
678
|
+
|
|
673
679
|
if (this.device.irair?.hide_automode) {
|
|
674
680
|
this.hide_automode = this.device.irair?.hide_automode;
|
|
675
681
|
this.accessory.context.hide_automode = this.hide_automode;
|
|
@@ -708,6 +714,9 @@ export class AirConditioner {
|
|
|
708
714
|
if (device.disablePushOff !== undefined) {
|
|
709
715
|
config['disablePushOff'] = device.disablePushOff;
|
|
710
716
|
}
|
|
717
|
+
if (device.disablePushDetail !== undefined) {
|
|
718
|
+
config['disablePushDetail'] = device.disablePushDetail;
|
|
719
|
+
}
|
|
711
720
|
if (Object.entries(config).length !== 0) {
|
|
712
721
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
713
722
|
}
|
package/src/irdevice/tv.ts
CHANGED
|
@@ -26,6 +26,7 @@ export class TV {
|
|
|
26
26
|
// Config
|
|
27
27
|
disablePushOn?: boolean;
|
|
28
28
|
disablePushOff?: boolean;
|
|
29
|
+
disablePushDetail?: boolean;
|
|
29
30
|
deviceLogging!: string;
|
|
30
31
|
|
|
31
32
|
constructor(private readonly platform: SwitchBotPlatform, private accessory: PlatformAccessory, public device: irdevice & irDevicesConfig) {
|
|
@@ -35,6 +36,7 @@ export class TV {
|
|
|
35
36
|
this.context();
|
|
36
37
|
this.disablePushOnChanges({ device });
|
|
37
38
|
this.disablePushOffChanges({ device });
|
|
39
|
+
this.disablePushDetailChanges({ device });
|
|
38
40
|
|
|
39
41
|
// set accessory information
|
|
40
42
|
accessory
|
|
@@ -251,84 +253,111 @@ export class TV {
|
|
|
251
253
|
}
|
|
252
254
|
|
|
253
255
|
async pushOkChanges(): Promise<void> {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
256
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushOkChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
257
|
+
if (!this.disablePushDetail) {
|
|
258
|
+
const body = superStringify({
|
|
259
|
+
'command': 'Ok',
|
|
260
|
+
'parameter': 'default',
|
|
261
|
+
'commandType': 'command',
|
|
262
|
+
});
|
|
263
|
+
await this.pushTVChanges(body);
|
|
264
|
+
}
|
|
260
265
|
}
|
|
261
266
|
|
|
262
267
|
async pushBackChanges(): Promise<void> {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
268
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushBackChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
269
|
+
if (!this.disablePushDetail) {
|
|
270
|
+
const body = superStringify({
|
|
271
|
+
'command': 'Back',
|
|
272
|
+
'parameter': 'default',
|
|
273
|
+
'commandType': 'command',
|
|
274
|
+
});
|
|
275
|
+
await this.pushTVChanges(body);
|
|
276
|
+
}
|
|
269
277
|
}
|
|
270
278
|
|
|
271
279
|
async pushMenuChanges(): Promise<void> {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
280
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushMenuChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
281
|
+
if (!this.disablePushDetail) {
|
|
282
|
+
const body = superStringify({
|
|
283
|
+
'command': 'Menu',
|
|
284
|
+
'parameter': 'default',
|
|
285
|
+
'commandType': 'command',
|
|
286
|
+
});
|
|
287
|
+
await this.pushTVChanges(body);
|
|
288
|
+
}
|
|
278
289
|
}
|
|
279
290
|
|
|
280
291
|
async pushUpChanges(): Promise<void> {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
292
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushUpChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
293
|
+
if (!this.disablePushDetail) {
|
|
294
|
+
const body = superStringify({
|
|
295
|
+
'command': 'Up',
|
|
296
|
+
'parameter': 'default',
|
|
297
|
+
'commandType': 'command',
|
|
298
|
+
});
|
|
299
|
+
await this.pushTVChanges(body);
|
|
300
|
+
}
|
|
287
301
|
}
|
|
288
302
|
|
|
289
303
|
async pushDownChanges(): Promise<void> {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
304
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushDownChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
305
|
+
if (!this.disablePushDetail) {
|
|
306
|
+
const body = superStringify({
|
|
307
|
+
'command': 'Down',
|
|
308
|
+
'parameter': 'default',
|
|
309
|
+
'commandType': 'command',
|
|
310
|
+
});
|
|
311
|
+
await this.pushTVChanges(body);
|
|
312
|
+
}
|
|
296
313
|
}
|
|
297
314
|
|
|
298
315
|
async pushRightChanges(): Promise<void> {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
316
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushRightChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
317
|
+
if (!this.disablePushDetail) {
|
|
318
|
+
const body = superStringify({
|
|
319
|
+
'command': 'Right',
|
|
320
|
+
'parameter': 'default',
|
|
321
|
+
'commandType': 'command',
|
|
322
|
+
});
|
|
323
|
+
await this.pushTVChanges(body);
|
|
324
|
+
}
|
|
305
325
|
}
|
|
306
326
|
|
|
307
327
|
async pushLeftChanges(): Promise<void> {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
328
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushLeftChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
329
|
+
if (!this.disablePushDetail) {
|
|
330
|
+
const body = superStringify({
|
|
331
|
+
'command': 'Left',
|
|
332
|
+
'parameter': 'default',
|
|
333
|
+
'commandType': 'command',
|
|
334
|
+
});
|
|
335
|
+
await this.pushTVChanges(body);
|
|
336
|
+
}
|
|
314
337
|
}
|
|
315
338
|
|
|
316
339
|
async pushVolumeUpChanges(): Promise<void> {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
340
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushVolumeUpChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
341
|
+
if (!this.disablePushDetail) {
|
|
342
|
+
const body = superStringify({
|
|
343
|
+
'command': 'volumeAdd',
|
|
344
|
+
'parameter': 'default',
|
|
345
|
+
'commandType': 'command',
|
|
346
|
+
});
|
|
347
|
+
await this.pushTVChanges(body);
|
|
348
|
+
}
|
|
323
349
|
}
|
|
324
350
|
|
|
325
351
|
async pushVolumeDownChanges(): Promise<void> {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
352
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushVolumeDownChanges disablePushDetail: ${this.disablePushDetail}`);
|
|
353
|
+
if (!this.disablePushDetail) {
|
|
354
|
+
const body = superStringify({
|
|
355
|
+
'command': 'volumeSub',
|
|
356
|
+
'parameter': 'default',
|
|
357
|
+
'commandType': 'command',
|
|
358
|
+
});
|
|
359
|
+
await this.pushTVChanges(body);
|
|
360
|
+
}
|
|
332
361
|
}
|
|
333
362
|
|
|
334
363
|
async pushTVChanges(body: Array<body>): Promise<void> {
|
|
@@ -419,6 +448,14 @@ export class TV {
|
|
|
419
448
|
}
|
|
420
449
|
}
|
|
421
450
|
|
|
451
|
+
async disablePushDetailChanges({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
452
|
+
if (device.disablePushDetail === undefined) {
|
|
453
|
+
this.disablePushDetail = false;
|
|
454
|
+
} else {
|
|
455
|
+
this.disablePushDetail = device.disablePushDetail;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
422
459
|
async commandType(): Promise<string> {
|
|
423
460
|
let commandType: string;
|
|
424
461
|
if (this.device.customize) {
|
|
@@ -544,6 +581,9 @@ export class TV {
|
|
|
544
581
|
if (device.disablePushOff !== undefined) {
|
|
545
582
|
config['disablePushOff'] = device.disablePushOff;
|
|
546
583
|
}
|
|
584
|
+
if (device.disablePushDetail !== undefined) {
|
|
585
|
+
config['disablePushDetail'] = device.disablePushDetail;
|
|
586
|
+
}
|
|
547
587
|
if (Object.entries(config).length !== 0) {
|
|
548
588
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
549
589
|
}
|
package/src/settings.ts
CHANGED