homebridge-xbox-tv 2.7.7-beta.8 → 2.7.7

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.
@@ -556,16 +556,47 @@
556
556
  "type": "string",
557
557
  "oneOf": [
558
558
  {
559
- "title": "View",
559
+ "title": "Game Pad View",
560
560
  "enum": [
561
561
  "view"
562
562
  ]
563
563
  },
564
564
  {
565
- "title": "Nexus",
565
+ "title": "Game Pad Nexus",
566
566
  "enum": [
567
567
  "nexus"
568
568
  ]
569
+ },
570
+ {
571
+ "title": "Game Pad Menu",
572
+ "enum": [
573
+ "menu1"
574
+ ]
575
+ },
576
+ {
577
+ "title": "Game Pad A",
578
+ "enum": [
579
+ "a"
580
+ ]
581
+ }
582
+ ,
583
+ {
584
+ "title": "Game Pad B",
585
+ "enum": [
586
+ "b"
587
+ ]
588
+ },
589
+ {
590
+ "title": "Game Pad X",
591
+ "enum": [
592
+ "x"
593
+ ]
594
+ },
595
+ {
596
+ "title": "Game Pad Y",
597
+ "enum": [
598
+ "y"
599
+ ]
569
600
  }
570
601
  ],
571
602
  "description": "Here select the function of info button in RC.",
@@ -805,13 +836,13 @@
805
836
  "expanded": false,
806
837
  "items": [
807
838
  "devices[].enableMqtt",
839
+ "devices[].mqttDebug",
808
840
  "devices[].mqttHost",
809
841
  "devices[].mqttPort",
810
842
  "devices[].mqttPrefix",
811
843
  "devices[].mqttAuth",
812
844
  "devices[].mqttUser",
813
- "devices[].mqttPasswd",
814
- "devices[].mqttDebug"
845
+ "devices[].mqttPasswd"
815
846
  ]
816
847
  }
817
848
  ]
package/index.js CHANGED
@@ -113,8 +113,11 @@ class XBOXDEVICE {
113
113
  this.inputsReference = [];
114
114
  this.inputsOneStoreProductId = [];
115
115
 
116
+ this.sensorInputsServices = [];
116
117
  this.sensorInputsReference = [];
117
118
  this.sensorInputsDisplayType = [];
119
+ this.buttonsServices = [];
120
+
118
121
 
119
122
  this.power = false;
120
123
  this.volume = 0;
@@ -369,7 +372,6 @@ class XBOXDEVICE {
369
372
  //Prepare accessory
370
373
  prepareAccessory() {
371
374
  this.log.debug('prepareAccessory');
372
-
373
375
  //accessory
374
376
  const accessoryName = this.name;
375
377
  const accessoryUUID = UUID.generate(this.xboxLiveId);
@@ -377,38 +379,52 @@ class XBOXDEVICE {
377
379
  const accessory = new Accessory(accessoryName, accessoryUUID, accessoryCategory);
378
380
 
379
381
  //Pinformation service
380
- this.log.debug('prepareInformationService');
381
- const manufacturer = this.manufacturer;
382
- const modelName = this.modelName;
383
- const serialNumber = this.serialNumber;
384
- const firmwareRevision = this.firmwareRevision;
385
-
386
382
  this.informationService = accessory.getService(Service.AccessoryInformation)
387
- .setCharacteristic(Characteristic.Manufacturer, manufacturer)
388
- .setCharacteristic(Characteristic.Model, modelName)
389
- .setCharacteristic(Characteristic.SerialNumber, serialNumber)
390
- .setCharacteristic(Characteristic.FirmwareRevision, firmwareRevision);
383
+ .setCharacteristic(Characteristic.Manufacturer, this.manufacturer)
384
+ .setCharacteristic(Characteristic.Model, this.modelName)
385
+ .setCharacteristic(Characteristic.SerialNumber, this.serialNumber)
386
+ .setCharacteristic(Characteristic.FirmwareRevision, this.firmwareRevision);
391
387
 
392
388
  //Prepare television service
393
389
  this.log.debug('prepareTelevisionService');
394
390
  this.televisionService = new Service.Television(`${accessoryName} Television`, 'Television');
395
- this.televisionService.setCharacteristic(Characteristic.ConfiguredName, accessoryName);
391
+ this.televisionService.getCharacteristic(Characteristic.ConfiguredName)
392
+ .onGet(async () => {
393
+ const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} Accessory Nane: ${accessoryName}.`);
394
+ return accessoryName;
395
+ })
396
+ .onSet(async (value) => {
397
+ try {
398
+ this.name = value;
399
+ const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, set Accessory Name: ${value}`);
400
+ } catch (error) {
401
+ this.log.error(`Device: ${this.host} ${accessoryName}, set Brightness error: ${error}`);
402
+ };
403
+ });
396
404
  this.televisionService.getCharacteristic(Characteristic.SleepDiscoveryMode)
397
405
  .onGet(async () => {
398
- const state = 1; //not discoverable, alvays discoverable
406
+ const state = 1;
407
+ const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, Discovery Mode: ${state ? 'Always Discoverable' : 'Not Discoverable'}`);
399
408
  return state;
400
409
  })
410
+ .onSet(async (state) => {
411
+ try {
412
+ const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, set Discovery Mode: ${state ? 'Always Discoverable' : 'Not Discoverable'}`);
413
+ } catch (error) {
414
+ this.log.error(`Device: ${this.host} ${accessoryName}, set Discovery Mode error: ${error}`);
415
+ };
416
+ });
401
417
 
