homebridge-xbox-tv 2.12.0 → 2.12.2

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Xbox TV",
3
3
  "name": "homebridge-xbox-tv",
4
- "version": "2.12.0",
4
+ "version": "2.12.2",
5
5
  "description": "Homebridge plugin to control Xbox game consoles.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
package/src/xboxdevice.js CHANGED
@@ -497,9 +497,9 @@ class XboxDevice extends EventEmitter {
497
497
  const logInfo = this.disableLogInfo ? false : this.emit('message', `Input: ${inputName}, Reference: ${inputReference}, Product Id: ${inputOneStoreProductId}`);
498
498
  return inputIdentifier;
499
499
  })
500
- .onSet(async (inputIdentifier) => {
500
+ .onSet(async (activeIdentifier) => {
501
501
  try {
502
- const index = this.inputsConfigured.findIndex(input => input.identifier === inputIdentifier) ?? this.inputIdentifier;
502
+ const index = this.inputsConfigured.findIndex(input => input.identifier === activeIdentifier);
503
503
  const inputOneStoreProductId = this.inputsConfigured[index].oneStoreProductId;
504
504
  const inputReference = this.inputsConfigured[index].reference;
505
505
  const inputName = this.inputsConfigured[index].name;
@@ -509,8 +509,9 @@ class XboxDevice extends EventEmitter {
509
509
  let payload;
510
510
  switch (this.power) {
511
511
  case false:
512
- await new Promise(resolve => setTimeout(resolve, 3000));
513
- this.televisionService.setCharacteristic(Characteristic.ActiveIdentifier, inputIdentifier);
512
+ await new Promise(resolve => setTimeout(resolve, 4000));
513
+ const inputIdentifier = index !== -1 ? this.inputsConfigured[index].identifier : -1;
514
+ const tryAgain = this.power && inputIdentifier !== -1 ? this.televisionService.setCharacteristic(Characteristic.ActiveIdentifier, inputIdentifier) : false;
514
515
  break;
515
516
  case true:
516
517
  switch (inputOneStoreProductId) {
@@ -840,7 +841,7 @@ class XboxDevice extends EventEmitter {
840
841
  return inputName;
841
842
  })
842
843
  .onSet(async (value) => {
843
- if (value === this.savedInputsNames[inputReference]) {
844
+ if (value === inputName) {
844
845
  return;
845
846
  }
846
847
 
@@ -859,7 +860,7 @@ class XboxDevice extends EventEmitter {
859
860
  return targetVisibility;
860
861
  })
861
862
  .onSet(async (state) => {
862
- if (state === this.savedInputsTargetVisibility[inputReference]) {
863
+ if (state === targetVisibility) {
863
864
  return;
864
865
  }
865
866