homebridge-xbox-tv 2.11.7 → 2.12.0

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/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
  ### NOTE!!!
8
8
  ## After update to 2.x.x the plugin settings (xboxLiveId) need to be updated.
9
9
 
10
+ ## [2.12.0] - (02.01.2024)
11
+ ## Changes
12
+ - added possibility to disable prefix name for buttons and sensors
13
+ - config schema updated
14
+ - cleanup
15
+
10
16
  ## [2.11.0] - (29.12.2023)
11
17
  ## Changes
12
18
  - added possibility to select display inputs order, possible by `None`, `Alphabetically Name`, `Alphabetically Reference`
package/README.md CHANGED
@@ -89,12 +89,14 @@ Homebridge plugin for Microsoft game Consoles. Tested with Xbox One X/S and Xbox
89
89
  | `buttons.command` | Here select button control mode or command, `Reboot` and `Switch App/Game`- only possible if `webApiControl` enabled. |
90
90
  | `buttons.oneStoreProductId` | Here set *Input oneStoreProductId*, only possible if `webApiControl` enabled. |
91
91
  | `buttons.displayType` | Here select display type in HomeKit app, possible `None/Disabled`, `Outlet`, `Switch`. |
92
+ | `buttons.namePrefix` | Here enable/disable the accessory name as a prefix for button name.|
92
93
  | `sensorPower`| If enabled, then the Power will be exposed as a `Motion Sensor` (active on Power ON). |
93
94
  | `sensorInput`| If enabled, then the Input will be exposed as a `Motion Sensor` (active on every Input change). |
94
95
  | `sensorScreenSaver`| If enabled, then the Screen Saver will be exposed as a `Motion Sensor` (active on change to Screen Saver). |
95
96
  | `sensorInputs.name` | Here set own *Name* which You want expose to the *Homebridge/HomeKit* for this sensor. |
96
- | `sensorInputs.reference` | Here set *Reference* like `Xbox.Dashboard_8wekyb3d8bbwe!Xbox.Dashboard.Application` to be exposed as sensor (active on switch to this Input). |
97
+ | `sensorInputs.reference` | Here set *Reference* like `Xbox.Dashboard_8wekyb3d8bbwe!Xbox.Dashboard.Application` to be exposed as sensor (active on switch to this Input). |
97
98
  | `sensorInputs.displayType` | Here select sensor type to be exposed in HomeKit app, possible `None/Disabled`, `Motion Sensor`, `Occupancy Sensor`, `Contact Sensor`. |
99
+ | `sensorInputs.namePrefix` | Here enable/disable the accessory name as a prefix for sensor name.|
98
100
  | `webApiControl` | This enable console control over Web Api. Additional functions are available in `Advanced Settings` section. |
99
101
  | `webApiPowerOnOff` | This enable `Power` control over Web Api. |
100
102
  | `webApiToken` | Required if `webApiControl` enabled, use Authorization Manager to get it. |
@@ -441,6 +441,13 @@
441
441
  ],
442
442
  "description": "Here select display type in HomeKit app.",
443
443
  "required": true
444
+ },
445
+ "namePrefix": {
446
+ "title": "Prefix",
447
+ "type": "boolean",
448
+ "default": false,
449
+ "description": "Here enable/disable the accessory name as a prefix for button name.",
450
+ "required": true
444
451
  }
445
452
  }
446
453
  }
@@ -518,6 +525,13 @@
518
525
  ],
519
526
  "description": "Here select sensor type to be exposed in HomeKit app.",
520
527
  "required": true
528
+ },
529
+ "namePrefix": {
530
+ "title": "Prefix",
531
+ "type": "boolean",
532
+ "default": false,
533
+ "description": "Here enable/disable the accessory name as a prefix for sensor name.",
534
+ "required": true
521
535
  }
522
536
  }
523
537
  }
