homebridge-denon-tv 4.4.2-beta.2 → 4.4.2-beta.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.
@@ -99,7 +99,7 @@
99
99
  "title": "Inputs Display Order",
100
100
  "type": "integer",
101
101
  "minimum": 0,
102
- "maximum": 2,
102
+ "maximum": 4,
103
103
  "default": 0,
104
104
  "description": "Here select display order of the inputs list.",
105
105
  "oneOf": [
@@ -110,16 +110,28 @@
110
110
  ]
111
111
  },
112
112
  {
113
- "title": "Alphabetically Name",
113
+ "title": "A>Z by Name",
114
114
  "enum": [
115
115
  1
116
116
  ]
117
117
  },
118
118
  {
119
- "title": "Alphabetically Reference",
119
+ "title": "Z>A by Name",
120
120
  "enum": [
121
121
  2
122
122
  ]
123
+ },
124
+ {
125
+ "title": "A>Z by Reference",
126
+ "enum": [
127
+ 3
128
+ ]
129
+ },
130
+ {
131
+ "title": "Z>A by Reference",
132
+ "enum": [
133
+ 4
134
+ ]
123
135
  }
124
136
  ],
125
137
  "required": true
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Denon TV",
3
3
  "name": "homebridge-denon-tv",
4
- "version": "4.4.2-beta.2",
4
+ "version": "4.4.2-beta.4",
5
5
  "description": "Homebridge plugin to control Denon/Marantz AV Receivers.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -308,7 +308,7 @@ class DenonDevice extends EventEmitter {
308
308
  };
309
309
  })
310
310
  .on('stateChanged', (power, reference, volume, volumeControlType, mute, pictureMode) => {
311
- const inputIdentifier = this.inputsConfigured.findIndex(index => index.reference === reference) ?? -1;
311
+ const inputIdentifier = this.inputsConfigured.findIndex(input => input.reference === reference) ?? -1;
312
312
  mute = power ? mute : true;
313
313
  pictureMode = CONSTANS.PictureModesConversionToHomeKit[pictureMode];
314
314
 
@@ -796,7 +796,7 @@ class DenonDevice extends EventEmitter {
796
796
  const input = inputs[i];
797
797
 
798
798
  //get index
799
- const index = i + 1;
799
+ const inputIdentifier = i + 1;
800
800
 
801
801
  //get reference
802
802
  const inputReference = input.reference;
@@ -820,7 +820,7 @@ class DenonDevice extends EventEmitter {
820
820
  const targetVisibility = currentVisibility;
821
821
 
822
822
  if (inputReference && inputName && inputMode) {
823
- const inputService = new Service.InputSource(`${inputName} ${index}`, `${this.zoneInputSurroundName} ${index}`);
823
+ const inputService = new Service.InputSource(`${inputName} ${inputIdentifier}`, `${this.zoneInputSurroundName} ${inputIdentifier}`);
824
824
  inputService
825
825
  .setCharacteristic(Characteristic.Identifier, index)
826
826
  .setCharacteristic(Characteristic.Name, inputName)
@@ -864,7 +864,9 @@ class DenonDevice extends EventEmitter {
864
864
  }
865
865
  });
866
866
 
867
- input.identifier = index;
867
+ input.identifier = inputIdentifier;
868
+ input.name = inputName;
869
+ input.visibility = currentVisibility;
868
870
  this.inputsConfigured.push(input);
869
871
 
870
872
  this.televisionService.addLinkedService(inputService);
@@ -879,14 +881,20 @@ class DenonDevice extends EventEmitter {
879
881
  //sort inputs list
880
882
  switch (this.inputsDisplayOrder) {
881
883
  case 0:
882
- this.inputsConfigured = this.inputsConfigured
884
+ this.inputsConfigured = this.inputsConfigured;
883
885
  break;
884
886
  case 1:
885
887
  this.inputsConfigured.sort((a, b) => a.name.localeCompare(b.name));
886
888
  break;
887
889
  case 2:
890
+ this.inputsConfigured.sort((a, b) => b.name.localeCompare(a.name));
891
+ break;
892
+ case 3:
888
893
  this.inputsConfigured.sort((a, b) => a.reference.localeCompare(b.reference));
889
894
  break;
895
+ case 4:
896
+ this.inputsConfigured.sort((a, b) => b.reference.localeCompare(a.reference));
897
+ break;
890
898
  }
891
899
  const displayOrder = this.inputsConfigured.map(input => input.identifier);
892
900
  this.televisionService.setCharacteristic(Characteristic.DisplayOrder, Encode(1, displayOrder).toString('base64'));