@switchbot/homebridge-switchbot 2.0.0-beta.9 → 2.0.0

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 (120) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/README.md +3 -2
  3. package/config.schema.json +91 -19
  4. package/dist/device/bot.d.ts +34 -28
  5. package/dist/device/bot.d.ts.map +1 -1
  6. package/dist/device/bot.js +657 -648
  7. package/dist/device/bot.js.map +1 -1
  8. package/dist/device/ceilinglight.d.ts +137 -0
  9. package/dist/device/ceilinglight.d.ts.map +1 -0
  10. package/dist/device/ceilinglight.js +1127 -0
  11. package/dist/device/ceilinglight.js.map +1 -0
  12. package/dist/device/colorbulb.d.ts +36 -14
  13. package/dist/device/colorbulb.d.ts.map +1 -1
  14. package/dist/device/colorbulb.js +472 -297
  15. package/dist/device/colorbulb.js.map +1 -1
  16. package/dist/device/contact.d.ts +18 -8
  17. package/dist/device/contact.d.ts.map +1 -1
  18. package/dist/device/contact.js +306 -237
  19. package/dist/device/contact.js.map +1 -1
  20. package/dist/device/curtain.d.ts +23 -16
  21. package/dist/device/curtain.d.ts.map +1 -1
  22. package/dist/device/curtain.js +566 -502
  23. package/dist/device/curtain.js.map +1 -1
  24. package/dist/device/humidifier.d.ts +24 -18
  25. package/dist/device/humidifier.d.ts.map +1 -1
  26. package/dist/device/humidifier.js +453 -369
  27. package/dist/device/humidifier.js.map +1 -1
  28. package/dist/device/lock.d.ts +27 -8
  29. package/dist/device/lock.d.ts.map +1 -1
  30. package/dist/device/lock.js +305 -148
  31. package/dist/device/lock.js.map +1 -1
  32. package/dist/device/meter.d.ts +22 -16
  33. package/dist/device/meter.d.ts.map +1 -1
  34. package/dist/device/meter.js +367 -267
  35. package/dist/device/meter.js.map +1 -1
  36. package/dist/device/meterplus.d.ts +24 -12
  37. package/dist/device/meterplus.d.ts.map +1 -1
  38. package/dist/device/meterplus.js +381 -213
  39. package/dist/device/meterplus.js.map +1 -1
  40. package/dist/device/motion.d.ts +18 -8
  41. package/dist/device/motion.d.ts.map +1 -1
  42. package/dist/device/motion.js +279 -216
  43. package/dist/device/motion.js.map +1 -1
  44. package/dist/device/plug.d.ts +27 -17
  45. package/dist/device/plug.d.ts.map +1 -1
  46. package/dist/device/plug.js +295 -251
  47. package/dist/device/plug.js.map +1 -1
  48. package/dist/device/striplight.d.ts +43 -19
  49. package/dist/device/striplight.d.ts.map +1 -1
  50. package/dist/device/striplight.js +506 -262
  51. package/dist/device/striplight.js.map +1 -1
  52. package/dist/irdevice/airconditioner.d.ts +9 -12
  53. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  54. package/dist/irdevice/airconditioner.js +278 -230
  55. package/dist/irdevice/airconditioner.js.map +1 -1
  56. package/dist/irdevice/airpurifier.d.ts +5 -3
  57. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  58. package/dist/irdevice/airpurifier.js +154 -104
  59. package/dist/irdevice/airpurifier.js.map +1 -1
  60. package/dist/irdevice/camera.d.ts +11 -8
  61. package/dist/irdevice/camera.d.ts.map +1 -1
  62. package/dist/irdevice/camera.js +133 -86
  63. package/dist/irdevice/camera.js.map +1 -1
  64. package/dist/irdevice/fan.d.ts +10 -7
  65. package/dist/irdevice/fan.d.ts.map +1 -1
  66. package/dist/irdevice/fan.js +160 -109
  67. package/dist/irdevice/fan.js.map +1 -1
  68. package/dist/irdevice/light.d.ts +11 -8
  69. package/dist/irdevice/light.d.ts.map +1 -1
  70. package/dist/irdevice/light.js +137 -103
  71. package/dist/irdevice/light.js.map +1 -1
  72. package/dist/irdevice/other.d.ts +11 -8
  73. package/dist/irdevice/other.d.ts.map +1 -1
  74. package/dist/irdevice/other.js +145 -98
  75. package/dist/irdevice/other.js.map +1 -1
  76. package/dist/irdevice/tv.d.ts +12 -9
  77. package/dist/irdevice/tv.d.ts.map +1 -1
  78. package/dist/irdevice/tv.js +143 -93
  79. package/dist/irdevice/tv.js.map +1 -1
  80. package/dist/irdevice/vacuumcleaner.d.ts +9 -10
  81. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  82. package/dist/irdevice/vacuumcleaner.js +132 -89
  83. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  84. package/dist/irdevice/waterheater.d.ts +8 -9
  85. package/dist/irdevice/waterheater.d.ts.map +1 -1
  86. package/dist/irdevice/waterheater.js +132 -89
  87. package/dist/irdevice/waterheater.js.map +1 -1
  88. package/dist/platform.d.ts +13 -12
  89. package/dist/platform.d.ts.map +1 -1
  90. package/dist/platform.js +524 -418
  91. package/dist/platform.js.map +1 -1
  92. package/dist/settings.d.ts +19 -11
  93. package/dist/settings.d.ts.map +1 -1
  94. package/dist/settings.js.map +1 -1
  95. package/homebridge-ui/public/index.html +1 -0
  96. package/package.json +11 -9
  97. package/src/device/bot.ts +656 -659
  98. package/src/device/ceilinglight.ts +1208 -0
  99. package/src/device/colorbulb.ts +482 -334
  100. package/src/device/contact.ts +309 -241
  101. package/src/device/curtain.ts +571 -516
  102. package/src/device/humidifier.ts +456 -403
  103. package/src/device/lock.ts +314 -149
  104. package/src/device/meter.ts +378 -280
  105. package/src/device/meterplus.ts +391 -219
  106. package/src/device/motion.ts +285 -222
  107. package/src/device/plug.ts +299 -260
  108. package/src/device/striplight.ts +522 -289
  109. package/src/irdevice/airconditioner.ts +282 -241
  110. package/src/irdevice/airpurifier.ts +151 -103
  111. package/src/irdevice/camera.ts +131 -85
  112. package/src/irdevice/fan.ts +157 -106
  113. package/src/irdevice/light.ts +135 -103
  114. package/src/irdevice/other.ts +143 -97
  115. package/src/irdevice/tv.ts +142 -93
  116. package/src/irdevice/vacuumcleaner.ts +131 -89
  117. package/src/irdevice/waterheater.ts +130 -89
  118. package/src/platform.ts +522 -446
  119. package/src/settings.ts +20 -11
  120. package/.github/npm-version-script.js +0 -81
