homebridge-xbox-tv 2.10.0 → 2.10.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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/xboxdevice.js +5 -27
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Xbox TV",
3
3
  "name": "homebridge-xbox-tv",
4
- "version": "2.10.0",
4
+ "version": "2.10.2",
5
5
  "description": "Homebridge plugin to control Xbox game consoles.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -37,7 +37,7 @@
37
37
  "uuid": "^9.0.1",
38
38
  "ping": "^0.4.4",
39
39
  "express": "^4.18.2",
40
- "axios": "^1.6.2"
40
+ "axios": "^1.6.3"
41
41
  },
42
42
  "keywords": [
43
43
  "homebridge",
package/src/xboxdevice.js CHANGED
@@ -437,32 +437,8 @@ class XboxDevice extends EventEmitter {
437
437
  //Prepare television service
438
438
  const debug1 = !this.enableDebugMode ? false : this.emit('debug', `Prepare television service`);
439
439
  this.televisionService = new Service.Television(`${accessoryName} Television`, 'Television');
440
- this.televisionService.getCharacteristic(Characteristic.ConfiguredName)
441
- .onGet(async () => {
442
- const logInfo = this.disableLogInfo ? false : this.emit('message', `Accessory Nane: ${accessoryName}.`);
443
- return accessoryName;
444
- })
445
- .onSet(async (value) => {
446
- try {
447
- this.name = value;
448
- const logInfo = this.disableLogInfo ? false : this.emit('message', `set Accessory Name: ${value}`);
449
- } catch (error) {
450
- this.emit('error', `set Accessory Name error: ${error}`);
451
- };
452
- });
453
- this.televisionService.getCharacteristic(Characteristic.SleepDiscoveryMode)
454
- .onGet(async () => {
455
- const state = 1;
456
- const logInfo = this.disableLogInfo ? false : this.emit('message', `Discovery Mode: ${state ? 'Always Discoverable' : 'Not Discoverable'}`);
457
- return state;
458
- })
459
- .onSet(async (state) => {
460
- try {
461
- const logInfo = this.disableLogInfo ? false : this.emit('message', `set Discovery Mode: ${state ? 'Always Discoverable' : 'Not Discoverable'}`);
462
- } catch (error) {
463
- this.emit('error', `set Discovery Mode error: ${error}`);
464
- };
465
- });
440
+ this.televisionService.setCharacteristic(Characteristic.ConfiguredName, accessoryName)
441
+ .setCharacteristic(Characteristic.SleepDiscoveryMode, 1);
466
442
 
467
443
  this.televisionService.getCharacteristic(Characteristic.Active)
468
444
  .onGet(async () => {
@@ -787,6 +763,7 @@ class XboxDevice extends EventEmitter {
787
763
  const inputsCount = inputs.length;
788
764
  const possibleInputsCount = 90 - this.allServices.length;
789
765
  const maxInputsCount = inputsCount >= possibleInputsCount ? possibleInputsCount : inputsCount;
766
+ inputs.sort((a, b) => a.name.localeCompare(b.name));
790
767
  for (let i = 0; i < maxInputsCount; i++) {
791
768
  //get input
792
769
  const input = inputs[i];
@@ -798,7 +775,8 @@ class XboxDevice extends EventEmitter {
798
775
  const inputReference = input.reference || input.titleId || input.oneStoreProductId;
799
776
 
800
777
  //get input name
801
- const inputName = this.savedInputsNames[inputReference] ?? input.name;
778
+ const name = input.name ?? 'App/Input';
779
+ const inputName = this.savedInputsNames[inputReference] ?? name;
802
780
 
803
781
  //get input type
804
782
  const inputType = 0;