homebridge-xbox-tv 2.12.1 → 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.1",
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,15 +491,16 @@ 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
  })
500
- .onSet(async (inputIdentifier) => {
501
+ .onSet(async (activeIdentifier) => {
501
502
  try {
502
- const index = this.inputsConfigured.findIndex(input => input.identifier === inputIdentifier) ?? this.inputIdentifier;
503
+ const index = this.inputsConfigured.findIndex(input => input.identifier === activeIdentifier);
503
504
  const inputOneStoreProductId = this.inputsConfigured[index].oneStoreProductId;
504
505
  const inputReference = this.inputsConfigured[index].reference;
505
506
  const inputName = this.inputsConfigured[index].name;
@@ -510,7 +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 tryAgain = this.power ? this.televisionService.setCharacteristic(Characteristic.ActiveIdentifier, inputIdentifier) : false;
514
+ const tryAgain = this.power ? this.televisionService.setCharacteristic(Characteristic.ActiveIdentifier, activeIdentifier) : false;
514
515
  break;
515
516
  case true:
516
517
  switch (inputOneStoreProductId) {