402
418
  this.televisionService.getCharacteristic(Characteristic.Active)
403
419
  .onGet(async () => {
404
420
  const state = this.power;
405
- const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host} ${accessoryName}, get Power state successful: ${state ? 'ON' : 'OFF'}`);
421
+ const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, Power: ${state ? 'ON' : 'OFF'}`);
406
422
  return state;
407
423
  })
408
424
  .onSet(async (state) => {
409
425
  try {
410
426
  const setPower = state ? await this.xboxLocalApi.powerOn() : await this.xboxLocalApi.powerOff();
411
- const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host} ${accessoryName}, set Power successful: ${state ? 'ON' : 'OFF'}`);
427
+ const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, set Power: ${state ? 'ON' : 'OFF'}`);
412
428
  } catch (error) {
413
429
  this.log.error(`Device: ${this.host} ${accessoryName}, set Power, error: ${error}`);
414
430
  };
@@ -420,7 +436,7 @@ class XBOXDEVICE {
420
436
  const inputName = this.inputsName[inputIdentifier];
421
437
  const inputReference = this.inputsReference[inputIdentifier];
422
438
  const inputOneStoreProductId = this.inputsOneStoreProductId[inputIdentifier];
423
- const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, get Input successful, input: ${inputName}, reference: ${inputReference}, product Id: ${inputOneStoreProductId}`);
439
+ const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, Input: ${inputName}, Reference: ${inputReference}, Product Id: ${inputOneStoreProductId}`);
424
440
  return inputIdentifier;
425
441
  })
426
442
  .onSet(async (inputIdentifier) => {
@@ -443,7 +459,7 @@ class XBOXDEVICE {
443
459
  await this.xboxWebApi.launchApp(inputOneStoreProductId);
444
460
  break;
445
461
  }
446
- const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, set Input successful, input: ${inputName},, reference: ${inputReference}, product Id: ${inputOneStoreProductId}`);
462
+ const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, set Input: ${inputName}, Reference: ${inputReference}, Product Id: ${inputOneStoreProductId}`);
447
463
  } catch (error) {
448
464
  this.log.error(`Device: ${this.host} ${accessoryName}, set Input error: ${JSON.stringify(error, null, 2)}`);
449
465
  };
@@ -495,9 +511,9 @@ class XBOXDEVICE {
495
511
  };
496
512
 
497
513
  await this.xboxWebApi.sendButtonPress(command);
498
- const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, Remote Key command successful: ${command}`);
514
+ const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, Remote Key: ${command}`);
499
515
  } catch (error) {
500
- this.log.error(`Device: ${this.host} ${accessoryName}, set Remote Key command error: ${JSON.stringify(error, null, 2)}`);
516
+ this.log.error(`Device: ${this.host} ${accessoryName}, set Remote Key error: ${JSON.stringify(error, null, 2)}`);
501
517
  };
502
518
  });
503
519
 
@@ -506,7 +522,7 @@ class XBOXDEVICE {
506
522
  //apple, 0 - PLAY, 1 - PAUSE, 2 - STOP, 3 - LOADING, 4 - INTERRUPTED
507
523
  //xbox, 0 - STOP, 1 - PLAY, 2 - PAUSE
508
524
  const value = [2, 0, 1, 3, 4][this.mediaState];
509
- const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, get Current Media state successful: ${['PLAY', 'PAUSE', 'STOP', 'LOADING', 'INTERRUPTED'][value]}`);
525
+ const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, Current Media: ${['PLAY', 'PAUSE', 'STOP', 'LOADING', 'INTERRUPTED'][value]}`);
510
526
  return value;
