homebridge-xbox-tv 2.12.2 → 2.12.4

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.2",
4
+ "version": "2.12.4",
5
5
  "description": "Homebridge plugin to control Xbox game consoles.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
package/src/xboxdevice.js CHANGED
@@ -491,9 +491,10 @@ class XboxDevice extends EventEmitter {
491
491
  this.televisionService.getCharacteristic(Characteristic.ActiveIdentifier)
492
492
  .onGet(async () => {
493
493
  const inputIdentifier = this.inputIdentifier;
494
- const inputOneStoreProductId = this.inputsConfigured[inputIdentifier].oneStoreProductId;
495
- const inputReference = this.inputsConfigured[inputIdentifier].reference;
496
- const inputName = this.inputsConfigured[inputIdentifier].name;
494
+ const index = this.inputsConfigured.findIndex(input => input.identifier === inputIdentifier);
495
+ const inputOneStoreProductId = this.inputsConfigured[index].oneStoreProductId;
496
+ const inputReference = this.inputsConfigured[index].reference;
497
+ const inputName = this.inputsConfigured[index].name;
497
498
  const logInfo = this.disableLogInfo ? false : this.emit('message', `Input: ${inputName}, Reference: ${inputReference}, Product Id: ${inputOneStoreProductId}`);
498
499
  return inputIdentifier;
499
500
  })
@@ -510,8 +511,7 @@ class XboxDevice extends EventEmitter {
510
511
  switch (this.power) {
511
512
  case false:
512
513
  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
+ const tryAgain = this.power ? this.televisionService.setCharacteristic(Characteristic.ActiveIdentifier, activeIdentifier) : false;
515
515
  break;
516
516
  case true:
517
517
  switch (inputOneStoreProductId) {