@switchbot/homebridge-switchbot 2.7.1-beta.0 → 2.7.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 +6 -4
- package/dist/device/hub.d.ts +1 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +17 -4
- package/dist/device/hub.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +4 -7
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +69 -134
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/package.json +6 -6
- package/src/device/hub.ts +23 -11
- package/src/irdevice/airconditioner.ts +92 -157
- package/.github/npm-version-script.js +0 -81
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
|
|
1
2
|
import { request } from 'undici';
|
|
2
3
|
import { SwitchBotPlatform } from '../platform';
|
|
3
|
-
import { irDevicesConfig, irdevice
|
|
4
|
-
import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
|
|
4
|
+
import { Devices, irDevicesConfig, irdevice } from '../settings';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Platform Accessory
|
|
@@ -19,8 +19,7 @@ export class AirConditioner {
|
|
|
19
19
|
CurrentRelativeHumidity?: CharacteristicValue;
|
|
20
20
|
TargetHeaterCoolerState!: CharacteristicValue;
|
|
21
21
|
CurrentHeaterCoolerState!: CharacteristicValue;
|
|
22
|
-
|
|
23
|
-
CoolingThresholdTemperature!: CharacteristicValue;
|
|
22
|
+
ThresholdTemperature!: CharacteristicValue;
|
|
24
23
|
|
|
25
24
|
// Others
|
|
26
25
|
state!: string;
|
|
@@ -66,7 +65,7 @@ export class AirConditioner {
|
|
|
66
65
|
// get the Television service if it exists, otherwise create a new Television service
|
|
67
66
|
// you can create multiple services for each accessory
|
|
68
67
|
(this.coolerService = accessory.getService(this.platform.Service.HeaterCooler) || accessory.addService(this.platform.Service.HeaterCooler)),
|
|
69
|
-
|
|
68
|
+
`${accessory.displayName} ${device.remoteType}`;
|
|
70
69
|
|
|
71
70
|
// To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
|
|
72
71
|
// when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
|
|
@@ -80,18 +79,11 @@ export class AirConditioner {
|
|
|
80
79
|
}
|
|
81
80
|
|
|
82
81
|
// handle on / off events using the Active characteristic
|
|
83
|
-
this.coolerService.getCharacteristic(this.platform.Characteristic.Active)
|
|
82
|
+
this.coolerService.getCharacteristic(this.platform.Characteristic.Active)
|
|
83
|
+
.onSet(this.ActiveSet.bind(this));
|
|
84
84
|
|
|
85
|
-
this.coolerService
|
|
86
|
-
.
|
|
87
|
-
.setProps({
|
|
88
|
-
minValue: 0,
|
|
89
|
-
maxValue: 100,
|
|
90
|
-
minStep: 0.01,
|
|
91
|
-
})
|
|
92
|
-
.onGet(() => {
|
|
93
|
-
return this.CurrentTemperatureGet();
|
|
94
|
-
});
|
|
85
|
+
this.coolerService.getCharacteristic(this.platform.Characteristic.CurrentTemperature)
|
|
86
|
+
.onGet(this.CurrentTemperatureGet.bind(this));
|
|
95
87
|
|
|
96
88
|
if (this.hide_automode) {
|
|
97
89
|
this.TargetHeaterCoolerState = 1 || 2;
|
|
@@ -108,64 +100,46 @@ export class AirConditioner {
|
|
|
108
100
|
` hide_automode: ${this.hide_automode}, TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`,
|
|
109
101
|
);
|
|
110
102
|
}
|
|
103
|
+
|
|
111
104
|
if (this.meter) {
|
|
112
105
|
this.coolerService
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return this.CurrentRelativeHumidityGet();
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
this.coolerService
|
|
122
|
-
.getCharacteristic(this.platform.Characteristic.TargetHeaterCoolerState)
|
|
106
|
+
.getCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity)
|
|
107
|
+
.onGet(this.CurrentRelativeHumidityGet.bind(this));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
this.coolerService.getCharacteristic(this.platform.Characteristic.TargetHeaterCoolerState)
|
|
123
111
|
.setProps({
|
|
124
112
|
validValues: this.ValidValues,
|
|
125
113
|
})
|
|
126
|
-
.onGet(
|
|
127
|
-
return this.TargetHeaterCoolerStateGet();
|
|
128
|
-
})
|
|
114
|
+
.onGet(this.TargetHeaterCoolerStateGet.bind(this))
|
|
129
115
|
.onSet(this.TargetHeaterCoolerStateSet.bind(this));
|
|
130
116
|
|
|
131
|
-
this.coolerService.getCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState)
|
|
132
|
-
|
|
133
|
-
});
|
|
117
|
+
this.coolerService.getCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState)
|
|
118
|
+
.onGet(this.CurrentHeaterCoolerStateGet.bind(this));
|
|
134
119
|
|
|
135
|
-
|
|
136
|
-
|
|
120
|
+
|
|
121
|
+
this.coolerService.getCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature)
|
|
137
122
|
.setProps({
|
|
138
|
-
|
|
139
|
-
maxValue: 30,
|
|
140
|
-
minStep: 1,
|
|
123
|
+
minStep: 0.5,
|
|
141
124
|
})
|
|
142
|
-
.onGet(()
|
|
143
|
-
|
|
144
|
-
})
|
|
145
|
-
.onSet(this.HeatingThresholdTemperatureSet.bind(this));
|
|
125
|
+
.onGet(this.ThresholdTemperatureGet.bind(this))
|
|
126
|
+
.onSet(this.ThresholdTemperatureSet.bind(this));
|
|
146
127
|
|
|
147
|
-
this.coolerService
|
|
148
|
-
.getCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature)
|
|
128
|
+
this.coolerService.getCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature)
|
|
149
129
|
.setProps({
|
|
150
|
-
|
|
151
|
-
maxValue: 30,
|
|
152
|
-
minStep: 1,
|
|
153
|
-
})
|
|
154
|
-
.onGet(() => {
|
|
155
|
-
return this.CoolingThresholdTemperatureGet();
|
|
130
|
+
minStep: 0.5,
|
|
156
131
|
})
|
|
157
|
-
.
|
|
132
|
+
.onGet(this.ThresholdTemperatureGet.bind(this))
|
|
133
|
+
.onSet(this.ThresholdTemperatureSet.bind(this));
|
|
158
134
|
|
|
159
|
-
this.coolerService
|
|
160
|
-
.getCharacteristic(this.platform.Characteristic.RotationSpeed)
|
|
135
|
+
this.coolerService.getCharacteristic(this.platform.Characteristic.RotationSpeed)
|
|
161
136
|
.setProps({
|
|
137
|
+
format: "int",
|
|
162
138
|
minStep: 1,
|
|
163
139
|
minValue: 1,
|
|
164
140
|
maxValue: 4,
|
|
165
141
|
})
|
|
166
|
-
.onGet(
|
|
167
|
-
return this.RotationSpeedGet();
|
|
168
|
-
})
|
|
142
|
+
.onGet(this.RotationSpeedGet.bind(this))
|
|
169
143
|
.onSet(this.RotationSpeedSet.bind(this));
|
|
170
144
|
}
|
|
171
145
|
|
|
@@ -237,19 +211,20 @@ export class AirConditioner {
|
|
|
237
211
|
this.state = 'off';
|
|
238
212
|
}
|
|
239
213
|
if (this.CurrentMode === 1) {
|
|
240
|
-
|
|
214
|
+
// Remove or make configurable?
|
|
215
|
+
this.ThresholdTemperature = 25;
|
|
241
216
|
this.debugLog(
|
|
242
217
|
`${this.device.remoteType}: ${this.accessory.displayName} CurrentMode: ${this.CurrentMode},`
|
|
243
|
-
+ `
|
|
218
|
+
+ ` ThresholdTemperature: ${this.ThresholdTemperature}`,
|
|
244
219
|
);
|
|
245
220
|
}
|
|
246
|
-
const parameter = `${this.
|
|
221
|
+
const parameter = `${this.ThresholdTemperature},${this.CurrentMode},${this.CurrentFanSpeed},${this.state}`;
|
|
247
222
|
|
|
248
223
|
if (this.Active === this.platform.Characteristic.Active.ACTIVE) {
|
|
249
224
|
await this.context();
|
|
250
|
-
if (this.
|
|
225
|
+
if (this.ThresholdTemperature < this.accessory.context.CurrentTemperature) {
|
|
251
226
|
this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.COOLING;
|
|
252
|
-
} else if (this.
|
|
227
|
+
} else if (this.ThresholdTemperature > this.accessory.context.CurrentTemperature) {
|
|
253
228
|
this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.HEATING;
|
|
254
229
|
}
|
|
255
230
|
} else {
|
|
@@ -289,14 +264,16 @@ export class AirConditioner {
|
|
|
289
264
|
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
290
265
|
+ ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
291
266
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
292
|
-
+ ` Connection Type: ${this.device.connectionType},
|
|
267
|
+
+ ` Connection Type: ${this.device.connectionType}, disablePushDetails: ${this.disablePushDetail}`);
|
|
293
268
|
this.updateHomeKitCharacteristics();
|
|
294
269
|
}
|
|
295
270
|
}
|
|
296
271
|
|
|
297
272
|
async CurrentTemperatureGet(): Promise<CharacteristicValue> {
|
|
298
|
-
if (this.meter
|
|
299
|
-
this.CurrentTemperature = this.meter.context
|
|
273
|
+
if (this.meter) {
|
|
274
|
+
this.CurrentTemperature = this.meter.context?.CurrentTemperature
|
|
275
|
+
|| this.meter.getService(this.platform.Service.TemperatureSensor)?.getCharacteristic(this.platform.Characteristic.CurrentTemperature).value
|
|
276
|
+
|| 24;
|
|
300
277
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using CurrentTemperature from ${this.meter.context?.deviceType} (${this.meter.context?.deviceID})`)
|
|
301
278
|
} else if (this.CurrentTemperature === undefined) {
|
|
302
279
|
this.CurrentTemperature = 24;
|
|
@@ -308,24 +285,24 @@ export class AirConditioner {
|
|
|
308
285
|
}
|
|
309
286
|
|
|
310
287
|
async CurrentRelativeHumidityGet(): Promise<CharacteristicValue> {
|
|
311
|
-
if (this.meter
|
|
312
|
-
|
|
313
|
-
this.
|
|
288
|
+
if (this.meter) {
|
|
289
|
+
this.CurrentRelativeHumidity = this.meter.context?.CurrentRelativeHumidity
|
|
290
|
+
|| this.meter.getService(this.platform.Service.HumiditySensor)?.getCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity).value
|
|
291
|
+
|| 0;
|
|
292
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using CurrentRelativeHumidity from ${this.meter.context?.deviceType} (${this.meter.context?.deviceID})`)
|
|
314
293
|
}
|
|
315
294
|
else if (this.CurrentRelativeHumidity === undefined) {
|
|
316
|
-
|
|
295
|
+
this.CurrentRelativeHumidity = 0;
|
|
317
296
|
}
|
|
318
297
|
else {
|
|
319
|
-
|
|
298
|
+
this.CurrentRelativeHumidity = this.accessory.context.CurrentRelativeHumidity;
|
|
320
299
|
}
|
|
321
300
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
|
|
322
301
|
return this.CurrentRelativeHumidity as CharacteristicValue;
|
|
323
|
-
}
|
|
302
|
+
}
|
|
324
303
|
|
|
325
304
|
async RotationSpeedGet(): Promise<number> {
|
|
326
|
-
if (!this.CurrentFanSpeed) {
|
|
327
|
-
this.RotationSpeed = 4;
|
|
328
|
-
} else if (this.CurrentFanSpeed === 1) {
|
|
305
|
+
if (!this.CurrentFanSpeed || this.CurrentFanSpeed === 1) {
|
|
329
306
|
this.RotationSpeed = 4;
|
|
330
307
|
} else {
|
|
331
308
|
this.RotationSpeed = this.CurrentFanSpeed - 1;
|
|
@@ -385,30 +362,17 @@ export class AirConditioner {
|
|
|
385
362
|
}
|
|
386
363
|
|
|
387
364
|
async TargetHeaterCoolerStateSet(value: CharacteristicValue): Promise<void> {
|
|
388
|
-
if (this.hide_automode) {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
this.errorLog(
|
|
395
|
-
`${this.device.remoteType}: ${this.accessory.displayName} Set TargetHeaterCoolerState: ${this.TargetHeaterCoolerState},` +
|
|
396
|
-
` hide_automode: ${this.hide_automode} `,
|
|
397
|
-
);
|
|
398
|
-
}
|
|
365
|
+
if (!this.hide_automode && value === this.platform.Characteristic.TargetHeaterCoolerState.AUTO) {
|
|
366
|
+
this.TargetHeaterCoolerStateAUTO();
|
|
367
|
+
} else if (value === this.platform.Characteristic.TargetHeaterCoolerState.HEAT) {
|
|
368
|
+
this.TargetHeaterCoolerStateHEAT();
|
|
369
|
+
} else if (value === this.platform.Characteristic.TargetHeaterCoolerState.COOL) {
|
|
370
|
+
this.TargetHeaterCoolerStateCOOL();
|
|
399
371
|
} else {
|
|
400
|
-
|
|
401
|
-
this.
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
} else if (value === this.platform.Characteristic.TargetHeaterCoolerState.COOL) {
|
|
405
|
-
this.TargetHeaterCoolerStateCOOL();
|
|
406
|
-
} else {
|
|
407
|
-
this.errorLog(
|
|
408
|
-
`${this.device.remoteType}: ${this.accessory.displayName} Set TargetHeaterCoolerState: ${this.TargetHeaterCoolerState},` +
|
|
409
|
-
` hide_automode: ${this.hide_automode} `,
|
|
410
|
-
);
|
|
411
|
-
}
|
|
372
|
+
this.errorLog(
|
|
373
|
+
`${this.device.remoteType}: ${this.accessory.displayName} Set TargetHeaterCoolerState: ${this.TargetHeaterCoolerState},` +
|
|
374
|
+
` hide_automode: ${this.hide_automode} `,
|
|
375
|
+
);
|
|
412
376
|
}
|
|
413
377
|
this.pushAirConditionerStatusChanges();
|
|
414
378
|
}
|
|
@@ -436,11 +400,11 @@ export class AirConditioner {
|
|
|
436
400
|
|
|
437
401
|
async CurrentHeaterCoolerStateGet(): Promise<CharacteristicValue> {
|
|
438
402
|
if (this.Active === this.platform.Characteristic.Active.ACTIVE) {
|
|
439
|
-
if (this.
|
|
403
|
+
if (this.ThresholdTemperature < this.accessory.context.CurrentTemperature) {
|
|
440
404
|
this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.COOLING;
|
|
441
405
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
442
|
-
+ ` Get (
|
|
443
|
-
} else if (this.
|
|
406
|
+
+ ` Get (COOLING) CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
|
|
407
|
+
} else if (this.ThresholdTemperature > this.accessory.context.CurrentTemperature) {
|
|
444
408
|
this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.HEATING;
|
|
445
409
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
446
410
|
+ ` Get (HEATING) CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
|
|
@@ -453,29 +417,16 @@ export class AirConditioner {
|
|
|
453
417
|
return this.CurrentHeaterCoolerState;
|
|
454
418
|
}
|
|
455
419
|
|
|
456
|
-
async
|
|
457
|
-
await this.context();
|
|
458
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get HeatingThresholdTemperature: ${this.HeatingThresholdTemperature}`);
|
|
459
|
-
return this.HeatingThresholdTemperature;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
async HeatingThresholdTemperatureSet(value: CharacteristicValue): Promise<void> {
|
|
463
|
-
this.CurrentTemperature = value;
|
|
464
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set HeatingThresholdTemperature: ${this.HeatingThresholdTemperature},` +
|
|
465
|
-
` CurrentTemperatureCached: ${this.accessory.context.CurrentTemperature}`);
|
|
466
|
-
this.pushAirConditionerStatusChanges();
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
async CoolingThresholdTemperatureGet(): Promise<CharacteristicValue> {
|
|
420
|
+
async ThresholdTemperatureGet(): Promise<CharacteristicValue> {
|
|
470
421
|
await this.context();
|
|
471
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get
|
|
472
|
-
return this.
|
|
422
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Get ThresholdTemperature: ${this.ThresholdTemperature}`);
|
|
423
|
+
return this.ThresholdTemperature;
|
|
473
424
|
}
|
|
474
425
|
|
|
475
|
-
async
|
|
476
|
-
this.
|
|
477
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set
|
|
478
|
-
`
|
|
426
|
+
async ThresholdTemperatureSet(value: CharacteristicValue): Promise<void> {
|
|
427
|
+
this.ThresholdTemperature = value;
|
|
428
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Set ThresholdTemperature: ${this.ThresholdTemperature},` +
|
|
429
|
+
` ThresholdTemperatureCached: ${this.accessory.context.ThresholdTemperature}`);
|
|
479
430
|
this.pushAirConditionerStatusChanges();
|
|
480
431
|
}
|
|
481
432
|
|
|
@@ -503,14 +454,14 @@ export class AirConditioner {
|
|
|
503
454
|
}
|
|
504
455
|
if (this.meter) {
|
|
505
456
|
if (this.CurrentRelativeHumidity === undefined) {
|
|
506
|
-
|
|
457
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
|
|
507
458
|
}
|
|
508
459
|
else {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
460
|
+
this.accessory.context.CurrentRelativeHumidity = this.CurrentRelativeHumidity;
|
|
461
|
+
this.coolerService?.updateCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity, this.CurrentRelativeHumidity);
|
|
462
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
|
|
512
463
|
}
|
|
513
|
-
|
|
464
|
+
}
|
|
514
465
|
if (this.TargetHeaterCoolerState === undefined) {
|
|
515
466
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
|
|
516
467
|
} else {
|
|
@@ -530,24 +481,15 @@ export class AirConditioner {
|
|
|
530
481
|
+ ` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`,
|
|
531
482
|
);
|
|
532
483
|
}
|
|
533
|
-
if (this.
|
|
534
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}
|
|
535
|
-
} else {
|
|
536
|
-
this.accessory.context.HeatingThresholdTemperature = this.HeatingThresholdTemperature;
|
|
537
|
-
this.coolerService?.updateCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature, this.HeatingThresholdTemperature);
|
|
538
|
-
this.debugLog(
|
|
539
|
-
`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
540
|
-
+ ` updateCharacteristic HeatingThresholdTemperature: ${this.HeatingThresholdTemperature}`,
|
|
541
|
-
);
|
|
542
|
-
}
|
|
543
|
-
if (this.CoolingThresholdTemperature === undefined) {
|
|
544
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CoolingThresholdTemperature: ${this.CoolingThresholdTemperature}`);
|
|
484
|
+
if (this.ThresholdTemperature === undefined) {
|
|
485
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} ThresholdTemperature: ${this.ThresholdTemperature}`);
|
|
545
486
|
} else {
|
|
546
|
-
this.accessory.context.
|
|
547
|
-
this.coolerService?.updateCharacteristic(this.platform.Characteristic.
|
|
487
|
+
this.accessory.context.ThresholdTemperature = this.ThresholdTemperature;
|
|
488
|
+
this.coolerService?.updateCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature, this.ThresholdTemperature);
|
|
489
|
+
this.coolerService?.updateCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature, this.ThresholdTemperature);
|
|
548
490
|
this.debugLog(
|
|
549
491
|
`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
550
|
-
+ ` updateCharacteristic
|
|
492
|
+
+ ` updateCharacteristic ThresholdTemperature: ${this.ThresholdTemperature}`,
|
|
551
493
|
);
|
|
552
494
|
}
|
|
553
495
|
}
|
|
@@ -646,6 +588,7 @@ export class AirConditioner {
|
|
|
646
588
|
this.coolerService.updateCharacteristic(this.platform.Characteristic.Active, e);
|
|
647
589
|
this.coolerService.updateCharacteristic(this.platform.Characteristic.RotationSpeed, e);
|
|
648
590
|
this.coolerService.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, e);
|
|
591
|
+
this.coolerService.updateCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity, e);
|
|
649
592
|
this.coolerService.updateCharacteristic(this.platform.Characteristic.TargetHeaterCoolerState, e);
|
|
650
593
|
this.coolerService.updateCharacteristic(this.platform.Characteristic.CurrentHeaterCoolerState, e);
|
|
651
594
|
this.coolerService.updateCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature, e);
|
|
@@ -686,12 +629,8 @@ export class AirConditioner {
|
|
|
686
629
|
this.CurrentTemperature = this.accessory.context.CurrentTemperature;
|
|
687
630
|
}
|
|
688
631
|
|
|
689
|
-
if (this.
|
|
690
|
-
this.
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
if (this.HeatingThresholdTemperature === undefined) {
|
|
694
|
-
this.HeatingThresholdTemperature = this.CurrentTemperature;
|
|
632
|
+
if (this.ThresholdTemperature === undefined) {
|
|
633
|
+
this.ThresholdTemperature = 24;
|
|
695
634
|
}
|
|
696
635
|
|
|
697
636
|
if (this.device.irair?.hide_automode) {
|
|
@@ -701,17 +640,17 @@ export class AirConditioner {
|
|
|
701
640
|
this.hide_automode = this.device.irair?.hide_automode;
|
|
702
641
|
this.accessory.context.hide_automode = this.hide_automode;
|
|
703
642
|
}
|
|
704
|
-
|
|
643
|
+
|
|
705
644
|
if (this.device.irair?.meterUuid) {
|
|
706
|
-
this.meter = this.platform.accessories.find((accessory) => accessory.UUID === this.device.irair?.meterUuid)
|
|
645
|
+
this.meter = this.platform.accessories.find((accessory) => accessory.UUID === this.device.irair?.meterUuid);
|
|
707
646
|
}
|
|
708
647
|
if (this.meter) {
|
|
709
648
|
if (this.CurrentRelativeHumidity === undefined) {
|
|
710
|
-
|
|
649
|
+
this.CurrentRelativeHumidity = 0;
|
|
711
650
|
} else {
|
|
712
|
-
|
|
651
|
+
this.CurrentRelativeHumidity = this.accessory.context.CurrentRelativeHumidity;
|
|
713
652
|
}
|
|
714
|
-
|
|
653
|
+
}
|
|
715
654
|
}
|
|
716
655
|
|
|
717
656
|
async config({ device }: { device: irdevice & irDevicesConfig; }): Promise<void> {
|
|
@@ -783,10 +722,8 @@ export class AirConditioner {
|
|
|
783
722
|
}
|
|
784
723
|
|
|
785
724
|
debugWarnLog(...log: any[]): void {
|
|
786
|
-
if (this.enablingDeviceLogging()) {
|
|
787
|
-
|
|
788
|
-
this.platform.log.warn('[DEBUG]', String(...log));
|
|
789
|
-
}
|
|
725
|
+
if (this.enablingDeviceLogging() && this.deviceLogging?.includes('debug')) {
|
|
726
|
+
this.platform.log.warn('[DEBUG]', String(...log));
|
|
790
727
|
}
|
|
791
728
|
}
|
|
792
729
|
|
|
@@ -797,10 +734,8 @@ export class AirConditioner {
|
|
|
797
734
|
}
|
|
798
735
|
|
|
799
736
|
debugErrorLog(...log: any[]): void {
|
|
800
|
-
if (this.enablingDeviceLogging()) {
|
|
801
|
-
|
|
802
|
-
this.platform.log.error('[DEBUG]', String(...log));
|
|
803
|
-
}
|
|
737
|
+
if (this.enablingDeviceLogging() && this.deviceLogging?.includes('debug')) {
|
|
738
|
+
this.platform.log.error('[DEBUG]', String(...log));
|
|
804
739
|
}
|
|
805
740
|
}
|
|
806
741
|
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
#!/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This scripts queries the npm registry to pull out the latest version for a given tag.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const fs = require("fs");
|
|
8
|
-
const semver = require("semver");
|
|
9
|
-
const child_process = require("child_process");
|
|
10
|
-
const assert = require("assert");
|
|
11
|
-
|
|
12
|
-
const BRANCH_VERSION_PATTERN = /^([A-Za-z]*)-(\d+.\d+.\d+)$/
|
|
13
|
-
|
|
14
|
-
// Load the contents of the package.json file
|
|
15
|
-
const packageJSON = JSON.parse(fs.readFileSync("package.json", "utf8"));
|
|
16
|
-
|
|
17
|
-
let refArgument = process.argv[2];
|
|
18
|
-
let tagArgument = process.argv[3] || "latest";
|
|
19
|
-
|
|
20
|
-
if (refArgument == null) {
|
|
21
|
-
console.error("ref argument is missing");
|
|
22
|
-
console.error("Usage: npm-version-script.js <ref> [tag]");
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Queries the NPM registry for the latest version for the provided tag.
|
|
28
|
-
* @param tag The tag to query for.
|
|
29
|
-
* @returns {string} Returns the version.
|
|
30
|
-
*/
|
|
31
|
-
function getTagVersionFromNpm(tag) {
|
|
32
|
-
try {
|
|
33
|
-
return child_process.execSync(`npm info ${packageJSON.name} version --tag="${tag}"`).toString("utf8").trim();
|
|
34
|
-
} catch (e) {
|
|
35
|
-
throw e;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function desiredTargetVersion(ref) {
|
|
40
|
-
// ref is a GitHub action ref string
|
|
41
|
-
if (ref.startsWith("refs/pull/")) {
|
|
42
|
-
throw Error("The version script was executed inside a PR!");
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
assert(ref.startsWith("refs/heads/"))
|
|
46
|
-
let branchName = ref.slice("refs/heads/".length);
|
|
47
|
-
|
|
48
|
-
let results = branchName.match(BRANCH_VERSION_PATTERN);
|
|
49
|
-
if (results != null) {
|
|
50
|
-
if (results[1] !== tagArgument) {
|
|
51
|
-
console.warn(`The base branch name (${results[1]}) differs from the tag name ${tagArgument}`);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return results[2];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// legacy mode were we use the `betaVersion` property in the package.json
|
|
58
|
-
if (branchName === "beta" && packageJSON.betaVersion) {
|
|
59
|
-
return packageJSON.betaVersion
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
throw new Error("Malformed branch name for ref: " + ref + ". Can't derive the base version. Use a branch name like: beta-x.x.x!");
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// derive the base version from the branch ref
|
|
66
|
-
const baseVersion = desiredTargetVersion(refArgument);
|
|
67
|
-
|
|
68
|
-
// query the npm registry for the latest version of the provided tag name
|
|
69
|
-
const latestReleasedVersion = getTagVersionFromNpm(tagArgument); // e.g. 0.7.0-beta.12
|
|
70
|
-
const latestReleaseBase = semver.inc(latestReleasedVersion, "patch"); // will produce 0.7.0 (removing the preid, needed for the equality check below)
|
|
71
|
-
|
|
72
|
-
let publishTag;
|
|
73
|
-
if (semver.eq(baseVersion, latestReleaseBase)) { // check if we are releasing another version for the latest beta
|
|
74
|
-
publishTag = latestReleasedVersion; // set the current latest beta to be incremented
|
|
75
|
-
} else {
|
|
76
|
-
publishTag = baseVersion; // start of with a new beta version
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// save the package.json
|
|
80
|
-
packageJSON.version = publishTag;
|
|
81
|
-
fs.writeFileSync("package.json", JSON.stringify(packageJSON, null, 2));
|