511
527
  });
512
528
 
@@ -514,16 +530,16 @@ class XBOXDEVICE {
514
530
  .onGet(async () => {
515
531
  //0 - PLAY, 1 - PAUSE, 2 - STOP
516
532
  const value = [2, 0, 1, 3, 4][this.mediaState];
517
- const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, get Target Media state successful: ${['PLAY', 'PAUSE', 'STOP', 'LOADING', 'INTERRUPTED'][value]}`);
533
+ const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, Target Media: ${['PLAY', 'PAUSE', 'STOP', 'LOADING', 'INTERRUPTED'][value]}`);
518
534
  return value;
519
535
  })
520
536
  .onSet(async (value) => {
521
537
  try {
522
538
  const newMediaState = value;
523
539
  const setMediaState = this.power ? false : false;
524
- const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, set Target Media state successful: ${['PLAY', 'PAUSE', 'STOP', 'LOADING', 'INTERRUPTED'][value]}`);
540
+ const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, set Target Media: ${['PLAY', 'PAUSE', 'STOP', 'LOADING', 'INTERRUPTED'][value]}`);
525
541
  } catch (error) {
526
- this.log.error(`Device: ${this.host} ${accessoryName} set Target Media state error: ${error}`);
542
+ this.log.error(`Device: ${this.host} ${accessoryName} set Target Media error: ${error}`);
527
543
  };
528
544
  });
529
545
 
@@ -541,9 +557,9 @@ class XBOXDEVICE {
541
557
 
542
558
  const channelName = 'systemInput';
543
559
  await this.xboxWebApi.sendButtonPress(command);
544
- const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, set Power Mode Selection command successful: ${command}`);
560
+ const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, set Power Mode Selection: ${command === 'nexus' ? 'SHOW' : 'HIDE'}`);
545
561
  } catch (error) {
546
- this.log.error(`Device: ${this.host} ${accessoryName}, set Power Mode Selection command error: ${error}`);
562
+ this.log.error(`Device: ${this.host} ${accessoryName}, set Power Mode Selection error: ${error}`);
547
563
  };
548
564
  });
549
565
 
@@ -552,10 +568,21 @@ class XBOXDEVICE {
552
568
  //Prepare speaker service
553
569
  this.log.debug('prepareSpeakerService');
554
570
  this.speakerService = new Service.TelevisionSpeaker(`${accessoryName} Speaker`, 'Speaker');
555
- this.speakerService
556
- .setCharacteristic(Characteristic.Active, Characteristic.Active.ACTIVE)
557
- .setCharacteristic(Characteristic.VolumeControlType, Characteristic.VolumeControlType.ABSOLUTE)
558
- .getCharacteristic(Characteristic.VolumeSelector)
571
+ this.speakerService.getCharacteristic(Characteristic.Active)
572
+ .onGet(async () => {
573
+ const state = this.power;
574
+ return state;
575
+ })
576
+ .onSet(async (state) => {
577
+ });
578
+
579
+ this.speakerService.getCharacteristic(Characteristic.VolumeControlType)
580
+ .onGet(async () => {
581
+ const state = 3; //none, relative, relative with current, absolute
582
+ return state;
583
+ });
584
+
585
+ this.speakerService.getCharacteristic(Characteristic.VolumeSelector)
559
586
  .onSet(async (command) => {
560
587
  try {
561
588
  switch (command) {
@@ -568,35 +595,35 @@ class XBOXDEVICE {
568
595
  };
569
596
 
570
597
  await this.xboxWebApi.sendButtonPress(command);
571
- const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, set Volume command successful: ${command}`);
598
+ const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, set Volume Selector: ${command}`);
572
599
  } catch (error) {
573
- this.log.error(`Device: ${this.host} ${accessoryName}, set Volume command error: ${error}`);
600
+ this.log.error(`Device: ${this.host} ${accessoryName}, set Volume Selector error: ${error}`);
574
601
  };
575
- });
602
+ })
576
603
 
577
604
  this.speakerService.getCharacteristic(Characteristic.Volume)
