homebridge-xbox-tv 3.3.8 → 3.3.9-beta.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 +1 -1
- package/index.js +3 -0
- package/package.json +1 -1
- package/src/xboxdevice.js +23 -28
package/CHANGELOG.md
CHANGED
package/index.js
CHANGED
|
@@ -113,6 +113,9 @@ class XboxPlatform {
|
|
|
113
113
|
try {
|
|
114
114
|
const startDone = await xboxDevice.start();
|
|
115
115
|
const stopImpulseGenerator = startDone ? await impulseGenerator.stop() : false;
|
|
116
|
+
|
|
117
|
+
//start impulse generator
|
|
118
|
+
const startImpulseGenerator = startDone ? await xboxDevice.xboxLocalApi.impulseGenerator.start([{ name: 'heartBeat', sampling: 10000 }]) : false;
|
|
116
119
|
} catch (error) {
|
|
117
120
|
const emitLog = disableLogError ? false : log.error(`Device: ${host} ${deviceName}, ${error}, trying again.`);
|
|
118
121
|
};
|
package/package.json
CHANGED
package/src/xboxdevice.js
CHANGED
|
@@ -41,18 +41,17 @@ class XboxDevice extends EventEmitter {
|
|
|
41
41
|
this.sensorInputs = device.sensorInputs || [];
|
|
42
42
|
this.webApiClientId = device.webApiClientId;
|
|
43
43
|
this.webApiClientSecret = device.webApiClientSecret;
|
|
44
|
-
this.enableDebugMode = device.enableDebugMode || false;
|
|
45
|
-
this.disableLogInfo = device.disableLogInfo || false;
|
|
46
44
|
this.infoButtonCommand = device.infoButtonCommand || 'nexus';
|
|
47
45
|
this.volumeControl = device.volumeControl || false;
|
|
48
46
|
this.volumeControlNamePrefix = device.volumeControlNamePrefix || false;
|
|
49
47
|
this.volumeControlName = device.volumeControlName || 'Volume';
|
|
48
|
+
this.enableDebugMode = device.enableDebugMode || false;
|
|
49
|
+
this.disableLogInfo = device.disableLogInfo || false;
|
|
50
50
|
this.authTokenFile = authTokenFile;
|
|
51
51
|
this.devInfoFile = devInfoFile;
|
|
52
52
|
this.inputsFile = inputsFile;
|
|
53
53
|
this.inputsNamesFile = inputsNamesFile;
|
|
54
54
|
this.inputsTargetVisibilityFile = inputsTargetVisibilityFile;
|
|
55
|
-
this.startPrepareAccessory = true;
|
|
56
55
|
|
|
57
56
|
//external integrations
|
|
58
57
|
this.restFul = device.restFul ?? {};
|
|
@@ -60,10 +59,6 @@ class XboxDevice extends EventEmitter {
|
|
|
60
59
|
this.mqtt = device.mqtt ?? {};
|
|
61
60
|
this.mqttConnected = false;
|
|
62
61
|
|
|
63
|
-
//accessory services
|
|
64
|
-
this.allServices = [];
|
|
65
|
-
this.sensorsInputsServices = [];
|
|
66
|
-
this.buttonsServices = [];
|
|
67
62
|
|
|
68
63
|
//add configured inputs to the default inputs and chack duplicated inputs
|
|
69
64
|
const tempInputs = [...DefaultInputs, ...this.inputs];
|
|
@@ -76,17 +71,7 @@ class XboxDevice extends EventEmitter {
|
|
|
76
71
|
}
|
|
77
72
|
this.inputs = inputsArr;
|
|
78
73
|
|
|
79
|
-
|
|
80
|
-
this.inputIdentifier = 1;
|
|
81
|
-
|
|
82
|
-
//state variable
|
|
83
|
-
this.power = false;
|
|
84
|
-
this.volume = 0;
|
|
85
|
-
this.mute = true;
|
|
86
|
-
this.mediaState = 0;
|
|
87
|
-
this.reference = '';
|
|
88
|
-
|
|
89
|
-
//sensors variable
|
|
74
|
+
//sensors
|
|
90
75
|
this.sensorsInputsConfigured = [];
|
|
91
76
|
for (const sensor of this.sensorInputs) {
|
|
92
77
|
const sensorInputName = sensor.name ?? false;
|
|
@@ -102,10 +87,8 @@ class XboxDevice extends EventEmitter {
|
|
|
102
87
|
};
|
|
103
88
|
}
|
|
104
89
|
this.sensorsInputsConfiguredCount = this.sensorsInputsConfigured.length || 0;
|
|
105
|
-
this.sensorScreenSaverState = false;
|
|
106
|
-
this.sensorInputState = false;
|
|
107
90
|
|
|
108
|
-
//buttons
|
|
91
|
+
//buttons
|
|
109
92
|
this.buttonsConfigured = [];
|
|
110
93
|
for (const button of this.buttons) {
|
|
111
94
|
const buttonName = button.name ?? false;
|
|
@@ -121,6 +104,21 @@ class XboxDevice extends EventEmitter {
|
|
|
121
104
|
};
|
|
122
105
|
}
|
|
123
106
|
this.buttonsConfiguredCount = this.buttonsConfigured.length || 0;
|
|
107
|
+
|
|
108
|
+
//variable
|
|
109
|
+
this.allServices = [];
|
|
110
|
+
this.sensorsInputsServices = [];
|
|
111
|
+
this.buttonsServices = [];
|
|
112
|
+
this.inputsConfigured = [];
|
|
113
|
+
this.inputIdentifier = 1;
|
|
114
|
+
this.startPrepareAccessory = true;
|
|
115
|
+
this.power = false;
|
|
116
|
+
this.volume = 0;
|
|
117
|
+
this.mute = true;
|
|
118
|
+
this.mediaState = 0;
|
|
119
|
+
this.reference = '';
|
|
120
|
+
this.sensorScreenSaverState = false;
|
|
121
|
+
this.sensorInputState = false;
|
|
124
122
|
}
|
|
125
123
|
|
|
126
124
|
async saveData(path, data) {
|
|
@@ -360,14 +358,14 @@ class XboxDevice extends EventEmitter {
|
|
|
360
358
|
//Prepare accessory
|
|
361
359
|
async prepareAccessory() {
|
|
362
360
|
try {
|
|
363
|
-
//
|
|
361
|
+
//Accessory
|
|
364
362
|
const debug = !this.enableDebugMode ? false : this.emit('debug', `Prepare accessory`);
|
|
365
363
|
const accessoryName = this.name;
|
|
366
364
|
const accessoryUUID = AccessoryUUID.generate(this.xboxLiveId);
|
|
367
365
|
const accessoryCategory = Categories.TV_SET_TOP_BOX;
|
|
368
366
|
const accessory = new Accessory(accessoryName, accessoryUUID, accessoryCategory);
|
|
369
367
|
|
|
370
|
-
//
|
|
368
|
+
//Prepare information service
|
|
371
369
|
this.informationService = accessory.getService(Service.AccessoryInformation)
|
|
372
370
|
.setCharacteristic(Characteristic.Manufacturer, this.savedInfo.manufacturer ?? 'Microsoft')
|
|
373
371
|
.setCharacteristic(Characteristic.Model, this.savedInfo.modelName ?? 'Xbox')
|
|
@@ -653,7 +651,7 @@ class XboxDevice extends EventEmitter {
|
|
|
653
651
|
}
|
|
654
652
|
|
|
655
653
|
try {
|
|
656
|
-
switch (
|
|
654
|
+
switch (state) {
|
|
657
655
|
case 0: //Mute
|
|
658
656
|
await this.xboxWebApi.send('Audio', 'Mute');
|
|
659
657
|
break;
|
|
@@ -885,7 +883,7 @@ class XboxDevice extends EventEmitter {
|
|
|
885
883
|
sensorInputService.setCharacteristic(Characteristic.ConfiguredName, serviceName);
|
|
886
884
|
sensorInputService.getCharacteristic(characteristicType)
|
|
887
885
|
.onGet(async () => {
|
|
888
|
-
const state = sensorInput.state
|
|
886
|
+
const state = sensorInput.state;
|
|
889
887
|
return state;
|
|
890
888
|
});
|
|
891
889
|
this.sensorsInputsServices.push(sensorInputService);
|
|
@@ -1209,9 +1207,6 @@ class XboxDevice extends EventEmitter {
|
|
|
1209
1207
|
const accessory = await this.prepareAccessory();
|
|
1210
1208
|
this.emit('publishAccessory', accessory);
|
|
1211
1209
|
this.startPrepareAccessory = false;
|
|
1212
|
-
|
|
1213
|
-
//start impulse generator
|
|
1214
|
-
await this.xboxLocalApi.impulseGenerator.start([{ name: 'heartBeat', sampling: 10000 }]);
|
|
1215
1210
|
}
|
|
1216
1211
|
|
|
1217
1212
|
return true;
|