@switchbot/homebridge-switchbot 2.8.0-beta.4 → 2.8.0-beta.6

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.
Files changed (90) hide show
  1. package/dist/device/blindtilt.js +2 -2
  2. package/dist/device/blindtilt.js.map +1 -1
  3. package/dist/device/bot.js +2 -2
  4. package/dist/device/bot.js.map +1 -1
  5. package/dist/device/ceilinglight.d.ts.map +1 -1
  6. package/dist/device/ceilinglight.js +5 -5
  7. package/dist/device/ceilinglight.js.map +1 -1
  8. package/dist/device/colorbulb.d.ts.map +1 -1
  9. package/dist/device/colorbulb.js +2 -2
  10. package/dist/device/colorbulb.js.map +1 -1
  11. package/dist/device/contact.js +2 -2
  12. package/dist/device/contact.js.map +1 -1
  13. package/dist/device/curtain.js +2 -2
  14. package/dist/device/curtain.js.map +1 -1
  15. package/dist/device/hub.d.ts +1 -0
  16. package/dist/device/hub.d.ts.map +1 -1
  17. package/dist/device/hub.js +22 -0
  18. package/dist/device/hub.js.map +1 -1
  19. package/dist/device/humidifier.d.ts.map +1 -1
  20. package/dist/device/humidifier.js +2 -2
  21. package/dist/device/humidifier.js.map +1 -1
  22. package/dist/device/iosensor.js +2 -2
  23. package/dist/device/iosensor.js.map +1 -1
  24. package/dist/device/lightstrip.d.ts.map +1 -1
  25. package/dist/device/lightstrip.js +2 -2
  26. package/dist/device/lightstrip.js.map +1 -1
  27. package/dist/device/lock.d.ts.map +1 -1
  28. package/dist/device/lock.js +2 -2
  29. package/dist/device/lock.js.map +1 -1
  30. package/dist/device/meter.js +2 -2
  31. package/dist/device/meter.js.map +1 -1
  32. package/dist/device/meterplus.d.ts +3 -3
  33. package/dist/device/meterplus.d.ts.map +1 -1
  34. package/dist/device/meterplus.js +50 -48
  35. package/dist/device/meterplus.js.map +1 -1
  36. package/dist/device/motion.js +2 -2
  37. package/dist/device/motion.js.map +1 -1
  38. package/dist/device/plug.js +2 -2
  39. package/dist/device/plug.js.map +1 -1
  40. package/dist/device/robotvacuumcleaner.js +2 -2
  41. package/dist/device/robotvacuumcleaner.js.map +1 -1
  42. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  43. package/dist/irdevice/airconditioner.js +6 -4
  44. package/dist/irdevice/airconditioner.js.map +1 -1
  45. package/dist/irdevice/airpurifier.js +2 -2
  46. package/dist/irdevice/airpurifier.js.map +1 -1
  47. package/dist/irdevice/camera.js +2 -2
  48. package/dist/irdevice/camera.js.map +1 -1
  49. package/dist/irdevice/fan.js +2 -2
  50. package/dist/irdevice/fan.js.map +1 -1
  51. package/dist/irdevice/light.js +2 -2
  52. package/dist/irdevice/light.js.map +1 -1
  53. package/dist/irdevice/other.js +2 -2
  54. package/dist/irdevice/other.js.map +1 -1
  55. package/dist/irdevice/tv.js +2 -2
  56. package/dist/irdevice/tv.js.map +1 -1
  57. package/dist/irdevice/vacuumcleaner.js +2 -2
  58. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  59. package/dist/irdevice/waterheater.js +2 -2
  60. package/dist/irdevice/waterheater.js.map +1 -1
  61. package/dist/platform.d.ts.map +1 -1
  62. package/dist/platform.js +3 -2
  63. package/dist/platform.js.map +1 -1
  64. package/package.json +3 -3
  65. package/src/device/blindtilt.ts +2 -2
  66. package/src/device/bot.ts +2 -2
  67. package/src/device/ceilinglight.ts +6 -3
  68. package/src/device/colorbulb.ts +4 -2
  69. package/src/device/contact.ts +2 -2
  70. package/src/device/curtain.ts +2 -2
  71. package/src/device/hub.ts +23 -0
  72. package/src/device/humidifier.ts +3 -2
  73. package/src/device/iosensor.ts +2 -2
  74. package/src/device/lightstrip.ts +4 -2
  75. package/src/device/lock.ts +3 -2
  76. package/src/device/meter.ts +2 -2
  77. package/src/device/meterplus.ts +53 -56
  78. package/src/device/motion.ts +2 -2
  79. package/src/device/plug.ts +2 -2
  80. package/src/device/robotvacuumcleaner.ts +2 -2
  81. package/src/irdevice/airconditioner.ts +6 -4
  82. package/src/irdevice/airpurifier.ts +2 -2
  83. package/src/irdevice/camera.ts +2 -2
  84. package/src/irdevice/fan.ts +2 -2
  85. package/src/irdevice/light.ts +2 -2
  86. package/src/irdevice/other.ts +2 -2
  87. package/src/irdevice/tv.ts +2 -2
  88. package/src/irdevice/vacuumcleaner.ts +2 -2
  89. package/src/irdevice/waterheater.ts +2 -2
  90. package/src/platform.ts +3 -2
@@ -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.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
934
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
934
935
  }
935
936
  }
936
937
 
@@ -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.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
663
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
664
664
  }
665
665
  }
666
666
 
@@ -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.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
1070
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
1069
1071
  }
1070
1072
  }
1071
1073
 
@@ -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.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
650
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
650
651
  }
651
652
  }
652
653
 
@@ -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.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
670
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
671
671
  }
672
672
  }
673
673
 
