@switchbot/homebridge-switchbot 1.5.1-beta.1 → 1.5.1-beta.5

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 (82) hide show
  1. package/CHANGELOG.md +6 -2
  2. package/config.schema.json +9 -0
  3. package/dist/devices/bots.d.ts +2 -0
  4. package/dist/devices/bots.d.ts.map +1 -1
  5. package/dist/devices/bots.js +66 -23
  6. package/dist/devices/bots.js.map +1 -1
  7. package/dist/devices/colorbulb.js +13 -12
  8. package/dist/devices/colorbulb.js.map +1 -1
  9. package/dist/devices/contact.d.ts +2 -0
  10. package/dist/devices/contact.d.ts.map +1 -1
  11. package/dist/devices/contact.js +31 -15
  12. package/dist/devices/contact.js.map +1 -1
  13. package/dist/devices/curtains.d.ts +2 -0
  14. package/dist/devices/curtains.d.ts.map +1 -1
  15. package/dist/devices/curtains.js +34 -18
  16. package/dist/devices/curtains.js.map +1 -1
  17. package/dist/devices/humidifiers.d.ts +2 -0
  18. package/dist/devices/humidifiers.d.ts.map +1 -1
  19. package/dist/devices/humidifiers.js +31 -15
  20. package/dist/devices/humidifiers.js.map +1 -1
  21. package/dist/devices/meters.d.ts +2 -0
  22. package/dist/devices/meters.d.ts.map +1 -1
  23. package/dist/devices/meters.js +30 -14
  24. package/dist/devices/meters.js.map +1 -1
  25. package/dist/devices/motion.d.ts +2 -0
  26. package/dist/devices/motion.d.ts.map +1 -1
  27. package/dist/devices/motion.js +30 -14
  28. package/dist/devices/motion.js.map +1 -1
  29. package/dist/devices/plugs.d.ts +2 -0
  30. package/dist/devices/plugs.d.ts.map +1 -1
  31. package/dist/devices/plugs.js +29 -13
  32. package/dist/devices/plugs.js.map +1 -1
  33. package/dist/irdevices/airconditioners.d.ts.map +1 -1
  34. package/dist/irdevices/airconditioners.js +11 -1
  35. package/dist/irdevices/airconditioners.js.map +1 -1
  36. package/dist/irdevices/airpurifiers.d.ts.map +1 -1
  37. package/dist/irdevices/airpurifiers.js +11 -1
  38. package/dist/irdevices/airpurifiers.js.map +1 -1
  39. package/dist/irdevices/cameras.d.ts.map +1 -1
  40. package/dist/irdevices/cameras.js +11 -1
  41. package/dist/irdevices/cameras.js.map +1 -1
  42. package/dist/irdevices/fans.d.ts.map +1 -1
  43. package/dist/irdevices/fans.js +11 -1
  44. package/dist/irdevices/fans.js.map +1 -1
  45. package/dist/irdevices/lights.d.ts.map +1 -1
  46. package/dist/irdevices/lights.js +11 -1
  47. package/dist/irdevices/lights.js.map +1 -1
  48. package/dist/irdevices/others.d.ts +2 -0
  49. package/dist/irdevices/others.d.ts.map +1 -1
  50. package/dist/irdevices/others.js +38 -7
  51. package/dist/irdevices/others.js.map +1 -1
  52. package/dist/irdevices/tvs.d.ts.map +1 -1
  53. package/dist/irdevices/tvs.js +11 -1
  54. package/dist/irdevices/tvs.js.map +1 -1
  55. package/dist/irdevices/vacuumcleaners.d.ts.map +1 -1
  56. package/dist/irdevices/vacuumcleaners.js +11 -1
  57. package/dist/irdevices/vacuumcleaners.js.map +1 -1
  58. package/dist/irdevices/waterheaters.d.ts.map +1 -1
  59. package/dist/irdevices/waterheaters.js +11 -1
  60. package/dist/irdevices/waterheaters.js.map +1 -1
  61. package/dist/settings.d.ts +1 -0
  62. package/dist/settings.d.ts.map +1 -1
  63. package/dist/settings.js.map +1 -1
  64. package/package.json +6 -6
  65. package/src/devices/bots.ts +65 -23
  66. package/src/devices/colorbulb.ts +12 -12
  67. package/src/devices/contact.ts +31 -15
  68. package/src/devices/curtains.ts +35 -19
  69. package/src/devices/humidifiers.ts +31 -15
  70. package/src/devices/meters.ts +30 -14
  71. package/src/devices/motion.ts +30 -14
  72. package/src/devices/plugs.ts +29 -13
  73. package/src/irdevices/airconditioners.ts +10 -1
  74. package/src/irdevices/airpurifiers.ts +10 -1
  75. package/src/irdevices/cameras.ts +10 -1
  76. package/src/irdevices/fans.ts +10 -1
  77. package/src/irdevices/lights.ts +10 -1
  78. package/src/irdevices/others.ts +39 -8
  79. package/src/irdevices/tvs.ts +10 -1
  80. package/src/irdevices/vacuumcleaners.ts +10 -1
  81. package/src/irdevices/waterheaters.ts +10 -1
  82. package/src/settings.ts +1 -0
