@homebridge-plugins/homebridge-smarthq 0.5.0-beta.26 → 0.5.0-beta.27
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/dist/devices/airConditioner.d.ts +11 -2
- package/dist/devices/airConditioner.d.ts.map +1 -1
- package/dist/devices/airConditioner.js +110 -9
- package/dist/devices/airConditioner.js.map +1 -1
- package/dist/devices/clothesDryer.d.ts +9 -0
- package/dist/devices/clothesDryer.d.ts.map +1 -1
- package/dist/devices/clothesDryer.js +112 -8
- package/dist/devices/clothesDryer.js.map +1 -1
- package/dist/devices/clothesWasher.d.ts +9 -0
- package/dist/devices/clothesWasher.d.ts.map +1 -1
- package/dist/devices/clothesWasher.js +106 -8
- package/dist/devices/clothesWasher.js.map +1 -1
- package/dist/devices/dishwasher.d.ts +9 -0
- package/dist/devices/dishwasher.d.ts.map +1 -1
- package/dist/devices/dishwasher.js +102 -0
- package/dist/devices/dishwasher.js.map +1 -1
- package/dist/devices/hood.d.ts +11 -2
- package/dist/devices/hood.d.ts.map +1 -1
- package/dist/devices/hood.js +70 -2
- package/dist/devices/hood.js.map +1 -1
- package/dist/devices/microwave.d.ts +9 -0
- package/dist/devices/microwave.d.ts.map +1 -1
- package/dist/devices/microwave.js +65 -0
- package/dist/devices/microwave.js.map +1 -1
- package/dist/devices/oven.d.ts +9 -0
- package/dist/devices/oven.d.ts.map +1 -1
- package/dist/devices/oven.js +110 -0
- package/dist/devices/oven.js.map +1 -1
- package/dist/devices/waterHeater.d.ts +9 -0
- package/dist/devices/waterHeater.d.ts.map +1 -1
- package/dist/devices/waterHeater.js +68 -0
- package/dist/devices/waterHeater.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +192 -190
- package/dist/platform.js.map +1 -1
- package/docs/classes/SmartHQPlatform.html +10 -10
- package/docs/interfaces/DeviceOptions.html +2 -2
- package/docs/interfaces/SmartHQPlatformConfig.html +2 -2
- package/docs/interfaces/SmartHqContext.html +2 -2
- package/docs/interfaces/SmartHqERDResponse.html +2 -2
- package/docs/interfaces/credentials.html +2 -2
- package/docs/interfaces/devicesConfig.html +2 -2
- package/docs/interfaces/options.html +2 -2
- package/docs/variables/API_URL.html +1 -1
- package/docs/variables/ERD_CODES.html +1 -1
- package/docs/variables/ERD_TYPES.html +1 -1
- package/docs/variables/KEEPALIVE_TIMEOUT.html +1 -1
- package/docs/variables/LOGIN_URL.html +1 -1
- package/docs/variables/OAUTH2_CLIENT_ID.html +1 -1
- package/docs/variables/OAUTH2_CLIENT_SECRET.html +1 -1
- package/docs/variables/OAUTH2_REDIRECT_URI.html +1 -1
- package/docs/variables/PLATFORM_NAME.html +1 -1
- package/docs/variables/PLUGIN_NAME.html +1 -1
- package/docs/variables/SECURE_URL.html +1 -1
- package/docs/variables/default.html +1 -1
- package/package.json +3 -3
package/dist/platform.js
CHANGED
|
@@ -329,97 +329,83 @@ export class SmartHQPlatform {
|
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
async createSmartHQDishWasher(userId, device, details, features) {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
//
|
|
332
|
+
// Merge device data
|
|
333
|
+
const deviceData = { brand: 'GE', ...details, ...features, ...device };
|
|
334
|
+
// Determine protocol (Matter or HAP)
|
|
335
|
+
deviceData.useMatter = this.shouldUseMatter(deviceData);
|
|
336
|
+
const uuid = this.api.hap.uuid.generate(deviceData.applianceId);
|
|
335
337
|
const existingAccessory = this.accessories.find(accessory => accessory.UUID === uuid);
|
|
338
|
+
const protocol = deviceData.useMatter ? 'Matter' : 'HAP';
|
|
336
339
|
if (existingAccessory) {
|
|
337
340
|
// the accessory already exists
|
|
338
|
-
if (!
|
|
339
|
-
|
|
340
|
-
existingAccessory.context
|
|
341
|
-
existingAccessory.
|
|
342
|
-
existingAccessory.
|
|
343
|
-
existingAccessory.context.device.firmware = device.firmware ?? await this.getVersion();
|
|
341
|
+
if (!deviceData.hide_device) {
|
|
342
|
+
existingAccessory.context.device = deviceData;
|
|
343
|
+
existingAccessory.context = { device: deviceData, userId };
|
|
344
|
+
existingAccessory.displayName = await this.validateAndCleanDisplayName(deviceData.nickname, 'nickname', deviceData.nickname);
|
|
345
|
+
existingAccessory.context.device.firmware = deviceData.firmware ?? await this.getVersion();
|
|
344
346
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
345
|
-
|
|
346
|
-
this
|
|
347
|
-
|
|
348
|
-
// this is imported from `platformAccessory.ts`
|
|
349
|
-
new SmartHQDishWasher(this, existingAccessory, device);
|
|
350
|
-
this.debugLog(`${device.nickname} uuid: ${device.applianceId}`);
|
|
347
|
+
this.infoLog(`[${protocol}] Restoring existing accessory from cache: ${existingAccessory.displayName}`);
|
|
348
|
+
new SmartHQDishWasher(this, existingAccessory, deviceData);
|
|
349
|
+
await this.debugLog(`${deviceData.nickname} uuid: ${deviceData.applianceId}`);
|
|
351
350
|
}
|
|
352
351
|
else {
|
|
353
352
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
354
353
|
}
|
|
355
354
|
}
|
|
356
|
-
else if (!
|
|
357
|
-
this.infoLog(`Adding new accessory: ${
|
|
358
|
-
const accessory = new this.api.platformAccessory(
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
accessory.
|
|
362
|
-
accessory.context =
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
// the accessory does not yet exist, so we need to create it
|
|
366
|
-
// create the accessory handler for the newly create accessory
|
|
367
|
-
// this is imported from `platformAccessory.ts`
|
|
368
|
-
new SmartHQDishWasher(this, accessory, device);
|
|
369
|
-
this.debugLog(`${device.nickname} uuid: ${device.applianceId}`);
|
|
370
|
-
// link the accessory to your platform
|
|
355
|
+
else if (!deviceData.hide_device && !existingAccessory) {
|
|
356
|
+
this.infoLog(`[${protocol}] Adding new accessory: ${deviceData.nickname}`);
|
|
357
|
+
const accessory = new this.api.platformAccessory(deviceData.nickname, uuid);
|
|
358
|
+
accessory.context.device = deviceData;
|
|
359
|
+
accessory.context = { device: deviceData, userId };
|
|
360
|
+
accessory.displayName = await this.validateAndCleanDisplayName(deviceData.nickname, 'nickname', deviceData.nickname);
|
|
361
|
+
accessory.context.device.firmware = deviceData.firmware ?? await this.getVersion();
|
|
362
|
+
new SmartHQDishWasher(this, accessory, deviceData);
|
|
363
|
+
this.debugLog(`${deviceData.nickname} uuid: ${deviceData.applianceId}`);
|
|
371
364
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
372
365
|
this.accessories.push(accessory);
|
|
373
366
|
}
|
|
374
367
|
else {
|
|
375
|
-
this.debugErrorLog(`Unable to Register new device: ${JSON.stringify(
|
|
368
|
+
this.debugErrorLog(`Unable to Register new device: ${JSON.stringify(deviceData.nickname)}`);
|
|
376
369
|
}
|
|
377
370
|
}
|
|
378
371
|
async createSmartHQOven(userId, device, details, features) {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
//
|
|
372
|
+
// Merge device data
|
|
373
|
+
const deviceData = { brand: 'GE', ...details, ...features, ...device };
|
|
374
|
+
// Determine protocol (Matter or HAP)
|
|
375
|
+
deviceData.useMatter = this.shouldUseMatter(deviceData);
|
|
376
|
+
const uuid = this.api.hap.uuid.generate(deviceData.applianceId);
|
|
382
377
|
const existingAccessory = this.accessories.find(accessory => accessory.UUID === uuid);
|
|
378
|
+
const protocol = deviceData.useMatter ? 'Matter' : 'HAP';
|
|
383
379
|
if (existingAccessory) {
|
|
384
380
|
// the accessory already exists
|
|
385
|
-
if (!
|
|
386
|
-
|
|
387
|
-
existingAccessory.context
|
|
388
|
-
existingAccessory.
|
|
389
|
-
existingAccessory.
|
|
390
|
-
existingAccessory.context.device.firmware = device.firmware ?? await this.getVersion();
|
|
381
|
+
if (!deviceData.hide_device) {
|
|
382
|
+
existingAccessory.context.device = deviceData;
|
|
383
|
+
existingAccessory.context = { device: deviceData, userId };
|
|
384
|
+
existingAccessory.displayName = await this.validateAndCleanDisplayName(deviceData.nickname, 'nickname', deviceData.nickname);
|
|
385
|
+
existingAccessory.context.device.firmware = deviceData.firmware ?? await this.getVersion();
|
|
391
386
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
392
|
-
|
|
393
|
-
this
|
|
394
|
-
|
|
395
|
-
// this is imported from `platformAccessory.ts`
|
|
396
|
-
new SmartHQOven(this, existingAccessory, device);
|
|
397
|
-
await this.debugLog(`${device.nickname} uuid: ${device.applianceId}`);
|
|
387
|
+
this.infoLog(`[${protocol}] Restoring existing accessory from cache: ${existingAccessory.displayName}`);
|
|
388
|
+
new SmartHQOven(this, existingAccessory, deviceData);
|
|
389
|
+
await this.debugLog(`${deviceData.nickname} uuid: ${deviceData.applianceId}`);
|
|
398
390
|
}
|
|
399
391
|
else {
|
|
400
392
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
401
393
|
}
|
|
402
394
|
}
|
|
403
|
-
else if (!
|
|
404
|
-
this.infoLog(`Adding new accessory: ${
|
|
405
|
-
const accessory = new this.api.platformAccessory(
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
accessory.
|
|
409
|
-
accessory.context =
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
// the accessory does not yet exist, so we need to create it
|
|
413
|
-
// create the accessory handler for the newly create accessory
|
|
414
|
-
// this is imported from `platformAccessory.ts`
|
|
415
|
-
new SmartHQOven(this, accessory, device);
|
|
416
|
-
this.debugLog(`${device.nickname} uuid: ${device.applianceId}`);
|
|
417
|
-
// link the accessory to your platform
|
|
395
|
+
else if (!deviceData.hide_device && !existingAccessory) {
|
|
396
|
+
this.infoLog(`[${protocol}] Adding new accessory: ${deviceData.nickname}`);
|
|
397
|
+
const accessory = new this.api.platformAccessory(deviceData.nickname, uuid);
|
|
398
|
+
accessory.context.device = deviceData;
|
|
399
|
+
accessory.context = { device: deviceData, userId };
|
|
400
|
+
accessory.displayName = await this.validateAndCleanDisplayName(deviceData.nickname, 'nickname', deviceData.nickname);
|
|
401
|
+
accessory.context.device.firmware = deviceData.firmware ?? await this.getVersion();
|
|
402
|
+
new SmartHQOven(this, accessory, deviceData);
|
|
403
|
+
this.debugLog(`${deviceData.nickname} uuid: ${deviceData.applianceId}`);
|
|
418
404
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
419
405
|
this.accessories.push(accessory);
|
|
420
406
|
}
|
|
421
407
|
else {
|
|
422
|
-
this.debugErrorLog(`Unable to Register new device: ${JSON.stringify(
|
|
408
|
+
this.debugErrorLog(`Unable to Register new device: ${JSON.stringify(deviceData.nickname)}`);
|
|
423
409
|
}
|
|
424
410
|
}
|
|
425
411
|
async createSmartHQIceMaker(userId, device, details, features) {
|
|
@@ -513,154 +499,160 @@ export class SmartHQPlatform {
|
|
|
513
499
|
}
|
|
514
500
|
}
|
|
515
501
|
async createSmartHQAirConditioner(userId, device, details, features) {
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
//
|
|
502
|
+
// Merge device data
|
|
503
|
+
const deviceData = { brand: 'GE', ...details, ...features, ...device };
|
|
504
|
+
// Determine protocol (Matter or HAP)
|
|
505
|
+
deviceData.useMatter = this.shouldUseMatter(deviceData);
|
|
506
|
+
const uuid = this.api.hap.uuid.generate(deviceData.applianceId);
|
|
519
507
|
const existingAccessory = this.accessories.find(accessory => accessory.UUID === uuid);
|
|
508
|
+
const protocol = deviceData.useMatter ? 'Matter' : 'HAP';
|
|
520
509
|
if (existingAccessory) {
|
|
521
510
|
// the accessory already exists
|
|
522
|
-
if (!
|
|
523
|
-
|
|
524
|
-
existingAccessory.context
|
|
525
|
-
existingAccessory.
|
|
526
|
-
existingAccessory.
|
|
527
|
-
existingAccessory.context.device.firmware = device.firmware ?? await this.getVersion();
|
|
511
|
+
if (!deviceData.hide_device) {
|
|
512
|
+
existingAccessory.context.device = deviceData;
|
|
513
|
+
existingAccessory.context = { device: deviceData, userId };
|
|
514
|
+
existingAccessory.displayName = await this.validateAndCleanDisplayName(deviceData.nickname, 'nickname', deviceData.nickname);
|
|
515
|
+
existingAccessory.context.device.firmware = deviceData.firmware ?? await this.getVersion();
|
|
528
516
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
529
|
-
|
|
530
|
-
this
|
|
531
|
-
|
|
532
|
-
// this is imported from `platformAccessory.ts`
|
|
533
|
-
new SmartHQAirConditioner(this, existingAccessory, device);
|
|
534
|
-
this.debugLog(`${device.nickname} uuid: ${device.applianceId}`);
|
|
517
|
+
this.infoLog(`[${protocol}] Restoring existing accessory from cache: ${existingAccessory.displayName}`);
|
|
518
|
+
new SmartHQAirConditioner(this, existingAccessory, deviceData);
|
|
519
|
+
this.debugLog(`${deviceData.nickname} uuid: ${deviceData.applianceId}`);
|
|
535
520
|
}
|
|
536
521
|
else {
|
|
537
522
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
538
523
|
}
|
|
539
524
|
}
|
|
540
|
-
else if (!
|
|
541
|
-
this.infoLog(`Adding new accessory: ${
|
|
542
|
-
const accessory = new this.api.platformAccessory(
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
accessory.
|
|
546
|
-
accessory.context =
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
// the accessory does not yet exist, so we need to create it
|
|
550
|
-
// create the accessory handler for the newly create accessory
|
|
551
|
-
// this is imported from `platformAccessory.ts`
|
|
552
|
-
new SmartHQAirConditioner(this, accessory, device);
|
|
553
|
-
this.debugLog(`${device.nickname} uuid: ${device.applianceId}`);
|
|
554
|
-
// link the accessory to your platform
|
|
525
|
+
else if (!deviceData.hide_device && !existingAccessory) {
|
|
526
|
+
this.infoLog(`[${protocol}] Adding new accessory: ${deviceData.nickname}`);
|
|
527
|
+
const accessory = new this.api.platformAccessory(deviceData.nickname, uuid);
|
|
528
|
+
accessory.context.device = deviceData;
|
|
529
|
+
accessory.context = { device: deviceData, userId };
|
|
530
|
+
accessory.displayName = await this.validateAndCleanDisplayName(deviceData.nickname, 'nickname', deviceData.nickname);
|
|
531
|
+
accessory.context.device.firmware = deviceData.firmware ?? await this.getVersion();
|
|
532
|
+
new SmartHQAirConditioner(this, accessory, deviceData);
|
|
533
|
+
this.debugLog(`${deviceData.nickname} uuid: ${deviceData.applianceId}`);
|
|
555
534
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
556
535
|
this.accessories.push(accessory);
|
|
557
536
|
}
|
|
558
537
|
else {
|
|
559
|
-
this.debugErrorLog(`Unable to Register new device: ${JSON.stringify(
|
|
538
|
+
this.debugErrorLog(`Unable to Register new device: ${JSON.stringify(deviceData.nickname)}`);
|
|
560
539
|
}
|
|
561
540
|
}
|
|
562
541
|
async createSmartHQHood(userId, device, details, features) {
|
|
563
|
-
|
|
542
|
+
// Merge device data
|
|
543
|
+
const deviceData = { brand: 'GE', ...details, ...features, ...device };
|
|
544
|
+
// Determine protocol (Matter or HAP)
|
|
545
|
+
deviceData.useMatter = this.shouldUseMatter(deviceData);
|
|
546
|
+
const uuid = this.api.hap.uuid.generate(deviceData.applianceId);
|
|
564
547
|
const existingAccessory = this.accessories.find(accessory => accessory.UUID === uuid);
|
|
548
|
+
const protocol = deviceData.useMatter ? 'Matter' : 'HAP';
|
|
565
549
|
if (existingAccessory) {
|
|
566
|
-
if (!
|
|
567
|
-
existingAccessory.context.device =
|
|
568
|
-
existingAccessory.context = { device:
|
|
569
|
-
existingAccessory.displayName = await this.validateAndCleanDisplayName(
|
|
570
|
-
existingAccessory.context.device.firmware =
|
|
550
|
+
if (!deviceData.hide_device) {
|
|
551
|
+
existingAccessory.context.device = deviceData;
|
|
552
|
+
existingAccessory.context = { device: deviceData, userId };
|
|
553
|
+
existingAccessory.displayName = await this.validateAndCleanDisplayName(deviceData.nickname, 'nickname', deviceData.nickname);
|
|
554
|
+
existingAccessory.context.device.firmware = deviceData.firmware ?? await this.getVersion();
|
|
571
555
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
572
|
-
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName}`);
|
|
573
|
-
new SmartHQHood(this, existingAccessory,
|
|
574
|
-
this.debugLog(`${
|
|
556
|
+
this.infoLog(`[${protocol}] Restoring existing accessory from cache: ${existingAccessory.displayName}`);
|
|
557
|
+
new SmartHQHood(this, existingAccessory, deviceData);
|
|
558
|
+
this.debugLog(`${deviceData.nickname} uuid: ${deviceData.applianceId}`);
|
|
575
559
|
}
|
|
576
560
|
else {
|
|
577
561
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
578
562
|
}
|
|
579
563
|
}
|
|
580
|
-
else if (!
|
|
581
|
-
this.infoLog(`Adding new accessory: ${
|
|
582
|
-
const accessory = new this.api.platformAccessory(
|
|
583
|
-
accessory.context.device =
|
|
584
|
-
accessory.context = { device:
|
|
585
|
-
accessory.displayName = await this.validateAndCleanDisplayName(
|
|
586
|
-
accessory.context.device.firmware =
|
|
587
|
-
new SmartHQHood(this, accessory,
|
|
588
|
-
this.debugLog(`${
|
|
564
|
+
else if (!deviceData.hide_device && !existingAccessory) {
|
|
565
|
+
this.infoLog(`[${protocol}] Adding new accessory: ${deviceData.nickname}`);
|
|
566
|
+
const accessory = new this.api.platformAccessory(deviceData.nickname, uuid);
|
|
567
|
+
accessory.context.device = deviceData;
|
|
568
|
+
accessory.context = { device: deviceData, userId };
|
|
569
|
+
accessory.displayName = await this.validateAndCleanDisplayName(deviceData.nickname, 'nickname', deviceData.nickname);
|
|
570
|
+
accessory.context.device.firmware = deviceData.firmware ?? await this.getVersion();
|
|
571
|
+
new SmartHQHood(this, accessory, deviceData);
|
|
572
|
+
this.debugLog(`${deviceData.nickname} uuid: ${deviceData.applianceId}`);
|
|
589
573
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
590
574
|
this.accessories.push(accessory);
|
|
591
575
|
}
|
|
592
576
|
else {
|
|
593
|
-
this.debugErrorLog(`Unable to Register new device: ${JSON.stringify(
|
|
577
|
+
this.debugErrorLog(`Unable to Register new device: ${JSON.stringify(deviceData.nickname)}`);
|
|
594
578
|
}
|
|
595
579
|
}
|
|
596
580
|
async createSmartHQClothesWasher(userId, device, details, features) {
|
|
597
|
-
|
|
581
|
+
// Merge device data
|
|
582
|
+
const deviceData = { brand: 'GE', ...details, ...features, ...device };
|
|
583
|
+
// Determine protocol (Matter or HAP)
|
|
584
|
+
deviceData.useMatter = this.shouldUseMatter(deviceData);
|
|
585
|
+
const uuid = this.api.hap.uuid.generate(deviceData.applianceId);
|
|
598
586
|
const existingAccessory = this.accessories.find(accessory => accessory.UUID === uuid);
|
|
587
|
+
const protocol = deviceData.useMatter ? 'Matter' : 'HAP';
|
|
599
588
|
if (existingAccessory) {
|
|
600
|
-
if (!
|
|
601
|
-
existingAccessory.context.device =
|
|
602
|
-
existingAccessory.context = { device:
|
|
603
|
-
existingAccessory.displayName = await this.validateAndCleanDisplayName(
|
|
604
|
-
existingAccessory.context.device.firmware =
|
|
589
|
+
if (!deviceData.hide_device) {
|
|
590
|
+
existingAccessory.context.device = deviceData;
|
|
591
|
+
existingAccessory.context = { device: deviceData, userId };
|
|
592
|
+
existingAccessory.displayName = await this.validateAndCleanDisplayName(deviceData.nickname, 'nickname', deviceData.nickname);
|
|
593
|
+
existingAccessory.context.device.firmware = deviceData.firmware ?? await this.getVersion();
|
|
605
594
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
606
|
-
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName}`);
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
this.debugLog(`${device.nickname} uuid: ${device.applianceId}`);
|
|
595
|
+
this.infoLog(`[${protocol}] Restoring existing accessory from cache: ${existingAccessory.displayName}`);
|
|
596
|
+
new SmartHQClothesWasher(this, existingAccessory, deviceData);
|
|
597
|
+
this.debugLog(`${deviceData.nickname} uuid: ${deviceData.applianceId}`);
|
|
610
598
|
}
|
|
611
599
|
else {
|
|
612
600
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
613
601
|
}
|
|
614
602
|
}
|
|
615
|
-
else if (!
|
|
616
|
-
this.infoLog(`Adding new accessory: ${
|
|
617
|
-
const accessory = new this.api.platformAccessory(
|
|
618
|
-
accessory.context.device =
|
|
619
|
-
accessory.context = { device:
|
|
620
|
-
accessory.displayName = await this.validateAndCleanDisplayName(
|
|
621
|
-
accessory.context.device.firmware =
|
|
622
|
-
new SmartHQClothesWasher(this, accessory,
|
|
623
|
-
this.debugLog(`${
|
|
603
|
+
else if (!deviceData.hide_device && !existingAccessory) {
|
|
604
|
+
this.infoLog(`[${protocol}] Adding new accessory: ${deviceData.nickname}`);
|
|
605
|
+
const accessory = new this.api.platformAccessory(deviceData.nickname, uuid);
|
|
606
|
+
accessory.context.device = deviceData;
|
|
607
|
+
accessory.context = { device: deviceData, userId };
|
|
608
|
+
accessory.displayName = await this.validateAndCleanDisplayName(deviceData.nickname, 'nickname', deviceData.nickname);
|
|
609
|
+
accessory.context.device.firmware = deviceData.firmware ?? await this.getVersion();
|
|
610
|
+
new SmartHQClothesWasher(this, accessory, deviceData);
|
|
611
|
+
this.debugLog(`${deviceData.nickname} uuid: ${deviceData.applianceId}`);
|
|
624
612
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
625
613
|
this.accessories.push(accessory);
|
|
626
614
|
}
|
|
627
615
|
else {
|
|
628
|
-
this.debugErrorLog(`Unable to Register new device: ${JSON.stringify(
|
|
616
|
+
this.debugErrorLog(`Unable to Register new device: ${JSON.stringify(deviceData.nickname)}`);
|
|
629
617
|
}
|
|
630
618
|
}
|
|
631
619
|
async createSmartHQClothesDryer(userId, device, details, features) {
|
|
632
|
-
|
|
620
|
+
// Merge device data
|
|
621
|
+
const deviceData = { brand: 'GE', ...details, ...features, ...device };
|
|
622
|
+
// Determine protocol (Matter or HAP)
|
|
623
|
+
deviceData.useMatter = this.shouldUseMatter(deviceData);
|
|
624
|
+
const uuid = this.api.hap.uuid.generate(deviceData.applianceId);
|
|
633
625
|
const existingAccessory = this.accessories.find(accessory => accessory.UUID === uuid);
|
|
626
|
+
const protocol = deviceData.useMatter ? 'Matter' : 'HAP';
|
|
634
627
|
if (existingAccessory) {
|
|
635
|
-
if (!
|
|
636
|
-
existingAccessory.context.device =
|
|
637
|
-
existingAccessory.context = { device:
|
|
638
|
-
existingAccessory.displayName = await this.validateAndCleanDisplayName(
|
|
639
|
-
existingAccessory.context.device.firmware =
|
|
628
|
+
if (!deviceData.hide_device) {
|
|
629
|
+
existingAccessory.context.device = deviceData;
|
|
630
|
+
existingAccessory.context = { device: deviceData, userId };
|
|
631
|
+
existingAccessory.displayName = await this.validateAndCleanDisplayName(deviceData.nickname, 'nickname', deviceData.nickname);
|
|
632
|
+
existingAccessory.context.device.firmware = deviceData.firmware ?? await this.getVersion();
|
|
640
633
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
641
|
-
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName}`);
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
this.debugLog(`${device.nickname} uuid: ${device.applianceId}`);
|
|
634
|
+
this.infoLog(`[${protocol}] Restoring existing accessory from cache: ${existingAccessory.displayName}`);
|
|
635
|
+
new SmartHQClothesDryer(this, existingAccessory, deviceData);
|
|
636
|
+
this.debugLog(`${deviceData.nickname} uuid: ${deviceData.applianceId}`);
|
|
645
637
|
}
|
|
646
638
|
else {
|
|
647
639
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
648
640
|
}
|
|
649
641
|
}
|
|
650
|
-
else if (!
|
|
651
|
-
this.infoLog(`Adding new accessory: ${
|
|
652
|
-
const accessory = new this.api.platformAccessory(
|
|
653
|
-
accessory.context.device =
|
|
654
|
-
accessory.context = { device:
|
|
655
|
-
accessory.displayName = await this.validateAndCleanDisplayName(
|
|
656
|
-
accessory.context.device.firmware =
|
|
657
|
-
new SmartHQClothesDryer(this, accessory,
|
|
658
|
-
this.debugLog(`${
|
|
642
|
+
else if (!deviceData.hide_device && !existingAccessory) {
|
|
643
|
+
this.infoLog(`[${protocol}] Adding new accessory: ${deviceData.nickname}`);
|
|
644
|
+
const accessory = new this.api.platformAccessory(deviceData.nickname, uuid);
|
|
645
|
+
accessory.context.device = deviceData;
|
|
646
|
+
accessory.context = { device: deviceData, userId };
|
|
647
|
+
accessory.displayName = await this.validateAndCleanDisplayName(deviceData.nickname, 'nickname', deviceData.nickname);
|
|
648
|
+
accessory.context.device.firmware = deviceData.firmware ?? await this.getVersion();
|
|
649
|
+
new SmartHQClothesDryer(this, accessory, deviceData);
|
|
650
|
+
this.debugLog(`${deviceData.nickname} uuid: ${deviceData.applianceId}`);
|
|
659
651
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
660
652
|
this.accessories.push(accessory);
|
|
661
653
|
}
|
|
662
654
|
else {
|
|
663
|
-
this.debugErrorLog(`Unable to Register new device: ${JSON.stringify(
|
|
655
|
+
this.debugErrorLog(`Unable to Register new device: ${JSON.stringify(deviceData.nickname)}`);
|
|
664
656
|
}
|
|
665
657
|
}
|
|
666
658
|
async createSmartHQWaterFilter(userId, device, details, features) {
|
|
@@ -732,37 +724,42 @@ export class SmartHQPlatform {
|
|
|
732
724
|
}
|
|
733
725
|
}
|
|
734
726
|
async createSmartHQWaterHeater(userId, device, details, features) {
|
|
735
|
-
|
|
727
|
+
// Merge device data
|
|
728
|
+
const deviceData = { brand: 'GE', ...details, ...features, ...device };
|
|
729
|
+
// Determine protocol (Matter or HAP)
|
|
730
|
+
deviceData.useMatter = this.shouldUseMatter(deviceData);
|
|
731
|
+
const uuid = this.api.hap.uuid.generate(deviceData.applianceId);
|
|
736
732
|
const existingAccessory = this.accessories.find(accessory => accessory.UUID === uuid);
|
|
733
|
+
const protocol = deviceData.useMatter ? 'Matter' : 'HAP';
|
|
737
734
|
if (existingAccessory) {
|
|
738
|
-
if (!
|
|
739
|
-
existingAccessory.context.device =
|
|
740
|
-
existingAccessory.context = { device:
|
|
741
|
-
existingAccessory.displayName = await this.validateAndCleanDisplayName(
|
|
742
|
-
existingAccessory.context.device.firmware =
|
|
735
|
+
if (!deviceData.hide_device) {
|
|
736
|
+
existingAccessory.context.device = deviceData;
|
|
737
|
+
existingAccessory.context = { device: deviceData, userId };
|
|
738
|
+
existingAccessory.displayName = await this.validateAndCleanDisplayName(deviceData.nickname, 'nickname', deviceData.nickname);
|
|
739
|
+
existingAccessory.context.device.firmware = deviceData.firmware ?? await this.getVersion();
|
|
743
740
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
744
|
-
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName}`);
|
|
745
|
-
new SmartHQWaterHeater(this, existingAccessory,
|
|
746
|
-
this.debugLog(`${
|
|
741
|
+
this.infoLog(`[${protocol}] Restoring existing accessory from cache: ${existingAccessory.displayName}`);
|
|
742
|
+
new SmartHQWaterHeater(this, existingAccessory, deviceData);
|
|
743
|
+
this.debugLog(`${deviceData.nickname} uuid: ${deviceData.applianceId}`);
|
|
747
744
|
}
|
|
748
745
|
else {
|
|
749
746
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
750
747
|
}
|
|
751
748
|
}
|
|
752
|
-
else if (!
|
|
753
|
-
this.infoLog(`Adding new accessory: ${
|
|
754
|
-
const accessory = new this.api.platformAccessory(
|
|
755
|
-
accessory.context.device =
|
|
756
|
-
accessory.context = { device:
|
|
757
|
-
accessory.displayName = await this.validateAndCleanDisplayName(
|
|
758
|
-
accessory.context.device.firmware =
|
|
759
|
-
new SmartHQWaterHeater(this, accessory,
|
|
760
|
-
this.debugLog(`${
|
|
749
|
+
else if (!deviceData.hide_device && !existingAccessory) {
|
|
750
|
+
this.infoLog(`[${protocol}] Adding new accessory: ${deviceData.nickname}`);
|
|
751
|
+
const accessory = new this.api.platformAccessory(deviceData.nickname, uuid);
|
|
752
|
+
accessory.context.device = deviceData;
|
|
753
|
+
accessory.context = { device: deviceData, userId };
|
|
754
|
+
accessory.displayName = await this.validateAndCleanDisplayName(deviceData.nickname, 'nickname', deviceData.nickname);
|
|
755
|
+
accessory.context.device.firmware = deviceData.firmware ?? await this.getVersion();
|
|
756
|
+
new SmartHQWaterHeater(this, accessory, deviceData);
|
|
757
|
+
this.debugLog(`${deviceData.nickname} uuid: ${deviceData.applianceId}`);
|
|
761
758
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
762
759
|
this.accessories.push(accessory);
|
|
763
760
|
}
|
|
764
761
|
else {
|
|
765
|
-
this.debugErrorLog(`Unable to Register new device: ${JSON.stringify(
|
|
762
|
+
this.debugErrorLog(`Unable to Register new device: ${JSON.stringify(deviceData.nickname)}`);
|
|
766
763
|
}
|
|
767
764
|
}
|
|
768
765
|
async createSmartHQAdvantium(userId, device, details, features) {
|
|
@@ -800,37 +797,42 @@ export class SmartHQPlatform {
|
|
|
800
797
|
}
|
|
801
798
|
}
|
|
802
799
|
async createSmartHQMicrowave(userId, device, details, features) {
|
|
803
|
-
|
|
800
|
+
// Merge device data
|
|
801
|
+
const deviceData = { brand: 'GE', ...details, ...features, ...device };
|
|
802
|
+
// Determine protocol (Matter or HAP)
|
|
803
|
+
deviceData.useMatter = this.shouldUseMatter(deviceData);
|
|
804
|
+
const uuid = this.api.hap.uuid.generate(deviceData.applianceId);
|
|
804
805
|
const existingAccessory = this.accessories.find(accessory => accessory.UUID === uuid);
|
|
806
|
+
const protocol = deviceData.useMatter ? 'Matter' : 'HAP';
|
|
805
807
|
if (existingAccessory) {
|
|
806
|
-
if (!
|
|
807
|
-
existingAccessory.context.device =
|
|
808
|
-
existingAccessory.context = { device:
|
|
809
|
-
existingAccessory.displayName = await this.validateAndCleanDisplayName(
|
|
810
|
-
existingAccessory.context.device.firmware =
|
|
808
|
+
if (!deviceData.hide_device) {
|
|
809
|
+
existingAccessory.context.device = deviceData;
|
|
810
|
+
existingAccessory.context = { device: deviceData, userId };
|
|
811
|
+
existingAccessory.displayName = await this.validateAndCleanDisplayName(deviceData.nickname, 'nickname', deviceData.nickname);
|
|
812
|
+
existingAccessory.context.device.firmware = deviceData.firmware ?? await this.getVersion();
|
|
811
813
|
this.api.updatePlatformAccessories([existingAccessory]);
|
|
812
|
-
this.infoLog(`Restoring existing accessory from cache: ${existingAccessory.displayName}`);
|
|
813
|
-
new SmartHQMicrowave(this, existingAccessory,
|
|
814
|
-
this.debugLog(`${
|
|
814
|
+
this.infoLog(`[${protocol}] Restoring existing accessory from cache: ${existingAccessory.displayName}`);
|
|
815
|
+
new SmartHQMicrowave(this, existingAccessory, deviceData);
|
|
816
|
+
this.debugLog(`${deviceData.nickname} uuid: ${deviceData.applianceId}`);
|
|
815
817
|
}
|
|
816
818
|
else {
|
|
817
819
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
818
820
|
}
|
|
819
821
|
}
|
|
820
|
-
else if (!
|
|
821
|
-
this.infoLog(`Adding new accessory: ${
|
|
822
|
-
const accessory = new this.api.platformAccessory(
|
|
823
|
-
accessory.context.device =
|
|
824
|
-
accessory.context = { device:
|
|
825
|
-
accessory.displayName = await this.validateAndCleanDisplayName(
|
|
826
|
-
accessory.context.device.firmware =
|
|
827
|
-
new SmartHQMicrowave(this, accessory,
|
|
828
|
-
this.debugLog(`${
|
|
822
|
+
else if (!deviceData.hide_device && !existingAccessory) {
|
|
823
|
+
this.infoLog(`[${protocol}] Adding new accessory: ${deviceData.nickname}`);
|
|
824
|
+
const accessory = new this.api.platformAccessory(deviceData.nickname, uuid);
|
|
825
|
+
accessory.context.device = deviceData;
|
|
826
|
+
accessory.context = { device: deviceData, userId };
|
|
827
|
+
accessory.displayName = await this.validateAndCleanDisplayName(deviceData.nickname, 'nickname', deviceData.nickname);
|
|
828
|
+
accessory.context.device.firmware = deviceData.firmware ?? await this.getVersion();
|
|
829
|
+
new SmartHQMicrowave(this, accessory, deviceData);
|
|
830
|
+
this.debugLog(`${deviceData.nickname} uuid: ${deviceData.applianceId}`);
|
|
829
831
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
830
832
|
this.accessories.push(accessory);
|
|
831
833
|
}
|
|
832
834
|
else {
|
|
833
|
-
this.debugErrorLog(`Unable to Register new device: ${JSON.stringify(
|
|
835
|
+
this.debugErrorLog(`Unable to Register new device: ${JSON.stringify(deviceData.nickname)}`);
|
|
834
836
|
}
|
|
835
837
|
}
|
|
836
838
|
async createSmartHQCoffeeMaker(userId, device, details, features) {
|