@@ -1,14 +1,14 @@
1
- import { connectAsync } from 'async-mqtt';
2
- import { CharacteristicValue, PlatformAccessory, Service, Units } from 'homebridge';
3
- import { MqttClient } from 'mqtt';
1
+ import { Context } from 'vm';
4
2
  import { hostname } from 'os';
5
- import { Subject, interval } from 'rxjs';
6
- import { skipWhile } from 'rxjs/operators';
7
3
  import { request } from 'undici';
8
- import { Context } from 'vm';
9
- import { SwitchBotPlatform } from '../platform';
10
- import { Devices, ad, device, deviceStatus, devicesConfig, serviceData, switchbot, temperature } from '../settings';
11
4
  import { sleep } from '../utils';
5
+ import { MqttClient } from 'mqtt';
6
+ import { interval, Subject } from 'rxjs';
7
+ import { connectAsync } from 'async-mqtt';
8
+ import { skipWhile } from 'rxjs/operators';
9
+ import { SwitchBotPlatform } from '../platform';
10
+ import { Service, PlatformAccessory, Units, CharacteristicValue } from 'homebridge';
11
+ import { device, devicesConfig, serviceData, ad, switchbot, temperature, deviceStatus, Devices } from '../settings';
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
- `${accessory.displayName} Temperature Sensor`;
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
- `${accessory.displayName} Humidity Sensor`;
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,10 +154,14 @@ export class MeterPlus {
154
154
  }
155
155
 
156
156
  // Battery Service
157
- if (!this.batteryService) {
157
+ if (!this.BLE) {
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) {
158
162
  this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Battery Service`);
159
163
  (this.batteryService = this.accessory.getService(this.platform.Service.Battery) || this.accessory.addService(this.platform.Service.Battery)),
160
- `${accessory.displayName} Battery`;
164
+ `${accessory.displayName} Battery`;
161
165
 
162
166
  this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`);
163
167
  if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
@@ -225,16 +229,6 @@ export class MeterPlus {
225
229
 
226
230
  async openAPIparseStatus(): Promise<void> {
227
231
  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
-
238
232
  // Current Relative Humidity
239
233
  if (!this.device.meter?.hide_humidity) {
240
234
  this.CurrentRelativeHumidity = this.Humidity!;
@@ -401,29 +395,28 @@ export class MeterPlus {
401
395
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
402
396
  }
403
397
  }
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}`);
398
+ if (this.BLE) {
399
+ if (this.BatteryLevel === undefined) {
400
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}`);
401
+ } else {
402
+ if (this.device.mqttURL) {
403
+ mqttmessage.push(`"battery": ${this.BatteryLevel}`);
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}`);
410
408
  }
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}`);
409
+ if (this.StatusLowBattery === undefined) {
410
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} StatusLowBattery: ${this.StatusLowBattery}`);
411
+ } else {
412
+ if (this.device.mqttURL) {
413
+ mqttmessage.push(`"lowBattery": ${this.StatusLowBattery}`);
414
+ }
415
+ this.accessory.context.StatusLowBattery = this.StatusLowBattery;
416
+ this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, this.StatusLowBattery);
417
+ this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
421
418
  }
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}`);
425
419
  }
426
-
427
420
  if (this.device.mqttURL) {
428
421
  this.mqttPublish(`{${mqttmessage.join(',')}}`);
429
422
  }
@@ -600,8 +593,10 @@ export class MeterPlus {
600
593
  if (!this.device.meter?.hide_temperature) {
601
594
  this.temperatureservice?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, e);
602
595
  }
603
- this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, e);
604
- this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
596
+ if (this.BLE) {
597
+ this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, e);
598
+ this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
599
+ }
605
600
  }
606
601
 
607
602
  FirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
@@ -632,16 +627,18 @@ export class MeterPlus {
632
627
  } else {
633
628
  this.CurrentTemperature = this.accessory.context.CurrentTemperature;
634
629
  }
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;
630
+ if (this.BLE) {
631
+ if (this.BatteryLevel === undefined) {
632
+ this.BatteryLevel = 100;
633
+ } else {
634
+ this.BatteryLevel = this.accessory.context.BatteryLevel;
635
+ }
636
+ if (this.StatusLowBattery === undefined) {
637
+ this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL;
638
+ this.accessory.context.StatusLowBattery = this.StatusLowBattery;
639
+ } else {
640
+ this.StatusLowBattery = this.accessory.context.StatusLowBattery;
641
+ }
645
642
  }
646
643
  }
647
644
 
@@ -679,7 +676,7 @@ export class MeterPlus {
679
676
  config['scanDuration'] = device.scanDuration;
680
677
  }
681
678
  if (Object.entries(config).length !== 0) {
682
- this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
679
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
683
680
  }
684
681
  }
685
682
 
@@ -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.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
608
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
609
609
  }
610
610
  }
611
611
 
@@ -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.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
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.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
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} Using CurrentTemperature from ${this.meter.context?.deviceType} (${this.meter.context?.deviceID})`,
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} Using CurrentRelativeHumidity from ${this.meter.context?.deviceType} (${this.meter.context?.deviceID})`,
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.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
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.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
423
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
424
424
  }
425
425
  }
426
426
 
@@ -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.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
301
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
302
302
  }
303
303
  }
304
304
 
@@ -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.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
437
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
438
438
  }
439
439
  }
440
440
 
@@ -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.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
326
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
327
327
  }
328
328
  }
329
329
 
@@ -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.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
332
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
333
333
  }
334
334
  }
335
335
 
@@ -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.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
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.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
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.infoLog({ log: [`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`] });
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.infoLog(`Platform Config: ${JSON.stringify(platformConfig)}`);
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, "openToken" config has been moved to the "token" config, please restart Homebridge.',
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