@@ -803,7 +817,7 @@
803
817
  {
804
818
  "key": "devices",
805
819
  "type": "tabarray",
806
- "title": "{{ value.name || 'new device' }}",
820
+ "title": "{{ value.name || 'device' }}",
807
821
  "items": [
808
822
  "devices[].name",
809
823
  "devices[].host",
@@ -824,7 +838,7 @@
824
838
  {
825
839
  "key": "devices[].inputs",
826
840
  "type": "tabarray",
827
- "title": "{{ value.name || 'new input' }}",
841
+ "title": "{{ value.name || 'input' }}",
828
842
  "items": [
829
843
  "devices[].inputs[].name",
830
844
  "devices[].inputs[].reference",
@@ -847,12 +861,13 @@
847
861
  {
848
862
  "key": "devices[].buttons",
849
863
  "type": "tabarray",
850
- "title": "{{ value.name || 'new button' }}",
864
+ "title": "{{ value.name || 'button' }}",
851
865
  "items": [
852
866
  "devices[].buttons[].name",
853
867
  "devices[].buttons[].command",
854
868
  "devices[].buttons[].oneStoreProductId",
855
- "devices[].buttons[].displayType"
869
+ "devices[].buttons[].displayType",
870
+ "devices[].buttons[].namePrefix"
856
871
  ]
857
872
  }
858
873
  ]
@@ -886,11 +901,12 @@
886
901
  {
887
902
  "key": "devices[].sensorInputs",
888
903
  "type": "tabarray",
889
- "title": "{{ value.name || 'new sensor' }}",
904
+ "title": "{{ value.name || 'sensor' }}",
890
905
  "items": [
891
906
  "devices[].sensorInputs[].name",
892
907
  "devices[].sensorInputs[].reference",
893
- "devices[].sensorInputs[].displayType"
908
+ "devices[].sensorInputs[].displayType",
909
+ "devices[].sensorInputs[].namePrefix"
894
910
  ]
895
911
  }
896
912
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Xbox TV",
3
3
  "name": "homebridge-xbox-tv",
4
- "version": "2.11.7",
4
+ "version": "2.12.0",
5
5
  "description": "Homebridge plugin to control Xbox game consoles.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
package/src/xboxdevice.js CHANGED
@@ -766,10 +766,10 @@ class XboxDevice extends EventEmitter {
766
766
  const inputsCount = inputs.length;
767
767
  const possibleInputsCount = 85 - this.allServices.length;
768
768
  const maxInputsCount = inputsCount >= possibleInputsCount ? possibleInputsCount : inputsCount;
769
- let inputIdentifier = 0;
770
769
  for (let i = 0; i < maxInputsCount; i++) {
771
770
  //input
772
771
  const input = inputs[i];
772
+ input.identifier = i + 1;
773
773
 
774
774
  //get input reference
775
775
  const inputReference = input.reference || input.titleId || input.oneStoreProductId;
@@ -778,13 +778,12 @@ class XboxDevice extends EventEmitter {
778
778
  const name = input.name ?? 'App/Input';
779
779
  const savedInputsNames = this.savedInputsNames[inputReference] ?? false;
780
780
  const inputName = !savedInputsNames ? name : savedInputsNames;
781
+ input.name = inputName;
781
782
 
782
783
  //get visibility
783
784
  const currentVisibility = this.savedInputsTargetVisibility[inputReference] ?? 0;
784
-
785
- input.identifier = inputIdentifier++;
786
- input.name = inputName;
787
785
  input.visibility = currentVisibility;
786
+
788
787
  this.inputsConfigured.push(input);
789
788
  }
790
789
 
@@ -1007,13 +1006,17 @@ class XboxDevice extends EventEmitter {
1007
1006
  //get sensor display type
1008
1007
  const sensorInputDisplayType = sensorInput.displayType >= 0 ? sensorInput.displayType : -1;
1009
1008
 
1009
+ //get sensor name prefix
1010
+ const namePrefix = sensorInput.namePrefix ?? false;
1011
+
1010
1012
  if (sensorInputDisplayType >= 0) {
1011
1013
  if (sensorInputName && sensorInputReference) {
1012
1014
  const serviceType = [Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensorInputDisplayType];
1015
+ const name = namePrefix ? `${accessoryName} ${sensorInputName}` : sensorInputName;
1013
1016
  const characteristicType = [Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensorInputDisplayType];
1014
1017
  const sensorInputService = new serviceType(`${accessoryName} ${sensorInputName}`, `Sensor ${i}`);
1015
1018
  sensorInputService.addOptionalCharacteristic(Characteristic.ConfiguredName);
1016
- sensorInputService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} ${sensorInputName}`);
1019
+ sensorInputService.setCharacteristic(Characteristic.ConfiguredName, name);
1017
1020
  sensorInputService.getCharacteristic(characteristicType)
1018
1021
  .onGet(async () => {
1019
1022
  const state = this.power ? (this.reference === sensorInputReference) : false;
@@ -1071,12 +1074,16 @@ class XboxDevice extends EventEmitter {
1071
1074
  //get button display type
1072
1075
  const buttonDisplayType = button.displayType >= 0 ? button.displayType : -1;
1073
1076
 
1077
+ //get button name prefix
1078
+ const namePrefix = button.namePrefix ?? false;
1079
+
1074
1080
  if (buttonDisplayType >= 0) {
1075
1081
  if (buttonName && buttonCommand && buttonMode) {
1076
1082
  const serviceType = [Service.Outlet, Service.Switch][buttonDisplayType];
1083
+ const name = namePrefix ? `${accessoryName} ${buttonName}` : buttonName;
1077
1084
  const buttonService = new serviceType(`${accessoryName} ${buttonName}`, `Button ${i}`);
1078
1085
  buttonService.addOptionalCharacteristic(Characteristic.ConfiguredName);
1079
- buttonService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} ${buttonName}`);
1086
+ buttonService.setCharacteristic(Characteristic.ConfiguredName, name);
1080
1087
  buttonService.getCharacteristic(Characteristic.On)
1081
1088
  .onGet(async () => {
1082
1089
  const state = false;