@@ -1,6 +1,7 @@
1
1
  import https from 'https';
2
2
  import crypto from 'crypto';
3
3
  import { IncomingMessage } from 'http';
4
+ import superStringify from 'super-stringify';
4
5
  import { SwitchBotPlatform } from '../platform';
5
6
  import { irDevicesConfig, irdevice, HostDomain, DevicePath } from '../settings';
6
7
  import { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
@@ -16,7 +17,6 @@ export class Light {
16
17
 
17
18
  // Characteristic Values
18
19
  On!: CharacteristicValue;
19
- OnCached!: CharacteristicValue;
20
20
 
21
21
  // Config
22
22
  deviceLogging!: string;
@@ -25,23 +25,22 @@ export class Light {
25
25
  // default placeholders
26
26
  this.logs(device);
27
27
  this.config(device);
28
- if (this.On === undefined) {
29
- this.On = false;
30
- } else {
31
- this.On = this.accessory.context.On;
32
- }
28
+ this.context();
33
29
 
34
30
  // set accessory information
35
31
  accessory
36
32
  .getService(this.platform.Service.AccessoryInformation)!
37
33
  .setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
38
34
  .setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
39
- .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
35
+ .setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
36
+ .setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision(accessory, device))
37
+ .getCharacteristic(this.platform.Characteristic.FirmwareRevision)
38
+ .updateValue(this.FirmwareRevision(accessory, device));
40
39
 
41
40
  // get the Television service if it exists, otherwise create a new Television service
42
41
  // you can create multiple services for each accessory
43
42
  (this.lightBulbService = accessory.getService(this.platform.Service.Lightbulb) || accessory.addService(this.platform.Service.Lightbulb)),
44
- `${accessory.displayName} Light Bulb`;
43
+ `${accessory.displayName} ${device.remoteType}`;
45
44
 
46
45
  // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
47
46
  // when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
@@ -53,26 +52,12 @@ export class Light {
53
52
 
54
53
  // handle on / off events using the On characteristic
55
54
  this.lightBulbService.getCharacteristic(this.platform.Characteristic.On).onSet(this.OnSet.bind(this));
56
-
57
- // handle Brightness events using the Brightness characteristic
58
- /* this.service
59
- .getCharacteristic(this.platform.Characteristic.Brightness)
60
- .on(CharacteristicEventTypes.SET, (value: any, callback: CharacteristicGetCallback) => {
61
- this.debugLog(`${this.device.remoteType} ${this.accessory.displayName} Set Brightness: ${value}`);
62
- this.Brightness = value;
63
- if (value > this.Brightness) {
64
- this.pushLightBrightnessUpChanges();
65
- } else {
66
- this.pushLightBrightnessDownChanges();
67
- }
68
- this.service.updateCharacteristic(this.platform.Characteristic.Active, this.Brightness);
69
- callback(null);
70
- });*/
71
55
  }
72
56
 
73
57
  async OnSet(value: CharacteristicValue): Promise<void> {
74
- this.debugLog(`Light: ${this.accessory.displayName} On: ${value}`);
58
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${value}`);
75
59
  this.On = value;
60
+ this.accessory.context.On = this.On;
76
61
  if (this.On) {
77
62
  await this.pushLightOnChanges();
78
63
  } else {
@@ -80,28 +65,19 @@ export class Light {
80
65
  }
81
66
  }
82
67
 
83
- async updateHomeKitCharacteristics(): Promise<void> {
84
- if (this.On === undefined) {
85
- this.debugLog(`Light: ${this.accessory.displayName} On: ${this.On}`);
86
- } else {
87
- this.lightBulbService?.updateCharacteristic(this.platform.Characteristic.On, this.On);
88
- this.debugLog(`Light: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
89
- }
90
- }
91
-
92
68
  /**
93
69
  * Pushes the requested changes to the SwitchBot API
94
70
  * deviceType commandType Command command parameter Description
95
- * Light: "command" "turnOff" "default" = set to OFF state
96
- * Light: "command" "turnOn" "default" = set to ON state
97
- * Light: "command" "volumeAdd" "default" = volume up
98
- * Light: "command" "volumeSub" "default" = volume down
99
- * Light: "command" "channelAdd" "default" = next channel
100
- * Light: "command" "channelSub" "default" = previous channel
71
+ * Light - "command" "turnOff" "default" = set to OFF state
72
+ * Light - "command" "turnOn" "default" = set to ON state
73
+ * Light - "command" "volumeAdd" "default" = volume up
74
+ * Light - "command" "volumeSub" "default" = volume down
75
+ * Light - "command" "channelAdd" "default" = next channel
76
+ * Light - "command" "channelSub" "default" = previous channel
101
77
  */
102
78
  async pushLightOnChanges(): Promise<void> {
103
79
  if (this.On) {
104
- const body = JSON.stringify({
80
+ const body = superStringify({
105
81
  'command': 'turnOn',
106
82
  'parameter': 'default',
107
83
  'commandType': 'command',
@@ -112,7 +88,7 @@ export class Light {
112
88
 
113
89
  async pushLightOffChanges(): Promise<void> {
114
90
  if (!this.On) {
115
- const body = JSON.stringify({
91
+ const body = superStringify({
116
92
  'command': 'turnOff',
117
93
  'parameter': 'default',
118
94
  'commandType': 'command',
@@ -122,7 +98,7 @@ export class Light {
122
98
  }
123
99
 
124
100
  async pushLightBrightnessUpChanges(): Promise<void> {
125
- const body = JSON.stringify({
101
+ const body = superStringify({
126
102
  'command': 'brightnessUp',
127
103
  'parameter': 'default',
128
104
  'commandType': 'command',
@@ -131,7 +107,7 @@ export class Light {
131
107
  }
132
108
 
133
109
  async pushLightBrightnessDownChanges(): Promise<void> {
134
- const body = JSON.stringify({
110
+ const body = superStringify({
135
111
  'command': 'brightnessDown',
136
112
  'parameter': 'default',
137
113
  'commandType': 'command',
@@ -140,92 +116,126 @@ export class Light {
140
116
  }
141
117
 
142
118
  async pushChanges(body): Promise<void> {
143
- try {
119
+ if (this.device.connectionType === 'OpenAPI') {
120
+ try {
144
121
  // Make Push On request to the API
145
- const t = Date.now();
146
- const nonce = 'requestID';
147
- const data = this.platform.config.credentials?.token + t + nonce;
148
- const signTerm = crypto.createHmac('sha256', this.platform.config.credentials?.secret)
149
- .update(Buffer.from(data, 'utf-8'))
150
- .digest();
151
- const sign = signTerm.toString('base64');
152
- this.debugLog(`Light: ${this.accessory.displayName} sign: ${sign}`);
153
- this.infoLog(`Light: ${this.accessory.displayName} Sending request to SwitchBot API. body: ${body},`);
154
- const options = {
155
- hostname: HostDomain,
156
- port: 443,
157
- path: `${DevicePath}/${this.device.deviceId}/commands`,
158
- method: 'POST',
159
- headers: {
160
- 'Authorization': this.platform.config.credentials?.token,
161
- 'sign': sign,
162
- 'nonce': nonce,
163
- 't': t,
164
- 'Content-Type': 'application/json',
165
- 'Content-Length': body.length,
166
- },
167
- };
168
- const req = https.request(options, res => {
169
- this.debugLog(`Light: ${this.accessory.displayName} statusCode: ${res.statusCode}`);
170
- this.statusCode({ res });
171
- res.on('data', d => {
172
- this.debugLog(`Light: ${this.accessory.displayName} d: ${d}`);
122
+ const t = Date.now();
123
+ const nonce = 'requestID';
124
+ const data = this.platform.config.credentials?.token + t + nonce;
125
+ const signTerm = crypto.createHmac('sha256', this.platform.config.credentials?.secret)
126
+ .update(Buffer.from(data, 'utf-8'))
127
+ .digest();
128
+ const sign = signTerm.toString('base64');
129
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} sign: ${sign}`);
130
+ this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API. body: ${body},`);
131
+ const options = {
132
+ hostname: HostDomain,
133
+ port: 443,
134
+ path: `${DevicePath}/${this.device.deviceId}/commands`,
135
+ method: 'POST',
136
+ headers: {
137
+ 'Authorization': this.platform.config.credentials?.token,
138
+ 'sign': sign,
139
+ 'nonce': nonce,
140
+ 't': t,
141
+ 'Content-Type': 'application/json',
142
+ 'Content-Length': body.length,
143
+ },
144
+ };
145
+ const req = https.request(options, res => {
146
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${res.statusCode}`);
147
+ this.statusCode({ res });
148
+ res.on('data', d => {
149
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} d: ${d}`);
150
+ });
173
151
  });
174
- });
175
- req.on('error', (e: any) => {
176
- this.errorLog(`Light: ${this.accessory.displayName} error message: ${e.message}`);
177
- });
178
- req.write(body);
179
- req.end();
180
- this.debugLog(`Light: ${this.accessory.displayName} pushchanges: ${JSON.stringify(req)}`);
181
- this.OnCached = this.On;
182
- this.accessory.context.On = this.OnCached;
183
- this.updateHomeKitCharacteristics();
184
- } catch (e: any) {
185
- this.errorLog(`Light: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection`);
186
- if (this.deviceLogging.includes('debug')) {
187
- this.errorLog(
188
- `Light: ${this.accessory.displayName} failed pushChanges with OpenAPI Connection,` + ` Error Message: ${JSON.stringify(e.message)}`,
152
+ req.on('error', (e: any) => {
153
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} error message: ${e.message}`);
154
+ });
155
+ req.write(body);
156
+ req.end();
157
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushchanges: ${superStringify(req)}`);
158
+ this.accessory.context.On = this.On;
159
+ this.updateHomeKitCharacteristics();
160
+ } catch (e: any) {
161
+ this.apiError(e);
162
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} failed pushChanges with ${this.device.connectionType} Connection,`
163
+ + ` Error Message: ${superStringify(e.message)}`,
189
164
  );
190
165
  }
191
- this.apiError(e);
166
+ } else {
167
+ this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
168
+ + ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
169
+ }
170
+ }
171
+
172
+ async updateHomeKitCharacteristics(): Promise<void> {
173
+ if (this.On === undefined) {
174
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
175
+ } else {
176
+ this.accessory.context.On = this.On;
177
+ this.lightBulbService?.updateCharacteristic(this.platform.Characteristic.On, this.On);
178
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
192
179
  }
193
180
  }
194
181
 
195
182
  async statusCode({ res }: { res: IncomingMessage }): Promise<void> {
196
183
  switch (res.statusCode) {
197
184
  case 151:
198
- this.errorLog(`Light: ${this.accessory.displayName} Command not supported by this device type.`);
185
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command not supported by this device type.`);
199
186
  break;
200
187
  case 152:
201
- this.errorLog(`Light: ${this.accessory.displayName} Device not found.`);
188
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device not found.`);
202
189
  break;
203
190
  case 160:
204
- this.errorLog(`Light: ${this.accessory.displayName} Command is not supported.`);
191
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Command is not supported.`);
205
192
  break;
206
193
  case 161:
207
- this.errorLog(`Light: ${this.accessory.displayName} Device is offline.`);
194
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Device is offline.`);
208
195
  break;
209
196
  case 171:
210
- this.errorLog(`Light: ${this.accessory.displayName} Hub Device is offline. Hub: ${this.device.hubDeviceId}`);
197
+ this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} Hub Device is offline. Hub: ${this.device.hubDeviceId}`);
211
198
  break;
212
199
  case 190:
213
200
  this.errorLog(
214
- `Light: ${this.accessory.displayName} Device internal error due to device states not synchronized` +
215
- ` with server, Or command: ${JSON.stringify(res)} format is invalid`,
201
+ `${this.device.remoteType}: ${this.accessory.displayName} Device internal error due to device states not synchronized` +
202
+ ` with server, Or command: ${superStringify(res)} format is invalid`,
216
203
  );
217
204
  break;
218
205
  case 100:
219
- this.debugLog(`Light: ${this.accessory.displayName} Command successfully sent.`);
206
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Command successfully sent.`);
220
207
  break;
221
208
  default:
222
- this.debugLog(`Light: ${this.accessory.displayName} Unknown statusCode.`);
209
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Unknown statusCode.`);
223
210
  }
224
211
  }
225
212
 
226
213
  async apiError(e: any): Promise<void> {
227
214
  this.lightBulbService.updateCharacteristic(this.platform.Characteristic.On, e);
228
- //throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
215
+ }
216
+
217
+ FirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
218
+ let FirmwareRevision: string;
219
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
220
+ + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
221
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
222
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
223
+ if (accessory.context.FirmwareRevision) {
224
+ FirmwareRevision = accessory.context.FirmwareRevision;
225
+ } else if (device.firmware) {
226
+ FirmwareRevision = device.firmware;
227
+ } else {
228
+ FirmwareRevision = this.platform.version;
229
+ }
230
+ return FirmwareRevision;
231
+ }
232
+
233
+ async context() {
234
+ if (this.On === undefined) {
235
+ this.On = false;
236
+ } else {
237
+ this.On = this.accessory.context.On;
238
+ }
229
239
  }
230
240
 
231
241
  async config(device: irdevice & irDevicesConfig): Promise<void> {
@@ -236,24 +246,30 @@ export class Light {
236
246
  if (device.logging !== undefined) {
237
247
  config['logging'] = device.logging;
238
248
  }
249
+ if (device.connectionType !== undefined) {
250
+ config['connectionType'] = device.connectionType;
251
+ }
252
+ if (device.external !== undefined) {
253
+ config['external'] = device.external;
254
+ }
239
255
  if (Object.entries(config).length !== 0) {
240
- this.infoLog(`Light: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
256
+ this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
241
257
  }
242
258
  }
243
259
 
244
260
  async logs(device: irdevice & irDevicesConfig): Promise<void> {
245
261
  if (this.platform.debugMode) {
246
262
  this.deviceLogging = this.accessory.context.logging = 'debugMode';
247
- this.debugLog(`Light: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
263
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
248
264
  } else if (device.logging) {
249
265
  this.deviceLogging = this.accessory.context.logging = device.logging;
250
- this.debugLog(`Light: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
266
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Config Logging: ${this.deviceLogging}`);
251
267
  } else if (this.platform.config.options?.logging) {
252
268
  this.deviceLogging = this.accessory.context.logging = this.platform.config.options?.logging;
253
- this.debugLog(`Light: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
269
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Platform Config Logging: ${this.deviceLogging}`);
254
270
  } else {
255
271
  this.deviceLogging = this.accessory.context.logging = 'standard';
256
- this.debugLog(`Light: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
272
+ this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Logging Not Set, Using: ${this.deviceLogging}`);
257
273
  }
258
274
  }
259
275
 
@@ -272,12 +288,28 @@ export class Light {
272
288
  }
273
289
  }
274
290
 
291
+ debugWarnLog(...log: any[]): void {
292
+ if (this.enablingDeviceLogging()) {
293
+ if (this.deviceLogging?.includes('debug')) {
294
+ this.platform.log.warn('[DEBUG]', String(...log));
295
+ }
296
+ }
297
+ }
298
+
275
299
  errorLog(...log: any[]): void {
276
300
  if (this.enablingDeviceLogging()) {
277
301
  this.platform.log.error(String(...log));
278
302
  }
279
303
  }
280
304
 
305
+ debugErrorLog(...log: any[]): void {
306
+ if (this.enablingDeviceLogging()) {
307
+ if (this.deviceLogging?.includes('debug')) {
308
+ this.platform.log.error('[DEBUG]', String(...log));
309
+ }
310
+ }
311
+ }
312
+
281
313
  debugLog(...log: any[]): void {
282
314
  if (this.enablingDeviceLogging()) {
283
315
  if (this.deviceLogging === 'debug') {