578
605
  .onGet(async () => {
579
606
  const volume = this.volume;
580
- const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, get Volume successful: ${volume}`);
607
+ const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, Volume: ${volume}`);
581
608
  return volume;
582
609
  })
583
610
  .onSet(async (volume) => {
584
611
  if (volume === 0 || volume === 100) {
585
612
  volume = this.volume;
586
613
  };
587
- const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, set Volume successful: ${volume}`);
614
+ const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, set Volume: ${volume}`);
588
615
  });
589
616
 
590
617
  this.speakerService.getCharacteristic(Characteristic.Mute)
591
618
  .onGet(async () => {
592
619
  const state = this.mute;
593
- const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host} ${accessoryName}, get Mute successful: ${state ? 'ON' : 'OFF'}`);
620
+ const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host} ${accessoryName}, Mute: ${state ? 'ON' : 'OFF'}`);
594
621
  return state;
595
622
  })
596
623
  .onSet(async (state) => {
597
624
  try {
598
625
  const toggleMute = state ? await this.xboxWebApi.mute() : await this.xboxWebApi.unmute();
599
- const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, set Mute successful: ${state ? 'ON' : 'OFF'}`);
626
+ const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, set Mute: ${state ? 'ON' : 'OFF'}`);
600
627
  } catch (error) {
601
628
  this.log.error(`Device: ${this.host} ${accessoryName}, set Mute error: ${error}`);
602
629
  };
@@ -692,10 +719,10 @@ class XBOXDEVICE {
692
719
  const debug = this.enableDebugMode ? this.log(`Device: ${this.host} ${accessoryName}, read saved Inputs: ${JSON.stringify(savedInputs, null, 2)}`) : false;
693
720
 
694
721
  const savedInputsNames = fs.readFileSync(this.inputsNamesFile).length > 2 ? JSON.parse(fs.readFileSync(this.inputsNamesFile)) : {};
695
- const debug1 = this.enableDebugMode ? this.log(`Device: ${this.host} ${accessoryName}, read saved Inputs names: ${JSON.stringify(savedInputsNames, null, 2)}`) : false;
722
+ const debug1 = this.enableDebugMode ? this.log(`Device: ${this.host} ${accessoryName}, read saved Inputs Nnames: ${JSON.stringify(savedInputsNames, null, 2)}`) : false;
696
723
 
697
724
  const savedInputsTargetVisibility = fs.readFileSync(this.inputsTargetVisibilityFile).length > 2 ? JSON.parse(fs.readFileSync(this.inputsTargetVisibilityFile)) : {};
698
- const debug2 = this.enableDebugMode ? this.log(`Device: ${this.host} ${accessoryName}, read saved Inputs Target Visibility states: ${JSON.stringify(savedInputsTargetVisibility, null, 2)}`) : false;
725
+ const debug2 = this.enableDebugMode ? this.log(`Device: ${this.host} ${accessoryName}, read saved Inputs Target Visibility: ${JSON.stringify(savedInputsTargetVisibility, null, 2)}`) : false;
699
726
 
700
727
  //check possible inputs and filter custom unnecessary inputs
701
728
  const filteredInputsArr = [];
@@ -723,7 +750,7 @@ class XBOXDEVICE {
723
750
  const inputOneStoreProductId = input.oneStoreProductId;
724
751
 
725
752
  //get input name
726
- const inputName = savedInputsNames[inputReference] ? savedInputsNames[inputReference] : savedInputsNames[inputOneStoreProductId] ? savedInputsNames[inputOneStoreProductId] : input.name;
753
+ const inputName = savedInputsNames[inputReference] || savedInputsNames[inputOneStoreProductId] || input.name;
727
754
 
728
755
  //get input type
729
756
  const inputType = 0;
@@ -732,52 +759,51 @@ class XBOXDEVICE {
732
759
  const isConfigured = 1;
733
760
 
734
761
  //get input visibility state
735
- const currentVisibility = savedInputsTargetVisibility[inputReference] ? savedInputsTargetVisibility[inputReference] : savedInputsTargetVisibility[inputOneStoreProductId] ? savedInputsTargetVisibility[inputOneStoreProductId] : 0;
736
- const targetVisibility = currentVisibility;
762
+ const currentVisibility = savedInputsTargetVisibility[inputReference] || savedInputsTargetVisibility[inputOneStoreProductId] || 0;
737
763
 
738
764
  if (inputReference && inputName) {
739
765
  const inputService = new Service.InputSource(inputName, `Input ${i}`);
740
766
  inputService
741
767
  .setCharacteristic(Characteristic.Identifier, i)
742
768
  .setCharacteristic(Characteristic.Name, inputName)
743
- .setCharacteristic(Characteristic.IsConfigured, isConfigured)
744
769
  .setCharacteristic(Characteristic.InputSourceType, inputType)
770
+ .setCharacteristic(Characteristic.IsConfigured, isConfigured)
745
771
  .setCharacteristic(Characteristic.CurrentVisibilityState, currentVisibility)
746
772
 
747
773
  inputService.getCharacteristic(Characteristic.ConfiguredName)
748
774
  .onGet(async () => {
749
775
  return inputName;
750
776
  })
751
- .onSet(async (name) => {
777
+ .onSet(async (value) => {
752
778
  try {
753
- const nameIdentifier = inputReference ? inputReference : inputOneStoreProductId ? inputOneStoreProductId : false;
754
- savedInputsNames[nameIdentifier] = name;
779
+ const nameIdentifier = inputReference || inputOneStoreProductId;
780
+ savedInputsNames[nameIdentifier] = value;
755
781
 
756
782
  const newCustomName = JSON.stringify(savedInputsNames, null, 2);
757
783
  await fsPromises.writeFile(this.inputsNamesFile, newCustomName);
758
- const logDebug = this.enableDebugMode ? this.log(`Device: ${this.host} ${accessoryName}, saved new Input name: ${name}, one store product id: ${inputOneStoreProductId}`) : false;
784
+ const logDebug = this.enableDebugMode ? this.log(`Device: ${this.host} ${accessoryName}, saved Input Name: ${value}, Reference: ${nameIdentifier}.`) : false;
759
785
  inputService.setCharacteristic(Characteristic.Name, inputName);
760
786
  } catch (error) {
761
- this.log.error(`Device: ${this.host} ${accessoryName}, new Input name save error: ${error}`);
787
+ this.log.error(`Device: ${this.host} ${accessoryName}, save Input Name error: ${error}`);
762
788
  }
763
789
  });
764
790
 
765
791
  inputService
766
792
  .getCharacteristic(Characteristic.TargetVisibilityState)
767
793
  .onGet(async () => {
768
- return targetVisibility;
794
+ return currentVisibility;
769
795
  })
770
796
  .onSet(async (state) => {
771
797
  try {
772
- const targetVisibilityIdentifier = inputReference ? inputReference : inputOneStoreProductId ? inputOneStoreProductId : false;
798
+ const targetVisibilityIdentifier = inputReference || inputOneStoreProductId;
773
799
  savedInputsTargetVisibility[targetVisibilityIdentifier] = state;
774
800
 
775
801
  const newTargetVisibility = JSON.stringify(savedInputsTargetVisibility, null, 2);
776
802
  await fsPromises.writeFile(this.inputsTargetVisibilityFile, newTargetVisibility);
777
- const logDebug = this.enableDebugMode ? this.log(`Device: ${this.host} ${accessoryName}, saved new Input: ${inputName} target visibility state: ${state ? 'HIDEN' : 'SHOWN'}`) : false;
803
+ const logDebug = this.enableDebugMode ? this.log(`Device: ${this.host} ${accessoryName}, saved Input: ${inputName} Target Visibility: ${state ? 'HIDEN' : 'SHOWN'}`) : false;
778
804
  inputService.setCharacteristic(Characteristic.CurrentVisibilityState, state);
779
805
  } catch (error) {
780
- this.log.error(`Device: ${this.host} ${accessoryName}, new target visibility state save error: ${error}`);
806
+ this.log.error(`Device: ${this.host} ${accessoryName}, save Target Visibility error: ${error}`);
781
807
  }
782
808
  });
783
809
 
@@ -788,13 +814,12 @@ class XBOXDEVICE {
788
814
  this.televisionService.addLinkedService(inputService);
789
815
  accessory.addService(inputService);
790
816
  } else {
791
- this.log(`Device: ${this.host} ${accessoryName}, Input name: ${inputName ? inputName : 'Missing'}, reference: ${inputReference ? inputReference : 'Missing'}.`);
817
+ this.log(`Device: ${this.host} ${accessoryName}, Input Name: ${inputName ? inputName : 'Missing'}, Reference: ${inputReference ? inputReference : 'Missing'}.`);
792
818
 
793
819
  };
794
820
  }
795
821
 
796
822
  //prepare sonsor service
797
- this.sensorInputsServices = [];
798
823
  const sensorInputs = this.sensorInputs;
799
824
  const sensorInputsCount = sensorInputs.length;
800
825
  const possibleSensorInputsCount = 80 - this.inputsReference.length;
@@ -833,7 +858,6 @@ class XBOXDEVICE {
833
858
  }
834
859
 
835
860
  //Prepare buttons services
836
- this.buttonsServices = [];
837
861
  const buttons = this.buttons;
838
862
  const buttonsCount = buttons.length;
839
863
  const possibleButtonsCount = 80 - (this.inputsReference.length + this.sensorInputsServices.length);
@@ -862,7 +886,7 @@ class XBOXDEVICE {
862
886
  buttonService.getCharacteristic(Characteristic.On)
863
887
  .onGet(async () => {
864
888
  const state = false;
865
- const logDebug = this.disableLogInfo ? this.log(`Device: ${this.host} ${accessoryName}, get Button state successful: ${state}`) : false;
889
+ const logDebug = this.disableLogInfo ? this.log(`Device: ${this.host} ${accessoryName}, Button state: ${state}`) : false;
866
890
  return state;
867
891
  })
868
892
  .onSet(async (state) => {
@@ -906,7 +930,7 @@ class XBOXDEVICE {
906
930
  await this.xboxWebApi.openGuideTab();
907
931
  break;
908
932
  case 'Not set': case 'Web api disabled':
909
- this.log(`Device: ${this.host} ${accessoryName}, trying to launch app/game with one store product id: ${buttonOneStoreProductId}.`);
933
+ this.log(`Device: ${this.host} ${accessoryName}, trying to launch App/Game with one store product id: ${buttonOneStoreProductId}.`);
910
934
  break;
911
935
  default:
912
936
  await this.xboxWebApi.launchApp(buttonOneStoreProductId);
@@ -914,12 +938,12 @@ class XBOXDEVICE {
914
938
  }
915
939
  break;
916
940
  }
917
- const logDebug = this.enableDebugMode ? this.log(`Device: ${this.host} ${accessoryName}, set button successful, name: ${buttonName}, command: ${buttonCommand}`) : false;
941
+ const logDebug = this.enableDebugMode ? this.log(`Device: ${this.host} ${accessoryName}, set Button Name: ${buttonName}, Command: ${buttonCommand}`) : false;
918
942
  }
919
943
  await new Promise(resolve => setTimeout(resolve, 300));
920
944
  const setChar = state ? buttonService.updateCharacteristic(Characteristic.On, false) : false;
921
945
  } catch (error) {
922
- this.log.error(`Device: ${this.host} ${accessoryName}, set button error, name: ${buttonName}, error: ${error}`);
946
+ this.log.error(`Device: ${this.host} ${accessoryName}, set Button error: ${error}`);
923
947
  };
924
948
  });
925
949
  this.buttonsServices.push(buttonService);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Xbox TV",
3
3
  "name": "homebridge-xbox-tv",
4
- "version": "2.7.7-beta.8",
4
+ "version": "2.7.7",
5
5
  "description": "Homebridge plugin (https://github.com/homebridge/homebridge) to control Xbox game consoles.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -348,9 +348,7 @@ class XBOXLOCALAPI extends EventEmitter {
348
348
  recordGameDvr() {
349
349
  return new Promise(async (resolve, reject) => {
350
350
  if (!this.isConnected || !this.isAuthorized) {
351
- reject({
352
- status: `Send record game ignored, connection state: ${this.isConnected}, authorization state: ${this.isAuthorized}`
353
- });
351
+ reject(`Send record game ignored, connection state: ${this.isConnected}, authorization state: ${this.isAuthorized}`);
354
352
  return;
355
353
  };
356
354
 
@@ -67,7 +67,7 @@ class XBOXWEBAPI extends EventEmitter {
67
67
  }
68
68
  const debug = this.debugLog ? this.emit(`message', 'authorized and web Api enabled.`) : false;
69
69
  const rmEnabled = await this.getWebApiConsoleStatus();
70
- const debug1 = !rmEnabled ? this.emit('message', `remote management not enabled, please check your console settings!!!.`) : false;
70
+ const debug1 = !rmEnabled ? this.emit('message', `remote management not enabled, please check your console settings.`) : false;
71
71
  //await this.getWebApiConsolesList();
72
72
  await this.getWebApiInstalledApps();
73
73
  //await this.getWebApiStorageDevices();