@switchbot/homebridge-switchbot 2.8.0-beta.5 → 2.8.0-beta.7
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.js +2 -2
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.js +2 -2
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +5 -5
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +2 -2
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.js +2 -2
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.js +2 -2
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts +1 -0
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +22 -0
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +2 -2
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.js +2 -2
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +2 -2
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +2 -2
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.js +2 -2
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +3 -3
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +48 -50
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.js +2 -2
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.js +2 -2
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.js +2 -2
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +6 -4
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.js +2 -2
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.js +2 -2
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.js +2 -2
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.js +2 -2
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.js +2 -2
- 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 +2 -2
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.js +2 -2
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +3 -2
- package/dist/platform.js.map +1 -1
- package/package.json +3 -3
- package/src/device/blindtilt.ts +2 -2
- package/src/device/bot.ts +2 -2
- package/src/device/ceilinglight.ts +6 -3
- package/src/device/colorbulb.ts +4 -2
- package/src/device/contact.ts +2 -2
- package/src/device/curtain.ts +2 -2
- package/src/device/hub.ts +23 -0
- package/src/device/humidifier.ts +3 -2
- package/src/device/iosensor.ts +2 -2
- package/src/device/lightstrip.ts +4 -2
- package/src/device/lock.ts +3 -2
- package/src/device/meter.ts +2 -2
- package/src/device/meterplus.ts +56 -53
- package/src/device/motion.ts +2 -2
- package/src/device/plug.ts +2 -2
- package/src/device/robotvacuumcleaner.ts +2 -2
- package/src/irdevice/airconditioner.ts +6 -4
- package/src/irdevice/airpurifier.ts +2 -2
- package/src/irdevice/camera.ts +2 -2
- package/src/irdevice/fan.ts +2 -2
- package/src/irdevice/light.ts +2 -2
- package/src/irdevice/other.ts +2 -2
- package/src/irdevice/tv.ts +2 -2
- package/src/irdevice/vacuumcleaner.ts +2 -2
- package/src/irdevice/waterheater.ts +2 -2
- package/src/platform.ts +3 -2
package/src/device/humidifier.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable brace-style */
|
|
1
2
|
import { Context } from 'vm';
|
|
2
3
|
import { request } from 'undici';
|
|
3
4
|
import { sleep } from '../utils';
|
|
@@ -66,8 +67,8 @@ export class Humidifier {
|
|
|
66
67
|
this.logs(device);
|
|
67
68
|
this.scan(device);
|
|
68
69
|
this.refreshRate(device);
|
|
69
|
-
this.config(device);
|
|
70
70
|
this.context();
|
|
71
|
+
this.config(device);
|
|
71
72
|
|
|
72
73
|
// this is subject we use to track when we need to POST changes to the SwitchBot API
|
|
73
74
|
this.doHumidifierUpdate = new Subject();
|
|
@@ -930,7 +931,7 @@ export class Humidifier {
|
|
|
930
931
|
config['offline'] = device.offline;
|
|
931
932
|
}
|
|
932
933
|
if (Object.entries(config).length !== 0) {
|
|
933
|
-
this.
|
|
934
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
934
935
|
}
|
|
935
936
|
}
|
|
936
937
|
|
package/src/device/iosensor.ts
CHANGED
|
@@ -73,10 +73,10 @@ export class IOSensor {
|
|
|
73
73
|
this.logs(device);
|
|
74
74
|
this.scan(device);
|
|
75
75
|
this.refreshRate(device);
|
|
76
|
-
this.config(device);
|
|
77
76
|
this.context();
|
|
78
77
|
this.setupHistoryService(device);
|
|
79
78
|
this.setupMqtt(device);
|
|
79
|
+
this.config(device);
|
|
80
80
|
|
|
81
81
|
// this is subject we use to track when we need to POST changes to the SwitchBot API
|
|
82
82
|
this.doIOSensorUpdate = new Subject();
|
|
@@ -660,7 +660,7 @@ export class IOSensor {
|
|
|
660
660
|
config['scanDuration'] = device.scanDuration;
|
|
661
661
|
}
|
|
662
662
|
if (Object.entries(config).length !== 0) {
|
|
663
|
-
this.
|
|
663
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
664
664
|
}
|
|
665
665
|
}
|
|
666
666
|
|
package/src/device/lightstrip.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable brace-style */
|
|
1
2
|
import { Context } from 'vm';
|
|
2
3
|
import { request } from 'undici';
|
|
3
4
|
import { sleep } from '../utils';
|
|
@@ -71,8 +72,9 @@ export class StripLight {
|
|
|
71
72
|
this.logs(device);
|
|
72
73
|
this.scan(device);
|
|
73
74
|
this.refreshRate(device);
|
|
74
|
-
this.config(device);
|
|
75
75
|
this.context();
|
|
76
|
+
this.config(device);
|
|
77
|
+
|
|
76
78
|
// this is subject we use to track when we need to POST changes to the SwitchBot API
|
|
77
79
|
this.doStripLightUpdate = new Subject();
|
|
78
80
|
this.stripLightUpdateInProgress = false;
|
|
@@ -1065,7 +1067,7 @@ export class StripLight {
|
|
|
1065
1067
|
config['maxRetry'] = device.maxRetry;
|
|
1066
1068
|
}
|
|
1067
1069
|
if (Object.entries(config).length !== 0) {
|
|
1068
|
-
this.
|
|
1070
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
1069
1071
|
}
|
|
1070
1072
|
}
|
|
1071
1073
|
|
package/src/device/lock.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable brace-style */
|
|
1
2
|
import { Context } from 'vm';
|
|
2
3
|
import { request } from 'undici';
|
|
3
4
|
import { sleep } from '../utils';
|
|
@@ -59,8 +60,8 @@ export class Lock {
|
|
|
59
60
|
this.logs(device);
|
|
60
61
|
this.scan(device);
|
|
61
62
|
this.refreshRate(device);
|
|
62
|
-
this.config(device);
|
|
63
63
|
this.context();
|
|
64
|
+
this.config(device);
|
|
64
65
|
|
|
65
66
|
// this is subject we use to track when we need to POST changes to the SwitchBot API
|
|
66
67
|
this.doLockUpdate = new Subject();
|
|
@@ -646,7 +647,7 @@ export class Lock {
|
|
|
646
647
|
config['scanDuration'] = device.scanDuration;
|
|
647
648
|
}
|
|
648
649
|
if (Object.entries(config).length !== 0) {
|
|
649
|
-
this.
|
|
650
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
650
651
|
}
|
|
651
652
|
}
|
|
652
653
|
|
package/src/device/meter.ts
CHANGED
|
@@ -72,10 +72,10 @@ export class Meter {
|
|
|
72
72
|
this.logs(device);
|
|
73
73
|
this.scan(device);
|
|
74
74
|
this.refreshRate(device);
|
|
75
|
-
this.config(device);
|
|
76
75
|
this.context();
|
|
77
76
|
this.setupHistoryService(device);
|
|
78
77
|
this.setupMqtt(device);
|
|
78
|
+
this.config(device);
|
|
79
79
|
|
|
80
80
|
// this is subject we use to track when we need to POST changes to the SwitchBot API
|
|
81
81
|
this.doMeterUpdate = new Subject();
|
|
@@ -667,7 +667,7 @@ export class Meter {
|
|
|
667
667
|
config['scanDuration'] = device.scanDuration;
|
|
668
668
|
}
|
|
669
669
|
if (Object.entries(config).length !== 0) {
|
|
670
|
-
this.
|
|
670
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
673
|
|
package/src/device/meterplus.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Context } from 'vm';
|
|
2
|
-
import { hostname } from 'os';
|
|
3
|
-
import { request } from 'undici';
|
|
4
|
-
import { sleep } from '../utils';
|
|
5
|
-
import { MqttClient } from 'mqtt';
|
|
6
|
-
import { interval, Subject } from 'rxjs';
|
|
7
1
|
import { connectAsync } from 'async-mqtt';
|
|
2
|
+
import { CharacteristicValue, PlatformAccessory, Service, Units } from 'homebridge';
|
|
3
|
+
import { MqttClient } from 'mqtt';
|
|
4
|
+
import { hostname } from 'os';
|
|
5
|
+
import { Subject, interval } from 'rxjs';
|
|
8
6
|
import { skipWhile } from 'rxjs/operators';
|
|
7
|
+
import { request } from 'undici';
|
|
8
|
+
import { Context } from 'vm';
|
|
9
9
|
import { SwitchBotPlatform } from '../platform';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { Devices, ad, device, deviceStatus, devicesConfig, serviceData, switchbot, temperature } from '../settings';
|
|
11
|
+
import { sleep } from '../utils';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Platform Accessory
|
|
@@ -73,10 +73,10 @@ export class MeterPlus {
|
|
|
73
73
|
this.logs(device);
|
|
74
74
|
this.scan(device);
|
|
75
75
|
this.refreshRate(device);
|
|
76
|
-
this.config(device);
|
|
77
76
|
this.context();
|
|
78
77
|
this.setupHistoryService(device);
|
|
79
78
|
this.setupMqtt(device);
|
|
79
|
+
this.config(device);
|
|
80
80
|
|
|
81
81
|
// this is subject we use to track when we need to POST changes to the SwitchBot API
|
|
82
82
|
this.doMeterUpdate = new Subject();
|
|
@@ -104,7 +104,7 @@ export class MeterPlus {
|
|
|
104
104
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Temperature Sensor Service`);
|
|
105
105
|
(this.temperatureservice =
|
|
106
106
|
this.accessory.getService(this.platform.Service.TemperatureSensor) || this.accessory.addService(this.platform.Service.TemperatureSensor)),
|
|
107
|
-
|
|
107
|
+
`${accessory.displayName} Temperature Sensor`;
|
|
108
108
|
|
|
109
109
|
this.temperatureservice.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Temperature Sensor`);
|
|
110
110
|
if (!this.temperatureservice.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
@@ -135,7 +135,7 @@ export class MeterPlus {
|
|
|
135
135
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Humidity Sensor Service`);
|
|
136
136
|
(this.humidityservice =
|
|
137
137
|
this.accessory.getService(this.platform.Service.HumiditySensor) || this.accessory.addService(this.platform.Service.HumiditySensor)),
|
|
138
|
-
|
|
138
|
+
`${accessory.displayName} Humidity Sensor`;
|
|
139
139
|
|
|
140
140
|
this.humidityservice.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Humidity Sensor`);
|
|
141
141
|
if (!this.humidityservice.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
@@ -154,14 +154,10 @@ export class MeterPlus {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
// Battery Service
|
|
157
|
-
if (!this.
|
|
158
|
-
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Battery Service`);
|
|
159
|
-
this.batteryService = this.accessory.getService(this.platform.Service.Battery);
|
|
160
|
-
accessory.removeService(this.batteryService!);
|
|
161
|
-
} else if (this.BLE && !this.batteryService) {
|
|
157
|
+
if (!this.batteryService) {
|
|
162
158
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Battery Service`);
|
|
163
159
|
(this.batteryService = this.accessory.getService(this.platform.Service.Battery) || this.accessory.addService(this.platform.Service.Battery)),
|
|
164
|
-
|
|
160
|
+
`${accessory.displayName} Battery`;
|
|
165
161
|
|
|
166
162
|
this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`);
|
|
167
163
|
if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
@@ -229,6 +225,16 @@ export class MeterPlus {
|
|
|
229
225
|
|
|
230
226
|
async openAPIparseStatus(): Promise<void> {
|
|
231
227
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIparseStatus`);
|
|
228
|
+
|
|
229
|
+
// Battery
|
|
230
|
+
this.BatteryLevel = Number(this.battery);
|
|
231
|
+
if (this.BatteryLevel < 15) {
|
|
232
|
+
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
|
|
233
|
+
} else {
|
|
234
|
+
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL;
|
|
235
|
+
}
|
|
236
|
+
this.debugLog(`${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}, StatusLowBattery: ${this.StatusLowBattery}`);
|
|
237
|
+
|
|
232
238
|
// Current Relative Humidity
|
|
233
239
|
if (!this.device.meter?.hide_humidity) {
|
|
234
240
|
this.CurrentRelativeHumidity = this.Humidity!;
|
|
@@ -395,28 +401,29 @@ export class MeterPlus {
|
|
|
395
401
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
|
|
396
402
|
}
|
|
397
403
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
}
|
|
405
|
-
this.accessory.context.BatteryLevel = this.BatteryLevel;
|
|
406
|
-
this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, this.BatteryLevel);
|
|
407
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic BatteryLevel: ${this.BatteryLevel}`);
|
|
404
|
+
|
|
405
|
+
if (this.BatteryLevel === undefined) {
|
|
406
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}`);
|
|
407
|
+
} else {
|
|
408
|
+
if (this.device.mqttURL) {
|
|
409
|
+
mqttmessage.push(`"battery": ${this.BatteryLevel}`);
|
|
408
410
|
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
411
|
+
this.accessory.context.BatteryLevel = this.BatteryLevel;
|
|
412
|
+
this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, this.BatteryLevel);
|
|
413
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic BatteryLevel: ${this.BatteryLevel}`);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
if (this.StatusLowBattery === undefined) {
|
|
417
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} StatusLowBattery: ${this.StatusLowBattery}`);
|
|
418
|
+
} else {
|
|
419
|
+
if (this.device.mqttURL) {
|
|
420
|
+
mqttmessage.push(`"lowBattery": ${this.StatusLowBattery}`);
|
|
418
421
|
}
|
|
422
|
+
this.accessory.context.StatusLowBattery = this.StatusLowBattery;
|
|
423
|
+
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, this.StatusLowBattery);
|
|
424
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
|
|
419
425
|
}
|
|
426
|
+
|
|
420
427
|
if (this.device.mqttURL) {
|
|
421
428
|
this.mqttPublish(`{${mqttmessage.join(',')}}`);
|
|
422
429
|
}
|
|
@@ -593,10 +600,8 @@ export class MeterPlus {
|
|
|
593
600
|
if (!this.device.meter?.hide_temperature) {
|
|
594
601
|
this.temperatureservice?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, e);
|
|
595
602
|
}
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
|
|
599
|
-
}
|
|
603
|
+
this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, e);
|
|
604
|
+
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
|
|
600
605
|
}
|
|
601
606
|
|
|
602
607
|
FirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
@@ -627,18 +632,16 @@ export class MeterPlus {
|
|
|
627
632
|
} else {
|
|
628
633
|
this.CurrentTemperature = this.accessory.context.CurrentTemperature;
|
|
629
634
|
}
|
|
630
|
-
if (this.
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
this.StatusLowBattery = this.accessory.context.StatusLowBattery;
|
|
641
|
-
}
|
|
635
|
+
if (this.BatteryLevel === undefined) {
|
|
636
|
+
this.BatteryLevel = 100;
|
|
637
|
+
} else {
|
|
638
|
+
this.BatteryLevel = this.accessory.context.BatteryLevel;
|
|
639
|
+
}
|
|
640
|
+
if (this.StatusLowBattery === undefined) {
|
|
641
|
+
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL;
|
|
642
|
+
this.accessory.context.StatusLowBattery = this.StatusLowBattery;
|
|
643
|
+
} else {
|
|
644
|
+
this.StatusLowBattery = this.accessory.context.StatusLowBattery;
|
|
642
645
|
}
|
|
643
646
|
}
|
|
644
647
|
|
|
@@ -676,7 +679,7 @@ export class MeterPlus {
|
|
|
676
679
|
config['scanDuration'] = device.scanDuration;
|
|
677
680
|
}
|
|
678
681
|
if (Object.entries(config).length !== 0) {
|
|
679
|
-
this.
|
|
682
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
680
683
|
}
|
|
681
684
|
}
|
|
682
685
|
|
package/src/device/motion.ts
CHANGED
|
@@ -68,8 +68,8 @@ export class Motion {
|
|
|
68
68
|
this.logs(device);
|
|
69
69
|
this.scan(device);
|
|
70
70
|
this.refreshRate(device);
|
|
71
|
-
this.config(device);
|
|
72
71
|
this.context();
|
|
72
|
+
this.config(device);
|
|
73
73
|
|
|
74
74
|
// this is subject we use to track when we need to POST changes to the SwitchBot API
|
|
75
75
|
this.doMotionUpdate = new Subject();
|
|
@@ -605,7 +605,7 @@ export class Motion {
|
|
|
605
605
|
config['offline'] = device.offline;
|
|
606
606
|
}
|
|
607
607
|
if (Object.entries(config).length !== 0) {
|
|
608
|
-
this.
|
|
608
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
611
|
|
package/src/device/plug.ts
CHANGED
|
@@ -53,8 +53,8 @@ export class Plug {
|
|
|
53
53
|
this.logs(device);
|
|
54
54
|
this.scan(device);
|
|
55
55
|
this.refreshRate(device);
|
|
56
|
-
this.config(device);
|
|
57
56
|
this.context();
|
|
57
|
+
this.config(device);
|
|
58
58
|
|
|
59
59
|
// this is subject we use to track when we need to POST changes to the SwitchBot API
|
|
60
60
|
this.doPlugUpdate = new Subject();
|
|
@@ -638,7 +638,7 @@ export class Plug {
|
|
|
638
638
|
config['maxRetry'] = device.maxRetry;
|
|
639
639
|
}
|
|
640
640
|
if (Object.entries(config).length !== 0) {
|
|
641
|
-
this.
|
|
641
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
642
642
|
}
|
|
643
643
|
}
|
|
644
644
|
|
|
@@ -51,8 +51,8 @@ export class RobotVacuumCleaner {
|
|
|
51
51
|
this.logs(device);
|
|
52
52
|
this.scan(device);
|
|
53
53
|
this.refreshRate(device);
|
|
54
|
-
this.config(device);
|
|
55
54
|
this.context();
|
|
55
|
+
this.config(device);
|
|
56
56
|
|
|
57
57
|
// this is subject we use to track when we need to POST changes to the SwitchBot API
|
|
58
58
|
this.doRobotVacuumCleanerUpdate = new Subject();
|
|
@@ -758,7 +758,7 @@ export class RobotVacuumCleaner {
|
|
|
758
758
|
config['maxRetry'] = device.maxRetry;
|
|
759
759
|
}
|
|
760
760
|
if (Object.entries(config).length !== 0) {
|
|
761
|
-
this.
|
|
761
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
762
762
|
}
|
|
763
763
|
}
|
|
764
764
|
|
|
@@ -50,11 +50,11 @@ export class AirConditioner {
|
|
|
50
50
|
) {
|
|
51
51
|
// default placeholders
|
|
52
52
|
this.logs({ device });
|
|
53
|
-
this.config({ device });
|
|
54
53
|
this.context();
|
|
55
54
|
this.disablePushOnChanges({ device });
|
|
56
55
|
this.disablePushOffChanges({ device });
|
|
57
56
|
this.disablePushDetailChanges({ device });
|
|
57
|
+
this.config({ device });
|
|
58
58
|
|
|
59
59
|
// set accessory information
|
|
60
60
|
accessory
|
|
@@ -291,7 +291,8 @@ export class AirConditioner {
|
|
|
291
291
|
this.meter.getService(this.platform.Service.TemperatureSensor)?.getCharacteristic(this.platform.Characteristic.CurrentTemperature).value ||
|
|
292
292
|
24;
|
|
293
293
|
this.debugLog(
|
|
294
|
-
`${this.device.remoteType}: ${this.accessory.displayName}
|
|
294
|
+
`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
295
|
+
+ `Using CurrentTemperature from ${this.meter.context?.deviceType} (${this.meter.context?.deviceID})`,
|
|
295
296
|
);
|
|
296
297
|
} else if (this.CurrentTemperature === undefined) {
|
|
297
298
|
this.CurrentTemperature = 24;
|
|
@@ -309,7 +310,8 @@ export class AirConditioner {
|
|
|
309
310
|
this.meter.getService(this.platform.Service.HumiditySensor)?.getCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity).value ||
|
|
310
311
|
0;
|
|
311
312
|
this.debugLog(
|
|
312
|
-
`${this.device.remoteType}: ${this.accessory.displayName}
|
|
313
|
+
`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
314
|
+
+ `Using CurrentRelativeHumidity from ${this.meter.context?.deviceType} (${this.meter.context?.deviceID})`,
|
|
313
315
|
);
|
|
314
316
|
} else if (this.CurrentRelativeHumidity === undefined) {
|
|
315
317
|
this.CurrentRelativeHumidity = 0;
|
|
@@ -715,7 +717,7 @@ export class AirConditioner {
|
|
|
715
717
|
config['disablePushDetail'] = device.disablePushDetail;
|
|
716
718
|
}
|
|
717
719
|
if (Object.entries(config).length !== 0) {
|
|
718
|
-
this.
|
|
720
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
719
721
|
}
|
|
720
722
|
}
|
|
721
723
|
|
|
@@ -45,10 +45,10 @@ export class AirPurifier {
|
|
|
45
45
|
) {
|
|
46
46
|
// default placeholders
|
|
47
47
|
this.logs(device);
|
|
48
|
-
this.config(device);
|
|
49
48
|
this.context();
|
|
50
49
|
this.disablePushOnChanges({ device });
|
|
51
50
|
this.disablePushOffChanges({ device });
|
|
51
|
+
this.config(device);
|
|
52
52
|
|
|
53
53
|
// set accessory information
|
|
54
54
|
accessory
|
|
@@ -420,7 +420,7 @@ export class AirPurifier {
|
|
|
420
420
|
config['disablePushOff'] = device.disablePushOff;
|
|
421
421
|
}
|
|
422
422
|
if (Object.entries(config).length !== 0) {
|
|
423
|
-
this.
|
|
423
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
426
|
|
package/src/irdevice/camera.ts
CHANGED
|
@@ -27,10 +27,10 @@ export class Camera {
|
|
|
27
27
|
) {
|
|
28
28
|
// default placeholders
|
|
29
29
|
this.logs(device);
|
|
30
|
-
this.config(device);
|
|
31
30
|
this.context();
|
|
32
31
|
this.disablePushOnChanges({ device });
|
|
33
32
|
this.disablePushOffChanges({ device });
|
|
33
|
+
this.config(device);
|
|
34
34
|
|
|
35
35
|
// set accessory information
|
|
36
36
|
accessory
|
|
@@ -298,7 +298,7 @@ export class Camera {
|
|
|
298
298
|
config['disablePushOff'] = device.disablePushOff;
|
|
299
299
|
}
|
|
300
300
|
if (Object.entries(config).length !== 0) {
|
|
301
|
-
this.
|
|
301
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
304
|
|
package/src/irdevice/fan.ts
CHANGED
|
@@ -37,10 +37,10 @@ export class Fan {
|
|
|
37
37
|
) {
|
|
38
38
|
// default placeholders
|
|
39
39
|
this.logs(device);
|
|
40
|
-
this.config(device);
|
|
41
40
|
this.context();
|
|
42
41
|
this.disablePushOnChanges({ device });
|
|
43
42
|
this.disablePushOffChanges({ device });
|
|
43
|
+
this.config(device);
|
|
44
44
|
|
|
45
45
|
// set accessory information
|
|
46
46
|
accessory
|
|
@@ -434,7 +434,7 @@ export class Fan {
|
|
|
434
434
|
config['disablePushOff'] = device.disablePushOff;
|
|
435
435
|
}
|
|
436
436
|
if (Object.entries(config).length !== 0) {
|
|
437
|
-
this.
|
|
437
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
|
package/src/irdevice/light.ts
CHANGED
|
@@ -27,10 +27,10 @@ export class Light {
|
|
|
27
27
|
) {
|
|
28
28
|
// default placeholders
|
|
29
29
|
this.logs(device);
|
|
30
|
-
this.config(device);
|
|
31
30
|
this.context();
|
|
32
31
|
this.disablePushOnChanges({ device });
|
|
33
32
|
this.disablePushOffChanges({ device });
|
|
33
|
+
this.config(device);
|
|
34
34
|
|
|
35
35
|
// set accessory information
|
|
36
36
|
accessory
|
|
@@ -323,7 +323,7 @@ export class Light {
|
|
|
323
323
|
config['disablePushOff'] = device.disablePushOff;
|
|
324
324
|
}
|
|
325
325
|
if (Object.entries(config).length !== 0) {
|
|
326
|
-
this.
|
|
326
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
|
package/src/irdevice/other.ts
CHANGED
|
@@ -29,10 +29,10 @@ export class Others {
|
|
|
29
29
|
// default placeholders
|
|
30
30
|
this.logs(device);
|
|
31
31
|
this.deviceType(device);
|
|
32
|
-
this.config(device);
|
|
33
32
|
this.context();
|
|
34
33
|
this.disablePushOnChanges({ device });
|
|
35
34
|
this.disablePushOffChanges({ device });
|
|
35
|
+
this.config(device);
|
|
36
36
|
|
|
37
37
|
// set accessory information
|
|
38
38
|
accessory
|
|
@@ -329,7 +329,7 @@ export class Others {
|
|
|
329
329
|
config['disablePushOff'] = device.disablePushOff;
|
|
330
330
|
}
|
|
331
331
|
if (Object.entries(config).length !== 0) {
|
|
332
|
-
this.
|
|
332
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
|
package/src/irdevice/tv.ts
CHANGED
|
@@ -33,11 +33,11 @@ export class TV {
|
|
|
33
33
|
) {
|
|
34
34
|
// default placeholders
|
|
35
35
|
this.logs(device);
|
|
36
|
-
this.config(device);
|
|
37
36
|
this.context();
|
|
38
37
|
this.disablePushOnChanges({ device });
|
|
39
38
|
this.disablePushOffChanges({ device });
|
|
40
39
|
this.disablePushDetailChanges({ device });
|
|
40
|
+
this.config(device);
|
|
41
41
|
|
|
42
42
|
// set accessory information
|
|
43
43
|
accessory
|
|
@@ -574,7 +574,7 @@ export class TV {
|
|
|
574
574
|
config['disablePushDetail'] = device.disablePushDetail;
|
|
575
575
|
}
|
|
576
576
|
if (Object.entries(config).length !== 0) {
|
|
577
|
-
this.
|
|
577
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
580
|
|
|
@@ -27,10 +27,10 @@ export class VacuumCleaner {
|
|
|
27
27
|
) {
|
|
28
28
|
// default placeholders
|
|
29
29
|
this.logs(device);
|
|
30
|
-
this.config(device);
|
|
31
30
|
this.context();
|
|
32
31
|
this.disablePushOnChanges({ device });
|
|
33
32
|
this.disablePushOffChanges({ device });
|
|
33
|
+
this.config(device);
|
|
34
34
|
|
|
35
35
|
// set accessory information
|
|
36
36
|
accessory
|
|
@@ -294,7 +294,7 @@ export class VacuumCleaner {
|
|
|
294
294
|
config['disablePushOff'] = device.disablePushOff;
|
|
295
295
|
}
|
|
296
296
|
if (Object.entries(config).length !== 0) {
|
|
297
|
-
this.
|
|
297
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
|
|
@@ -27,10 +27,10 @@ export class WaterHeater {
|
|
|
27
27
|
) {
|
|
28
28
|
// default placeholders
|
|
29
29
|
this.logs({ device });
|
|
30
|
-
this.config({ device });
|
|
31
30
|
this.context();
|
|
32
31
|
this.disablePushOnChanges({ device });
|
|
33
32
|
this.disablePushOffChanges({ device });
|
|
33
|
+
this.config({ device });
|
|
34
34
|
|
|
35
35
|
// set accessory information
|
|
36
36
|
accessory
|
|
@@ -303,7 +303,7 @@ export class WaterHeater {
|
|
|
303
303
|
config['disablePushOff'] = device.disablePushOff;
|
|
304
304
|
}
|
|
305
305
|
if (Object.entries(config).length !== 0) {
|
|
306
|
-
this.
|
|
306
|
+
this.debugWarnLog({ log: [`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`] });
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
309
|
|
package/src/platform.ts
CHANGED
|
@@ -138,7 +138,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
138
138
|
platformConfig['pushRate'] = this.config.options.pushRate;
|
|
139
139
|
}
|
|
140
140
|
if (Object.entries(platformConfig).length !== 0) {
|
|
141
|
-
this.
|
|
141
|
+
this.debugWarnLog(`Platform Config: ${JSON.stringify(platformConfig)}`);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
if (this.config.options) {
|
|
@@ -245,7 +245,8 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
245
245
|
} else {
|
|
246
246
|
// eslint-disable-next-line no-useless-escape, max-len
|
|
247
247
|
this.warnLog(
|
|
248
|
-
'This plugin has been updated to use OpenAPI v1.1, config is set with openToken,
|
|
248
|
+
'This plugin has been updated to use OpenAPI v1.1, config is set with openToken, '
|
|
249
|
+
+ '"openToken" config has been moved to the "token" config, please restart Homebridge.',
|
|
249
250
|
);
|
|
250
251
|
}
|
|
251
252
|
|