@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.
- package/CHANGELOG.md +10 -1
- package/README.md +3 -2
- package/config.schema.json +91 -19
- package/dist/device/bot.d.ts +34 -28
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +657 -648
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +137 -0
- package/dist/device/ceilinglight.d.ts.map +1 -0
- package/dist/device/ceilinglight.js +1127 -0
- package/dist/device/ceilinglight.js.map +1 -0
- package/dist/device/colorbulb.d.ts +36 -14
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +472 -297
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +18 -8
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +306 -237
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +23 -16
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +566 -502
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/humidifier.d.ts +24 -18
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +453 -369
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/lock.d.ts +27 -8
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +305 -148
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +22 -16
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +367 -267
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +24 -12
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +381 -213
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +18 -8
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +279 -216
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +27 -17
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +295 -251
- package/dist/device/plug.js.map +1 -1
- package/dist/device/striplight.d.ts +43 -19
- package/dist/device/striplight.d.ts.map +1 -1
- package/dist/device/striplight.js +506 -262
- package/dist/device/striplight.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +9 -12
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +278 -230
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +5 -3
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +154 -104
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +11 -8
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +133 -86
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +10 -7
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +160 -109
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts +11 -8
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +137 -103
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +11 -8
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +145 -98
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +12 -9
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +143 -93
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +9 -10
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +132 -89
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +8 -9
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +132 -89
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts +13 -12
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +524 -418
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +19 -11
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/homebridge-ui/public/index.html +1 -0
- package/package.json +11 -9
- package/src/device/bot.ts +656 -659
- package/src/device/ceilinglight.ts +1208 -0
- package/src/device/colorbulb.ts +482 -334
- package/src/device/contact.ts +309 -241
- package/src/device/curtain.ts +571 -516
- package/src/device/humidifier.ts +456 -403
- package/src/device/lock.ts +314 -149
- package/src/device/meter.ts +378 -280
- package/src/device/meterplus.ts +391 -219
- package/src/device/motion.ts +285 -222
- package/src/device/plug.ts +299 -260
- package/src/device/striplight.ts +522 -289
- package/src/irdevice/airconditioner.ts +282 -241
- package/src/irdevice/airpurifier.ts +151 -103
- package/src/irdevice/camera.ts +131 -85
- package/src/irdevice/fan.ts +157 -106
- package/src/irdevice/light.ts +135 -103
- package/src/irdevice/other.ts +143 -97
- package/src/irdevice/tv.ts +142 -93
- package/src/irdevice/vacuumcleaner.ts +131 -89
- package/src/irdevice/waterheater.ts +130 -89
- package/src/platform.ts +522 -446
- package/src/settings.ts +20 -11
- package/.github/npm-version-script.js +0 -81
package/src/irdevice/tv.ts
CHANGED
|
@@ -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 { CharacteristicValue, PlatformAccessory, Service } from 'homebridge';
|
|
6
7
|
import { irdevice, irDevicesConfig, HostDomain, DevicePath } from '../settings';
|
|
@@ -17,7 +18,6 @@ export class TV {
|
|
|
17
18
|
|
|
18
19
|
// Characteristic Values
|
|
19
20
|
Active!: CharacteristicValue;
|
|
20
|
-
ActiveCached!: CharacteristicValue;
|
|
21
21
|
ActiveIdentifier!: CharacteristicValue;
|
|
22
22
|
|
|
23
23
|
// Others
|
|
@@ -30,11 +30,7 @@ export class TV {
|
|
|
30
30
|
// default placeholders
|
|
31
31
|
this.logs(device);
|
|
32
32
|
this.config(device);
|
|
33
|
-
|
|
34
|
-
this.Active = this.platform.Characteristic.Active.INACTIVE;
|
|
35
|
-
} else {
|
|
36
|
-
this.Active = this.accessory.context.Active;
|
|
37
|
-
}
|
|
33
|
+
this.context();
|
|
38
34
|
|
|
39
35
|
// set accessory information
|
|
40
36
|
accessory
|
|
@@ -42,7 +38,10 @@ export class TV {
|
|
|
42
38
|
.setCharacteristic(this.platform.Characteristic.Name, `${device.deviceName} ${device.remoteType}`)
|
|
43
39
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
44
40
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
45
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
41
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
42
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision(accessory, device))
|
|
43
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
44
|
+
.updateValue(this.FirmwareRevision(accessory, device));
|
|
46
45
|
|
|
47
46
|
// set the accessory category
|
|
48
47
|
switch (device.remoteType) {
|
|
@@ -194,50 +193,35 @@ export class TV {
|
|
|
194
193
|
async ActiveIdentifierSet(value: CharacteristicValue): Promise<void> {
|
|
195
194
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} ActiveIdentifier: ${value}`);
|
|
196
195
|
this.ActiveIdentifier = value;
|
|
196
|
+
this.accessory.context.ActiveIdentifier = this.ActiveIdentifier;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
async ActiveSet(value: CharacteristicValue): Promise<void> {
|
|
200
200
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${value}`);
|
|
201
|
+
this.Active = value;
|
|
202
|
+
this.accessory.context.Active = this.Active;
|
|
201
203
|
if (!this.device.irtv?.disable_power) {
|
|
202
204
|
if (value === this.platform.Characteristic.Active.INACTIVE) {
|
|
203
205
|
await this.pushTvOffChanges();
|
|
204
206
|
} else {
|
|
205
207
|
await this.pushTvOnChanges();
|
|
206
208
|
}
|
|
207
|
-
this.Active = value;
|
|
208
|
-
this.ActiveCached = this.Active;
|
|
209
|
-
this.accessory.context.Active = this.ActiveCached;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
async updateHomeKitCharacteristics(): Promise<void> {
|
|
214
|
-
if (this.Active === undefined) {
|
|
215
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
216
|
-
} else {
|
|
217
|
-
this.tvService?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
|
|
218
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
219
|
-
}
|
|
220
|
-
if (this.ActiveIdentifier === undefined) {
|
|
221
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} ActiveIdentifier: ${this.ActiveIdentifier}`);
|
|
222
|
-
} else {
|
|
223
|
-
this.tvService?.updateCharacteristic(this.platform.Characteristic.ActiveIdentifier, this.ActiveIdentifier);
|
|
224
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}` + ` updateCharacteristic ActiveIdentifier: ${this.ActiveIdentifier}`);
|
|
225
209
|
}
|
|
226
210
|
}
|
|
227
211
|
|
|
228
212
|
/**
|
|
229
213
|
* Pushes the requested changes to the SwitchBot API
|
|
230
|
-
* deviceType
|
|
231
|
-
* TV
|
|
232
|
-
* TV
|
|
233
|
-
* TV
|
|
234
|
-
* TV
|
|
235
|
-
* TV
|
|
236
|
-
* TV
|
|
214
|
+
* deviceType commandType Command Parameter Description
|
|
215
|
+
* TV "command" "turnOff" "default" set to OFF state
|
|
216
|
+
* TV "command" "turnOn" "default" set to ON state
|
|
217
|
+
* TV "command" "volumeAdd" "default" volume up
|
|
218
|
+
* TV "command" "volumeSub" "default" volume down
|
|
219
|
+
* TV "command" "channelAdd" "default" next channel
|
|
220
|
+
* TV "command" "channelSub" "default" previous channel
|
|
237
221
|
*/
|
|
238
222
|
async pushTvOnChanges(): Promise<void> {
|
|
239
223
|
if (this.Active !== 1) {
|
|
240
|
-
const body =
|
|
224
|
+
const body = superStringify({
|
|
241
225
|
'command': 'turnOn',
|
|
242
226
|
'parameter': 'default',
|
|
243
227
|
'commandType': 'command',
|
|
@@ -247,7 +231,7 @@ export class TV {
|
|
|
247
231
|
}
|
|
248
232
|
|
|
249
233
|
async pushTvOffChanges(): Promise<void> {
|
|
250
|
-
const body =
|
|
234
|
+
const body = superStringify({
|
|
251
235
|
'command': 'turnOff',
|
|
252
236
|
'parameter': 'default',
|
|
253
237
|
'commandType': 'command',
|
|
@@ -256,7 +240,7 @@ export class TV {
|
|
|
256
240
|
}
|
|
257
241
|
|
|
258
242
|
async pushOkChanges(): Promise<void> {
|
|
259
|
-
const body =
|
|
243
|
+
const body = superStringify({
|
|
260
244
|
'command': 'Ok',
|
|
261
245
|
'parameter': 'default',
|
|
262
246
|
'commandType': 'command',
|
|
@@ -265,7 +249,7 @@ export class TV {
|
|
|
265
249
|
}
|
|
266
250
|
|
|
267
251
|
async pushBackChanges(): Promise<void> {
|
|
268
|
-
const body =
|
|
252
|
+
const body = superStringify({
|
|
269
253
|
'command': 'Back',
|
|
270
254
|
'parameter': 'default',
|
|
271
255
|
'commandType': 'command',
|
|
@@ -274,7 +258,7 @@ export class TV {
|
|
|
274
258
|
}
|
|
275
259
|
|
|
276
260
|
async pushMenuChanges(): Promise<void> {
|
|
277
|
-
const body =
|
|
261
|
+
const body = superStringify({
|
|
278
262
|
'command': 'Menu',
|
|
279
263
|
'parameter': 'default',
|
|
280
264
|
'commandType': 'command',
|
|
@@ -283,7 +267,7 @@ export class TV {
|
|
|
283
267
|
}
|
|
284
268
|
|
|
285
269
|
async pushUpChanges(): Promise<void> {
|
|
286
|
-
const body =
|
|
270
|
+
const body = superStringify({
|
|
287
271
|
'command': 'Up',
|
|
288
272
|
'parameter': 'default',
|
|
289
273
|
'commandType': 'command',
|
|
@@ -292,7 +276,7 @@ export class TV {
|
|
|
292
276
|
}
|
|
293
277
|
|
|
294
278
|
async pushDownChanges(): Promise<void> {
|
|
295
|
-
const body =
|
|
279
|
+
const body = superStringify({
|
|
296
280
|
'command': 'Down',
|
|
297
281
|
'parameter': 'default',
|
|
298
282
|
'commandType': 'command',
|
|
@@ -301,7 +285,7 @@ export class TV {
|
|
|
301
285
|
}
|
|
302
286
|
|
|
303
287
|
async pushRightChanges(): Promise<void> {
|
|
304
|
-
const body =
|
|
288
|
+
const body = superStringify({
|
|
305
289
|
'command': 'Right',
|
|
306
290
|
'parameter': 'default',
|
|
307
291
|
'commandType': 'command',
|
|
@@ -310,7 +294,7 @@ export class TV {
|
|
|
310
294
|
}
|
|
311
295
|
|
|
312
296
|
async pushLeftChanges(): Promise<void> {
|
|
313
|
-
const body =
|
|
297
|
+
const body = superStringify({
|
|
314
298
|
'command': 'Left',
|
|
315
299
|
'parameter': 'default',
|
|
316
300
|
'commandType': 'command',
|
|
@@ -319,7 +303,7 @@ export class TV {
|
|
|
319
303
|
}
|
|
320
304
|
|
|
321
305
|
async pushVolumeUpChanges(): Promise<void> {
|
|
322
|
-
const body =
|
|
306
|
+
const body = superStringify({
|
|
323
307
|
'command': 'volumeAdd',
|
|
324
308
|
'parameter': 'default',
|
|
325
309
|
'commandType': 'command',
|
|
@@ -328,7 +312,7 @@ export class TV {
|
|
|
328
312
|
}
|
|
329
313
|
|
|
330
314
|
async pushVolumeDownChanges(): Promise<void> {
|
|
331
|
-
const body =
|
|
315
|
+
const body = superStringify({
|
|
332
316
|
'command': 'volumeSub',
|
|
333
317
|
'parameter': 'default',
|
|
334
318
|
'commandType': 'command',
|
|
@@ -337,54 +321,74 @@ export class TV {
|
|
|
337
321
|
}
|
|
338
322
|
|
|
339
323
|
async pushTVChanges(body): Promise<void> {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
`${this.device.remoteType}: ${this.accessory.displayName} failed pushChanges with
|
|
384
|
-
` Error Message: ${
|
|
385
|
-
|
|
324
|
+
if (this.device.connectionType === 'OpenAPI') {
|
|
325
|
+
{
|
|
326
|
+
try {
|
|
327
|
+
// Make Push On request to the API
|
|
328
|
+
const t = Date.now();
|
|
329
|
+
const nonce = 'requestID';
|
|
330
|
+
const data = this.platform.config.credentials?.token + t + nonce;
|
|
331
|
+
const signTerm = crypto.createHmac('sha256', this.platform.config.credentials?.secret)
|
|
332
|
+
.update(Buffer.from(data, 'utf-8'))
|
|
333
|
+
.digest();
|
|
334
|
+
const sign = signTerm.toString('base64');
|
|
335
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} sign: ${sign}`);
|
|
336
|
+
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API. body: ${body},`);
|
|
337
|
+
const options = {
|
|
338
|
+
hostname: HostDomain,
|
|
339
|
+
port: 443,
|
|
340
|
+
path: `${DevicePath}/${this.device.deviceId}/commands`,
|
|
341
|
+
method: 'POST',
|
|
342
|
+
headers: {
|
|
343
|
+
'Authorization': this.platform.config.credentials?.token,
|
|
344
|
+
'sign': sign,
|
|
345
|
+
'nonce': nonce,
|
|
346
|
+
't': t,
|
|
347
|
+
'Content-Type': 'application/json',
|
|
348
|
+
'Content-Length': body.length,
|
|
349
|
+
},
|
|
350
|
+
};
|
|
351
|
+
const req = https.request(options, res => {
|
|
352
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushchanges statusCode: ${res.statusCode}`);
|
|
353
|
+
this.statusCode({ res });
|
|
354
|
+
res.on('data', d => {
|
|
355
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} d: ${d}`);
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
req.on('error', (e: any) => {
|
|
359
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} error message: ${e.message}`);
|
|
360
|
+
});
|
|
361
|
+
req.write(body);
|
|
362
|
+
req.end();
|
|
363
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushchanges: ${superStringify(req)}`);
|
|
364
|
+
this.updateHomeKitCharacteristics();
|
|
365
|
+
} catch (e: any) {
|
|
366
|
+
this.apiError(e);
|
|
367
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} failed pushChanges with ${this.device.connectionType} Connection,`
|
|
368
|
+
+ ` Error Message: ${superStringify(e.message)}`,
|
|
369
|
+
);
|
|
370
|
+
}
|
|
386
371
|
}
|
|
387
|
-
|
|
372
|
+
} else {
|
|
373
|
+
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
374
|
+
+ ` Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
async updateHomeKitCharacteristics(): Promise<void> {
|
|
379
|
+
if (this.Active === undefined) {
|
|
380
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
381
|
+
} else {
|
|
382
|
+
this.accessory.context.Active = this.Active;
|
|
383
|
+
this.tvService?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
|
|
384
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
385
|
+
}
|
|
386
|
+
if (this.ActiveIdentifier === undefined) {
|
|
387
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} ActiveIdentifier: ${this.ActiveIdentifier}`);
|
|
388
|
+
} else {
|
|
389
|
+
this.accessory.context.ActiveIdentifier = this.ActiveIdentifier;
|
|
390
|
+
this.tvService?.updateCharacteristic(this.platform.Characteristic.ActiveIdentifier, this.ActiveIdentifier);
|
|
391
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}` + ` updateCharacteristic ActiveIdentifier: ${this.ActiveIdentifier}`);
|
|
388
392
|
}
|
|
389
393
|
}
|
|
390
394
|
|
|
@@ -409,7 +413,7 @@ export class TV {
|
|
|
409
413
|
this.errorLog(
|
|
410
414
|
`${this.device.remoteType}: ` +
|
|
411
415
|
`${this.accessory.displayName} Device internal error due to device states not synchronized with server,` +
|
|
412
|
-
` Or command: ${
|
|
416
|
+
` Or command: ${superStringify(res)} format is invalid`,
|
|
413
417
|
);
|
|
414
418
|
break;
|
|
415
419
|
case 100:
|
|
@@ -423,7 +427,30 @@ export class TV {
|
|
|
423
427
|
async apiError(e: any): Promise<void> {
|
|
424
428
|
this.tvService.updateCharacteristic(this.platform.Characteristic.Active, e);
|
|
425
429
|
this.tvService.updateCharacteristic(this.platform.Characteristic.ActiveIdentifier, e);
|
|
426
|
-
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
FirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
|
|
433
|
+
let FirmwareRevision: string;
|
|
434
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
435
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
436
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
437
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
438
|
+
if (accessory.context.FirmwareRevision) {
|
|
439
|
+
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
440
|
+
} else if (device.firmware) {
|
|
441
|
+
FirmwareRevision = device.firmware;
|
|
442
|
+
} else {
|
|
443
|
+
FirmwareRevision = this.platform.version;
|
|
444
|
+
}
|
|
445
|
+
return FirmwareRevision;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
async context() {
|
|
449
|
+
if (this.Active === undefined) {
|
|
450
|
+
this.Active = this.platform.Characteristic.Active.INACTIVE;
|
|
451
|
+
} else {
|
|
452
|
+
this.Active = this.accessory.context.Active;
|
|
453
|
+
}
|
|
427
454
|
}
|
|
428
455
|
|
|
429
456
|
async config(device: irdevice & irDevicesConfig): Promise<void> {
|
|
@@ -434,8 +461,14 @@ export class TV {
|
|
|
434
461
|
if (device.logging !== undefined) {
|
|
435
462
|
config['logging'] = device.logging;
|
|
436
463
|
}
|
|
464
|
+
if (device.connectionType !== undefined) {
|
|
465
|
+
config['connectionType'] = device.connectionType;
|
|
466
|
+
}
|
|
467
|
+
if (device.external !== undefined) {
|
|
468
|
+
config['external'] = device.external;
|
|
469
|
+
}
|
|
437
470
|
if (Object.entries(config).length !== 0) {
|
|
438
|
-
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${
|
|
471
|
+
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Config: ${superStringify(config)}`);
|
|
439
472
|
}
|
|
440
473
|
}
|
|
441
474
|
|
|
@@ -470,12 +503,28 @@ export class TV {
|
|
|
470
503
|
}
|
|
471
504
|
}
|
|
472
505
|
|
|
506
|
+
debugWarnLog(...log: any[]): void {
|
|
507
|
+
if (this.enablingDeviceLogging()) {
|
|
508
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
509
|
+
this.platform.log.warn('[DEBUG]', String(...log));
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
473
514
|
errorLog(...log: any[]): void {
|
|
474
515
|
if (this.enablingDeviceLogging()) {
|
|
475
516
|
this.platform.log.error(String(...log));
|
|
476
517
|
}
|
|
477
518
|
}
|
|
478
519
|
|
|
520
|
+
debugErrorLog(...log: any[]): void {
|
|
521
|
+
if (this.enablingDeviceLogging()) {
|
|
522
|
+
if (this.deviceLogging?.includes('debug')) {
|
|
523
|
+
this.platform.log.error('[DEBUG]', String(...log));
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
|
|
479
528
|
debugLog(...log: any[]): void {
|
|
480
529
|
if (this.enablingDeviceLogging()) {
|
|
481
530
|
if (this.deviceLogging === 'debug') {
|