@switchbot/homebridge-switchbot 3.5.0-beta.7 → 3.5.0-beta.70

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 (177) hide show
  1. package/.vscode/settings.json +4 -1
  2. package/CHANGELOG.md +4 -1
  3. package/config.schema.json +120 -17
  4. package/dist/device/blindtilt.d.ts +23 -96
  5. package/dist/device/blindtilt.d.ts.map +1 -1
  6. package/dist/device/blindtilt.js +425 -778
  7. package/dist/device/blindtilt.js.map +1 -1
  8. package/dist/device/bot.d.ts +26 -72
  9. package/dist/device/bot.d.ts.map +1 -1
  10. package/dist/device/bot.js +803 -837
  11. package/dist/device/bot.js.map +1 -1
  12. package/dist/device/ceilinglight.d.ts +14 -68
  13. package/dist/device/ceilinglight.d.ts.map +1 -1
  14. package/dist/device/ceilinglight.js +241 -606
  15. package/dist/device/ceilinglight.js.map +1 -1
  16. package/dist/device/colorbulb.d.ts +14 -75
  17. package/dist/device/colorbulb.d.ts.map +1 -1
  18. package/dist/device/colorbulb.js +283 -658
  19. package/dist/device/colorbulb.js.map +1 -1
  20. package/dist/device/contact.d.ts +15 -66
  21. package/dist/device/contact.d.ts.map +1 -1
  22. package/dist/device/contact.js +254 -545
  23. package/dist/device/contact.js.map +1 -1
  24. package/dist/device/curtain.d.ts +19 -88
  25. package/dist/device/curtain.d.ts.map +1 -1
  26. package/dist/device/curtain.js +412 -806
  27. package/dist/device/curtain.js.map +1 -1
  28. package/dist/device/device.d.ts +59 -0
  29. package/dist/device/device.d.ts.map +1 -0
  30. package/dist/device/device.js +711 -0
  31. package/dist/device/device.js.map +1 -0
  32. package/dist/device/fan.d.ts +51 -0
  33. package/dist/device/fan.d.ts.map +1 -0
  34. package/dist/device/fan.js +540 -0
  35. package/dist/device/fan.js.map +1 -0
  36. package/dist/device/hub.d.ts +16 -60
  37. package/dist/device/hub.d.ts.map +1 -1
  38. package/dist/device/hub.js +261 -616
  39. package/dist/device/hub.js.map +1 -1
  40. package/dist/device/humidifier.d.ts +11 -66
  41. package/dist/device/humidifier.d.ts.map +1 -1
  42. package/dist/device/humidifier.js +240 -594
  43. package/dist/device/humidifier.js.map +1 -1
  44. package/dist/device/iosensor.d.ts +11 -64
  45. package/dist/device/iosensor.d.ts.map +1 -1
  46. package/dist/device/iosensor.js +196 -600
  47. package/dist/device/iosensor.js.map +1 -1
  48. package/dist/device/lightstrip.d.ts +11 -69
  49. package/dist/device/lightstrip.d.ts.map +1 -1
  50. package/dist/device/lightstrip.js +281 -586
  51. package/dist/device/lightstrip.js.map +1 -1
  52. package/dist/device/lock.d.ts +16 -63
  53. package/dist/device/lock.d.ts.map +1 -1
  54. package/dist/device/lock.js +252 -560
  55. package/dist/device/lock.js.map +1 -1
  56. package/dist/device/meter.d.ts +14 -64
  57. package/dist/device/meter.d.ts.map +1 -1
  58. package/dist/device/meter.js +191 -593
  59. package/dist/device/meter.js.map +1 -1
  60. package/dist/device/meterplus.d.ts +14 -65
  61. package/dist/device/meterplus.d.ts.map +1 -1
  62. package/dist/device/meterplus.js +180 -593
  63. package/dist/device/meterplus.js.map +1 -1
  64. package/dist/device/motion.d.ts +13 -69
  65. package/dist/device/motion.d.ts.map +1 -1
  66. package/dist/device/motion.js +188 -532
  67. package/dist/device/motion.js.map +1 -1
  68. package/dist/device/plug.d.ts +9 -57
  69. package/dist/device/plug.d.ts.map +1 -1
  70. package/dist/device/plug.js +96 -458
  71. package/dist/device/plug.js.map +1 -1
  72. package/dist/device/robotvacuumcleaner.d.ts +12 -63
  73. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  74. package/dist/device/robotvacuumcleaner.js +202 -521
  75. package/dist/device/robotvacuumcleaner.js.map +1 -1
  76. package/dist/device/waterdetector.d.ts +10 -63
  77. package/dist/device/waterdetector.d.ts.map +1 -1
  78. package/dist/device/waterdetector.js +146 -475
  79. package/dist/device/waterdetector.js.map +1 -1
  80. package/dist/homebridge-ui/public/index.html +22 -16
  81. package/dist/homebridge-ui/server.js +1 -1
  82. package/dist/homebridge-ui/server.js.map +1 -1
  83. package/dist/index.d.ts +1 -1
  84. package/dist/index.d.ts.map +1 -1
  85. package/dist/index.js +2 -2
  86. package/dist/index.js.map +1 -1
  87. package/dist/irdevice/airconditioner.d.ts +10 -50
  88. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  89. package/dist/irdevice/airconditioner.js +324 -452
  90. package/dist/irdevice/airconditioner.js.map +1 -1
  91. package/dist/irdevice/airpurifier.d.ts +8 -39
  92. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  93. package/dist/irdevice/airpurifier.js +93 -307
  94. package/dist/irdevice/airpurifier.js.map +1 -1
  95. package/dist/irdevice/camera.d.ts +7 -36
  96. package/dist/irdevice/camera.d.ts.map +1 -1
  97. package/dist/irdevice/camera.js +39 -281
  98. package/dist/irdevice/camera.js.map +1 -1
  99. package/dist/irdevice/fan.d.ts +10 -43
  100. package/dist/irdevice/fan.d.ts.map +1 -1
  101. package/dist/irdevice/fan.js +113 -341
  102. package/dist/irdevice/fan.js.map +1 -1
  103. package/dist/irdevice/irdevice.d.ts +40 -0
  104. package/dist/irdevice/irdevice.d.ts.map +1 -0
  105. package/dist/irdevice/irdevice.js +330 -0
  106. package/dist/irdevice/irdevice.js.map +1 -0
  107. package/dist/irdevice/light.d.ts +12 -45
  108. package/dist/irdevice/light.d.ts.map +1 -1
  109. package/dist/irdevice/light.js +118 -362
  110. package/dist/irdevice/light.js.map +1 -1
  111. package/dist/irdevice/other.d.ts +19 -48
  112. package/dist/irdevice/other.d.ts.map +1 -1
  113. package/dist/irdevice/other.js +438 -570
  114. package/dist/irdevice/other.js.map +1 -1
  115. package/dist/irdevice/tv.d.ts +8 -40
  116. package/dist/irdevice/tv.d.ts.map +1 -1
  117. package/dist/irdevice/tv.js +87 -335
  118. package/dist/irdevice/tv.js.map +1 -1
  119. package/dist/irdevice/vacuumcleaner.d.ts +7 -36
  120. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  121. package/dist/irdevice/vacuumcleaner.js +45 -285
  122. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  123. package/dist/irdevice/waterheater.d.ts +7 -36
  124. package/dist/irdevice/waterheater.d.ts.map +1 -1
  125. package/dist/irdevice/waterheater.js +47 -291
  126. package/dist/irdevice/waterheater.js.map +1 -1
  127. package/dist/platform.d.ts +19 -6
  128. package/dist/platform.d.ts.map +1 -1
  129. package/dist/platform.js +310 -172
  130. package/dist/platform.js.map +1 -1
  131. package/dist/settings.d.ts +62 -19
  132. package/dist/settings.d.ts.map +1 -1
  133. package/dist/settings.js +16 -552
  134. package/dist/settings.js.map +1 -1
  135. package/dist/utils.d.ts +77 -0
  136. package/dist/utils.d.ts.map +1 -1
  137. package/dist/utils.js +638 -1
  138. package/dist/utils.js.map +1 -1
  139. package/eslint.config.js +96 -0
  140. package/package.json +19 -15
  141. package/src/custom.d.ts +2 -1
  142. package/src/device/blindtilt.ts +462 -817
  143. package/src/device/bot.ts +862 -931
  144. package/src/device/ceilinglight.ts +259 -633
  145. package/src/device/colorbulb.ts +300 -688
  146. package/src/device/contact.ts +288 -571
  147. package/src/device/curtain.ts +441 -838
  148. package/src/device/device.ts +734 -0
  149. package/src/device/fan.ts +596 -0
  150. package/src/device/hub.ts +299 -645
  151. package/src/device/humidifier.ts +274 -647
  152. package/src/device/iosensor.ts +233 -626
  153. package/src/device/lightstrip.ts +309 -620
  154. package/src/device/lock.ts +292 -601
  155. package/src/device/meter.ts +228 -619
  156. package/src/device/meterplus.ts +216 -619
  157. package/src/device/motion.ts +218 -559
  158. package/src/device/plug.ts +111 -490
  159. package/src/device/robotvacuumcleaner.ts +228 -550
  160. package/src/device/waterdetector.ts +169 -501
  161. package/src/homebridge-ui/public/index.html +22 -16
  162. package/src/homebridge-ui/server.ts +1 -1
  163. package/src/index.ts +4 -3
  164. package/src/irdevice/airconditioner.ts +350 -477
  165. package/src/irdevice/airpurifier.ts +120 -330
  166. package/src/irdevice/camera.ts +53 -301
  167. package/src/irdevice/fan.ts +130 -360
  168. package/src/irdevice/irdevice.ts +346 -0
  169. package/src/irdevice/light.ts +157 -412
  170. package/src/irdevice/other.ts +507 -648
  171. package/src/irdevice/tv.ts +117 -367
  172. package/src/irdevice/vacuumcleaner.ts +59 -311
  173. package/src/irdevice/waterheater.ts +61 -320
  174. package/src/platform.ts +355 -219
  175. package/src/settings.ts +116 -611
  176. package/src/utils.ts +642 -1
  177. package/src/device/waterdetector.json +0 -11