@@ -34,6 +34,7 @@ export class Motion {
34
34
  lightLevel!: serviceData['lightLevel'];
35
35
 
36
36
  // Config
37
+ scanDuration!: number;
37
38
  deviceLogging!: string;
38
39
  deviceRefreshRate!: number;
39
40
 
@@ -47,8 +48,9 @@ export class Motion {
47
48
  public device: device & devicesConfig,
48
49
  ) {
49
50
  // default placeholders
50
- this.refreshRate();
51
51
  this.logs();
52
+ this.scan();
53
+ this.refreshRate();
52
54
  this.MotionDetected = false;
53
55
 
54
56
  // this is subject we use to track when we need to POST changes to the SwitchBot API
@@ -114,33 +116,47 @@ export class Motion {
114
116
  refreshRate() {
115
117
  if (this.device.refreshRate) {
116
118
  this.deviceRefreshRate = this.accessory.context.refreshRate = this.device.refreshRate;
117
- if (this.platform.debugMode) {
118
- this.warnLog(`Using Device Config refreshRate: ${this.deviceRefreshRate}`);
119
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
120
+ this.warnLog(`Motion Sensor: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
119
121
  }
120
122
  } else if (this.platform.config.options!.refreshRate) {
121
123
  this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options!.refreshRate;
122
- if (this.platform.debugMode) {
123
- this.warnLog(`Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
124
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
125
+ this.warnLog(`Motion Sensor: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
126
+ }
127
+ }
128
+ }
129
+
130
+ scan() {
131
+ if (this.device.scanDuration) {
132
+ this.scanDuration = this.accessory.context.scanDuration = this.device.scanDuration;
133
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
134
+ this.warnLog(`Bot: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
135
+ }
136
+ } else {
137
+ this.scanDuration = this.accessory.context.scanDuration = 1;
138
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
139
+ this.warnLog(`Bot: ${this.accessory.displayName} Using Default scanDuration: ${this.scanDuration}`);
124
140
  }
125
141
  }
126
142
  }
127
143
 
128
144
  logs() {
129
- if (this.device.logging) {
145
+ if (this.platform.debugMode) {
146
+ this.deviceLogging = this.accessory.context.logging = 'debug';
147
+ this.warnLog(`Motion Sensor: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
148
+ } else if (this.device.logging) {
130
149
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
131
- if (this.platform.debugMode) {
132
- this.warnLog(`Using Device Config Logging: ${this.deviceLogging}`);
150
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
151
+ this.warnLog(`Motion Sensor: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
133
152
  }
134
153
  } else if (this.platform.config.options?.logging) {
135
154
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
136
- if (this.platform.debugMode) {
137
- this.warnLog(`Using Platform Config Logging: ${this.deviceLogging}`);
155
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
156
+ this.warnLog(`Motion Sensor: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
138
157
  }
139
158
  } else {
140
159
  this.deviceLogging = this.accessory.context.logging = 'standard';
141
- if (this.platform.debugMode) {
142
- this.warnLog('Using Device Standard Logging');
143
- }
144
160
  }
145
161
  }
146
162
 
@@ -231,7 +247,7 @@ export class Motion {
231
247
  }
232
248
  };
233
249
  // Wait 10 seconds
234
- return switchbot.wait(10000);
250
+ return switchbot.wait(this.scanDuration * 1000);
235
251
  }).then(async () => {
236
252
  // Stop to monitor
237
253
  switchbot.stopScan();
@@ -18,6 +18,7 @@ export class Plug {
18
18
  deviceStatus!: deviceStatusResponse;
19
19
 
20
20
  // Config
21
+ scanDuration!: number;
21
22
  deviceLogging!: string;
22
23
  deviceRefreshRate!: number;
23
24
 
@@ -31,8 +32,9 @@ export class Plug {
31
32
  public device: device & devicesConfig,
32
33
  ) {
33
34
  // default placeholders
34
- this.refreshRate();
35
35
  this.logs();
36
+ this.scan();
37
+ this.refreshRate();
36
38
  if (this.On === undefined) {
37
39
  this.On = false;
38
40
  } else {
@@ -117,33 +119,47 @@ export class Plug {
117
119
  refreshRate() {
118
120
  if (this.device.refreshRate) {
119
121
  this.deviceRefreshRate = this.accessory.context.refreshRate = this.device.refreshRate;
120
- if (this.platform.debugMode) {
121
- this.warnLog(`Using Device Config refreshRate: ${this.deviceRefreshRate}`);
122
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
123
+ this.warnLog(`Plug: ${this.accessory.displayName} Using Device Config refreshRate: ${this.deviceRefreshRate}`);
122
124
  }
123
125
  } else if (this.platform.config.options!.refreshRate) {
124
126
  this.deviceRefreshRate = this.accessory.context.refreshRate = this.platform.config.options!.refreshRate;
125
- if (this.platform.debugMode) {
126
- this.warnLog(`Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
127
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
128
+ this.warnLog(`Plug: ${this.accessory.displayName} Using Platform Config refreshRate: ${this.deviceRefreshRate}`);
129
+ }
130
+ }
131
+ }
132
+
133
+ scan() {
134
+ if (this.device.scanDuration) {
135
+ this.scanDuration = this.accessory.context.scanDuration = this.device.scanDuration;
136
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
137
+ this.warnLog(`Bot: ${this.accessory.displayName} Using Device Config scanDuration: ${this.scanDuration}`);
138
+ }
139
+ } else {
140
+ this.scanDuration = this.accessory.context.scanDuration = 1;
141
+ if (this.platform.debugMode || (this.deviceLogging === 'debug')) {
142
+ this.warnLog(`Bot: ${this.accessory.displayName} Using Default scanDuration: ${this.scanDuration}`);
127
143
  }
128
144
  }
129
145
  }
130
146
 
131
147
  logs() {
132
- if (this.device.logging) {
148
+ if (this.platform.debugMode) {
149
+ this.deviceLogging = this.accessory.context.logging = 'debug';
150
+ this.warnLog(`Plug: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
151
+ } else if (this.device.logging) {
133
152
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
134
- if (this.platform.debugMode) {
135
- this.warnLog(`Using Device Config Logging: ${this.deviceLogging}`);
153
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
154
+ this.warnLog(`Plug: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
136
155
  }
137
156
  } else if (this.platform.config.options?.logging) {
138
157
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
139
- if (this.platform.debugMode) {
140
- this.warnLog(`Using Platform Config Logging: ${this.deviceLogging}`);
158
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
159
+ this.warnLog(`Plug: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
141
160
  }
142
161
  } else {
143
162
  this.deviceLogging = this.accessory.context.logging = 'standard';
144
- if (this.platform.debugMode) {
145
- this.warnLog('Using Device Standard Logging');
146
- }
147
163
  }
148
164
  }
149
165
 
@@ -167,10 +167,19 @@ export class AirConditioner {
167
167
  }
168
168
 
169
169
  logs() {
170
- if (this.device.logging) {
170
+ if (this.platform.debugMode) {
171
+ this.deviceLogging = this.accessory.context.logging = 'debug';
172
+ this.warnLog(`Air Conditioner: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
173
+ } else if (this.device.logging) {
171
174
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
175
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
176
+ this.warnLog(`Air Conditioner: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
177
+ }
172
178
  } else if (this.platform.config.options?.logging) {
173
179
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
180
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
181
+ this.warnLog(`Air Conditioner: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
182
+ }
174
183
  } else {
175
184
  this.deviceLogging = this.accessory.context.logging = 'standard';
176
185
  }
@@ -88,10 +88,19 @@ export class AirPurifier {
88
88
  }
89
89
 
90
90
  logs() {
91
- if (this.device.logging) {
91
+ if (this.platform.debugMode) {
92
+ this.deviceLogging = this.accessory.context.logging = 'debug';
93
+ this.warnLog(`Air Purifier: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
94
+ } else if (this.device.logging) {
92
95
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
96
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
97
+ this.warnLog(`Air Purifier: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
98
+ }
93
99
  } else if (this.platform.config.options?.logging) {
94
100
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
101
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
102
+ this.warnLog(`Air Purifier: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
103
+ }
95
104
  } else {
96
105
  this.deviceLogging = this.accessory.context.logging = 'standard';
97
106
  }
@@ -58,10 +58,19 @@ export class Camera {
58
58
  }
59
59
 
60
60
  logs() {
61
- if (this.device.logging) {
61
+ if (this.platform.debugMode) {
62
+ this.deviceLogging = this.accessory.context.logging = 'debug';
63
+ this.warnLog(`Camera: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
64
+ } else if (this.device.logging) {
62
65
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
66
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
67
+ this.warnLog(`Camera: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
68
+ }
63
69
  } else if (this.platform.config.options?.logging) {
64
70
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
71
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
72
+ this.warnLog(`Camera: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
73
+ }
65
74
  } else {
66
75
  this.deviceLogging = this.accessory.context.logging = 'standard';
67
76
  }
@@ -117,10 +117,19 @@ export class Fan {
117
117
  }
118
118
 
119
119
  logs() {
120
- if (this.device.logging) {
120
+ if (this.platform.debugMode) {
121
+ this.deviceLogging = this.accessory.context.logging = 'debug';
122
+ this.warnLog(`Fan: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
123
+ } else if (this.device.logging) {
121
124
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
125
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
126
+ this.warnLog(`Fan: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
127
+ }
122
128
  } else if (this.platform.config.options?.logging) {
123
129
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
130
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
131
+ this.warnLog(`Fan: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
132
+ }
124
133
  } else {
125
134
  this.deviceLogging = this.accessory.context.logging = 'standard';
126
135
  }
@@ -73,10 +73,19 @@ export class Light {
73
73
  }
74
74
 
75
75
  logs() {
76
- if (this.device.logging) {
76
+ if (this.platform.debugMode) {
77
+ this.deviceLogging = this.accessory.context.logging = 'debug';
78
+ this.warnLog(`Light: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
79
+ } else if (this.device.logging) {
77
80
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
81
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
82
+ this.warnLog(`Light: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
83
+ }
78
84
  } else if (this.platform.config.options?.logging) {
79
85
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
86
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
87
+ this.warnLog(`Light: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
88
+ }
80
89
  } else {
81
90
  this.deviceLogging = this.accessory.context.logging = 'standard';
82
91
  }
@@ -1,7 +1,7 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { SwitchBotPlatform } from '../platform';
3
3
  import { irDevicesConfig, DeviceURL, irdevice, payload } from '../settings';
4
- import { CharacteristicValue, HAPStatus, PlatformAccessory, Service } from 'homebridge';
4
+ import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
5
5
 
6
6
  /**
7
7
  * Platform Accessory
@@ -18,6 +18,7 @@ export class Others {
18
18
 
19
19
  // Config
20
20
  deviceLogging!: string;
21
+ otherDeviceType?: string;
21
22
 
22
23
  constructor(
23
24
  private readonly platform: SwitchBotPlatform,
@@ -26,6 +27,7 @@ export class Others {
26
27
  ) {
27
28
  // default placeholders
28
29
  this.logs();
30
+ this.deviceType();
29
31
  if (this.Active === undefined) {
30
32
  this.Active = this.platform.Characteristic.Active.INACTIVE;
31
33
  } else {
@@ -41,24 +43,53 @@ export class Others {
41
43
 
42
44
  // get the Television service if it exists, otherwise create a new Television service
43
45
  // you can create multiple services for each accessory
44
- this.service = accessory.getService(this.platform.Service.Fanv2);
45
- if (!this.service && device?.other?.deviceType === 'Fan') {
46
- this.service = accessory.addService(this.platform.Service.Fanv2, `${accessory.displayName} Fan`);
46
+ if (this.otherDeviceType !== 'Fan') {
47
+ this.debugLog(`Other: ${accessory.displayName} Removing Fanv2 Service`);
47
48
 
48
- this.service.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
49
+ if (this.otherDeviceType === undefined) {
50
+ this.errorLog(`Other: ${this.accessory.displayName} No Device Type Set, deviceType: ${device.other?.deviceType}`);
51
+ }
52
+ this.service = this.accessory.getService(this.platform.Service.Fanv2);
53
+ accessory.removeService(this.service!);
54
+ } else if (!this.service && this.otherDeviceType === 'Fan') {
55
+ this.debugLog(`Other: ${accessory.displayName} Add Fanv2 Service`);
56
+ (this.service =
57
+ this.accessory.getService(this.platform.Service.Fanv2) ||
58
+ this.accessory.addService(this.platform.Service.Fanv2)), `${accessory.displayName} Fan`;
59
+
60
+ this.service.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Fan`);
49
61
 
50
62
  this.service.getCharacteristic(this.platform.Characteristic.Active).onSet(this.ActiveSet.bind(this));
51
63
  } else {
52
- accessory.removeService(this.service!);
53
- this.errorLog(`Other: ${this.accessory.displayName} No Device Type Set, deviceType: ${device.other?.deviceType}`);
64
+ this.debugLog(`Other: ${accessory.displayName} Fanv2 Service Not Added, deviceType: ${device.other?.deviceType}`);
65
+ }
66
+ }
67
+
68
+ deviceType() {
69
+ if (this.device?.other?.deviceType) {
70
+ this.otherDeviceType = this.accessory.context.deviceType = this.device?.other?.deviceType;
71
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
72
+ this.warnLog(`Other: ${this.accessory.displayName} Using Device Type: ${this.otherDeviceType}`);
73
+ }
74
+ } else {
75
+ this.errorLog(`Other: ${this.accessory.displayName} No Device Type Set, deviceType: ${this.device.other?.deviceType}`);
54
76
  }
55
77
  }
56
78
 
57
79
  logs() {
58
- if (this.device.logging) {
80
+ if (this.platform.debugMode) {
81
+ this.deviceLogging = this.accessory.context.logging = 'debug';
82
+ this.warnLog(`Other: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
83
+ } else if (this.device.logging) {
59
84
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
85
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
86
+ this.warnLog(`Other: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
87
+ }
60
88
  } else if (this.platform.config.options?.logging) {
61
89
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
90
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
91
+ this.warnLog(`Other: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
92
+ }
62
93
  } else {
63
94
  this.deviceLogging = this.accessory.context.logging = 'standard';
64
95
  }
@@ -129,10 +129,19 @@ export class TV {
129
129
  }
130
130
 
131
131
  logs() {
132
- if (this.device.logging) {
132
+ if (this.platform.debugMode) {
133
+ this.deviceLogging = this.accessory.context.logging = 'debug';
134
+ this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
135
+ } else if (this.device.logging) {
133
136
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
137
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
138
+ this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
139
+ }
134
140
  } else if (this.platform.config.options?.logging) {
135
141
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
142
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
143
+ this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
144
+ }
136
145
  } else {
137
146
  this.deviceLogging = this.accessory.context.logging = 'standard';
138
147
  }
@@ -58,10 +58,19 @@ export class VacuumCleaner {
58
58
  }
59
59
 
60
60
  logs() {
61
- if (this.device.logging) {
61
+ if (this.platform.debugMode) {
62
+ this.deviceLogging = this.accessory.context.logging = 'debug';
63
+ this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
64
+ } else if (this.device.logging) {
62
65
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
66
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
67
+ this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
68
+ }
63
69
  } else if (this.platform.config.options?.logging) {
64
70
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
71
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
72
+ this.warnLog(`Vacuum Cleaner: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
73
+ }
65
74
  } else {
66
75
  this.deviceLogging = this.accessory.context.logging = 'standard';
67
76
  }
@@ -67,10 +67,19 @@ export class WaterHeater {
67
67
  }
68
68
 
69
69
  logs() {
70
- if (this.device.logging) {
70
+ if (this.platform.debugMode) {
71
+ this.deviceLogging = this.accessory.context.logging = 'debug';
72
+ this.warnLog(`Water Heater: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
73
+ } else if (this.device.logging) {
71
74
  this.deviceLogging = this.accessory.context.logging = this.device.logging;
75
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
76
+ this.warnLog(`Water Heater: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
77
+ }
72
78
  } else if (this.platform.config.options?.logging) {
73
79
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
80
+ if (this.deviceLogging === 'debug' || this.deviceLogging === 'standard') {
81
+ this.warnLog(`Water Heater: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
82
+ }
74
83
  } else {
75
84
  this.deviceLogging = this.accessory.context.logging = 'standard';
76
85
  }
package/src/settings.ts CHANGED
@@ -50,6 +50,7 @@ export interface devicesConfig extends device {
50
50
  contact?: contact;
51
51
  colorbulb?: colorbulb;
52
52
  ble?: string;
53
+ scanDuration?: number;
53
54
  hide_device?: boolean;
54
55
  offline?: boolean;
55
56
  }