homebridge-xbox-tv 2.12.1 → 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.1",
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;
@@ -510,7 +510,8 @@ class XboxDevice extends EventEmitter {
510
510
  switch (this.power) {
511
511
  case false:
512
512
  await new Promise(resolve => setTimeout(resolve, 4000));
513
- const tryAgain = this.power ? this.televisionService.setCharacteristic(Characteristic.ActiveIdentifier, inputIdentifier) : false;
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) {