@@ -0,0 +1,346 @@
1
+ /* Copyright(C) 2021-2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
2
+ *
3
+ * device.ts: @switchbot/homebridge-switchbot.
4
+ */
5
+ import type { SwitchBotPlatform } from '../platform.js';
6
+ import type { API, HAP, Logging, PlatformAccessory } from 'homebridge';
7
+ import type { SwitchBotPlatformConfig, irDevicesConfig, irdevice } from '../settings.js';
8
+
9
+ export abstract class irdeviceBase {
10
+ public readonly api: API;
11
+ public readonly log: Logging;
12
+ public readonly config!: SwitchBotPlatformConfig;
13
+ protected readonly hap: HAP;
14
+
15
+ // Config
16
+ protected deviceLogging!: string;
17
+ protected disablePushOn!: boolean;
18
+ protected disablePushOff!: boolean;
19
+ protected disablePushDetail?: boolean;
20
+
21
+ constructor(
22
+ protected readonly platform: SwitchBotPlatform,
23
+ protected accessory: PlatformAccessory,
24
+ protected device: irdevice & irDevicesConfig,
25
+ ) {
26
+ this.api = this.platform.api;
27
+ this.log = this.platform.log;
28
+ this.config = this.platform.config;
29
+ this.hap = this.api.hap;
30
+
31
+ this.getDeviceLogSettings(device);
32
+ this.getDeviceConfigSettings(device);
33
+ this.getDeviceContext(accessory, device);
34
+ this.disablePushOnChanges(device);
35
+ this.disablePushOffChanges(device);
36
+
37
+ // Set accessory information
38
+ accessory
39
+ .getService(this.hap.Service.AccessoryInformation)!
40
+ .setCharacteristic(this.hap.Characteristic.Manufacturer, 'SwitchBot')
41
+ .setCharacteristic(this.hap.Characteristic.Name, accessory.displayName)
42
+ .setCharacteristic(this.hap.Characteristic.ConfiguredName, accessory.context.name)
43
+ .setCharacteristic(this.hap.Characteristic.Model, accessory.context.model)
44
+ .setCharacteristic(this.hap.Characteristic.SerialNumber, accessory.context.deviceId)
45
+ .setCharacteristic(this.hap.Characteristic.FirmwareRevision, accessory.context.firmware)
46
+ .getCharacteristic(this.hap.Characteristic.FirmwareRevision)
47
+ .updateValue(accessory.context.firmware);
48
+ }
49
+
50
+ async getDeviceLogSettings(device: irdevice & irDevicesConfig): Promise<void> {
51
+ if (this.platform.debugMode) {
52
+ this.deviceLogging = this.accessory.context.logging = 'debugMode';
53
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
54
+ } else if (device.logging) {
55
+ this.deviceLogging = this.accessory.context.logging = device.logging;
56
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
57
+ } else if (this.config.logging) {
58
+ this.deviceLogging = this.accessory.context.logging = this.config.logging;
59
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
60
+ } else {
61
+ this.deviceLogging = this.accessory.context.logging = 'standard';
62
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
63
+ }
64
+ }
65
+
66
+ async getDeviceConfigSettings(device: irdevice & irDevicesConfig): Promise<void> {
67
+ const deviceConfig = {};
68
+ if (device.logging !== 'standard') {
69
+ deviceConfig['logging'] = device.logging;
70
+ }
71
+ if (device.connectionType !== '') {
72
+ deviceConfig['connectionType'] = device.connectionType;
73
+ }
74
+ if (device.external === true) {
75
+ deviceConfig['external'] = device.external;
76
+ }
77
+ if (device.customize === true) {
78
+ deviceConfig['customize'] = device.customize;
79
+ }
80
+ if (device.commandType !== '') {
81
+ deviceConfig['commandType'] = device.commandType;
82
+ }
83
+ if (device.customOn !== '') {
84
+ deviceConfig['customOn'] = device.customOn;
85
+ }
86
+ if (device.customOff !== '') {
87
+ deviceConfig['customOff'] = device.customOff;
88
+ }
89
+ if (device.disablePushOn === true) {
90
+ deviceConfig['disablePushOn'] = device.disablePushOn;
91
+ }
92
+ if (device.disablePushOff === true) {
93
+ deviceConfig['disablePushOff'] = device.disablePushOff;
94
+ }
95
+ if (device.disablePushDetail === true) {
96
+ deviceConfig['disablePushDetail'] = device.disablePushDetail;
97
+ }
98
+ let irairConfig = {};
99
+ if (device.irair) {
100
+ irairConfig = device.irair;
101
+ }
102
+ let irpurConfig = {};
103
+ if (device.irpur) {
104
+ irpurConfig = device.irpur;
105
+ }
106
+ let ircamConfig = {};
107
+ if (device.ircam) {
108
+ ircamConfig = device.ircam;
109
+ }
110
+ let irfanConfig = {};
111
+ if (device.irfan) {
112
+ irfanConfig = device.irfan;
113
+ }
114
+ let irlightConfig = {};
115
+ if (device.irlight) {
116
+ irlightConfig = device.irlight;
117
+ }
118
+ let otherConfig = {};
119
+ if (device.other) {
120
+ otherConfig = device.other;
121
+ }
122
+ let irtvConfig = {};
123
+ if (device.irtv) {
124
+ irtvConfig = device.irtv;
125
+ }
126
+ let irvcConfig = {};
127
+ if (device.irvc) {
128
+ irvcConfig = device.irvc;
129
+ }
130
+ let irwhConfig = {};
131
+ if (device.irwh) {
132
+ irwhConfig = device.irwh;
133
+ }
134
+ const config = Object.assign({}, deviceConfig, irairConfig, irpurConfig, ircamConfig, irfanConfig, irlightConfig, otherConfig,
135
+ irtvConfig, irvcConfig, irwhConfig);
136
+ if (Object.entries(config).length !== 0) {
137
+ this.debugSuccessLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
138
+ }
139
+ }
140
+
141
+ async getDeviceContext(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): Promise<void> {
142
+ accessory.context.name = device.deviceName;
143
+ accessory.context.model = device.remoteType;
144
+ accessory.context.deviceId = device.deviceId;
145
+ accessory.context.remoteType = device.remoteType;
146
+ if (device.firmware) {
147
+ accessory.context.firmware = device.firmware;
148
+ } else if (device.firmware === undefined || accessory.context.firmware === undefined) {
149
+ device.firmware = this.platform.version;
150
+ accessory.context.firmware = device.firmware;
151
+ } else {
152
+ accessory.context.firmware = 'Unknown';
153
+ }
154
+ }
155
+
156
+ async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
157
+ if (device.disablePushOn === undefined) {
158
+ this.disablePushOn = false;
159
+ } else {
160
+ this.disablePushOn = device.disablePushOn;
161
+ }
162
+ }
163
+
164
+ async disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void> {
165
+ if (device.disablePushOff === undefined) {
166
+ this.disablePushOff = false;
167
+ } else {
168
+ this.disablePushOff = device.disablePushOff;
169
+ }
170
+ }
171
+
172
+ async disablePushDetailChanges(device: irdevice & irDevicesConfig): Promise<void> {
173
+ if (device.disablePushDetail === undefined) {
174
+ this.disablePushDetail = false;
175
+ } else {
176
+ this.disablePushDetail = device.disablePushDetail;
177
+ }
178
+ }
179
+
180
+ async commandType(): Promise<string> {
181
+ let commandType: string;
182
+ if (this.device.commandType && this.device.customize) {
183
+ commandType = this.device.commandType;
184
+ } else if (this.device.customize) {
185
+ commandType = 'customize';
186
+ } else {
187
+ commandType = 'command';
188
+ }
189
+ return commandType;
190
+ }
191
+
192
+ async commandOn(): Promise<string> {
193
+ let command: string;
194
+ if (this.device.customize && this.device.customOn) {
195
+ command = this.device.customOn;
196
+ } else {
197
+ command = 'turnOn';
198
+ }
199
+ return command;
200
+ }
201
+
202
+ async commandOff(): Promise<string> {
203
+ let command: string;
204
+ if (this.device.customize && this.device.customOff) {
205
+ command = this.device.customOff;
206
+ } else {
207
+ command = 'turnOff';
208
+ }
209
+ return command;
210
+ }
211
+
212
+ async statusCode(statusCode: number): Promise<void> {
213
+ switch (statusCode) {
214
+ case 151:
215
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command not supported by this deviceType, statusCode: ${statusCode}`);
216
+ break;
217
+ case 152:
218
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device not found, statusCode: ${statusCode}`);
219
+ break;
220
+ case 160:
221
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command is not supported, statusCode: ${statusCode}`);
222
+ break;
223
+ case 161:
224
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device is offline, statusCode: ${statusCode}`);
225
+ break;
226
+ case 171:
227
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Hub Device is offline, statusCode: ${statusCode}. ` +
228
+ `Hub: ${this.device.hubDeviceId}`);
229
+ break;
230
+ case 190:
231
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device internal error due to device states not synchronized with` +
232
+ ` server, Or command format is invalid, statusCode: ${statusCode}`);
233
+ break;
234
+ case 100:
235
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Command successfully sent, statusCode: ${statusCode}`);
236
+ break;
237
+ case 200:
238
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Request successful, statusCode: ${statusCode}`);
239
+ break;
240
+ case 400:
241
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Bad Request, The client has issued an invalid request. `
242
+ + `This is commonly used to specify validation errors in a request payload, statusCode: ${statusCode}`);
243
+ break;
244
+ case 401:
245
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Unauthorized, Authorization for the API is required, `
246
+ + `but the request has not been authenticated, statusCode: ${statusCode}`);
247
+ break;
248
+ case 403:
249
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Forbidden, The request has been authenticated but does not `
250
+ + `have appropriate permissions, or a requested resource is not found, statusCode: ${statusCode}`);
251
+ break;
252
+ case 404:
253
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Not Found, Specifies the requested path does not exist, `
254
+ + `statusCode: ${statusCode}`);
255
+ break;
256
+ case 406:
257
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Not Acceptable, The client has requested a MIME type via `
258
+ + `the Accept header for a value not supported by the server, statusCode: ${statusCode}`);
259
+ break;
260
+ case 415:
261
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Unsupported Media Type, The client has defined a contentType `
262
+ + `header that is not supported by the server, statusCode: ${statusCode}`);
263
+ break;
264
+ case 422:
265
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Unprocessable Entity, The client has made a valid request, `
266
+ + `but the server cannot process it. This is often used for APIs for which certain limits have been exceeded, statusCode: ${statusCode}`);
267
+ break;
268
+ case 429:
269
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Too Many Requests, The client has exceeded the number of `
270
+ + `requests allowed for a given time window, statusCode: ${statusCode}`);
271
+ break;
272
+ case 500:
273
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Internal Server Error, An unexpected error on the SmartThings `
274
+ + `servers has occurred. These errors should be rare, statusCode: ${statusCode}`);
275
+ break;
276
+ default:
277
+ this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Unknown statusCode: `
278
+ + `${statusCode}, Submit Bugs Here: ' + 'https://tinyurl.com/SwitchBotBug`);
279
+ }
280
+ }
281
+
282
+ /**
283
+ * Logging for Device
284
+ */
285
+ infoLog(...log: any[]): void {
286
+ if (this.enablingDeviceLogging()) {
287
+ this.log.info(String(...log));
288
+ }
289
+ }
290
+
291
+ successLog(...log: any[]): void {
292
+ if (this.enablingDeviceLogging()) {
293
+ this.platform.log.success(String(...log));
294
+ }
295
+ }
296
+
297
+ debugSuccessLog(...log: any[]): void {
298
+ if (this.enablingDeviceLogging()) {
299
+ if (this.deviceLogging?.includes('debug')) {
300
+ this.log.success('[DEBUG]', String(...log));
301
+ }
302
+ }
303
+ }
304
+
305
+ warnLog(...log: any[]): void {
306
+ if (this.enablingDeviceLogging()) {
307
+ this.log.warn(String(...log));
308
+ }
309
+ }
310
+
311
+ debugWarnLog(...log: any[]): void {
312
+ if (this.enablingDeviceLogging()) {
313
+ if (this.deviceLogging?.includes('debug')) {
314
+ this.log.warn('[DEBUG]', String(...log));
315
+ }
316
+ }
317
+ }
318
+
319
+ errorLog(...log: any[]): void {
320
+ if (this.enablingDeviceLogging()) {
321
+ this.log.error(String(...log));
322
+ }
323
+ }
324
+
325
+ debugErrorLog(...log: any[]): void {
326
+ if (this.enablingDeviceLogging()) {
327
+ if (this.deviceLogging?.includes('debug')) {
328
+ this.log.error('[DEBUG]', String(...log));
329
+ }
330
+ }
331
+ }
332
+
333
+ debugLog(...log: any[]): void {
334
+ if (this.enablingDeviceLogging()) {
335
+ if (this.deviceLogging === 'debug') {
336
+ this.log.info('[DEBUG]', String(...log));
337
+ } else {
338
+ this.log.debug(String(...log));
339
+ }
340
+ }
341
+ }
342
+
343
+ enablingDeviceLogging(): boolean {
344
+ return this.deviceLogging.includes('debug') || this.deviceLogging === 'standard';
345
+ }
346
+ }