homebridge-xbox-tv 2.7.5-beta.0 → 2.7.5
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/config.schema.json +1 -1
- package/index.js +8 -8
- package/package.json +1 -1
- package/src/localApi/xboxlocalapi.js +2 -5
- package/src/webApi/xboxwebapi.js +11 -11
package/config.schema.json
CHANGED
|
@@ -757,7 +757,7 @@
|
|
|
757
757
|
{
|
|
758
758
|
"key": "devices[].sensorInputs",
|
|
759
759
|
"type": "tabarray",
|
|
760
|
-
"title": "{{ value.name || 'new
|
|
760
|
+
"title": "{{ value.name || 'new sensor' }}",
|
|
761
761
|
"items": [
|
|
762
762
|
"devices[].sensorInputs[].name",
|
|
763
763
|
"devices[].sensorInputs[].reference",
|
package/index.js
CHANGED
|
@@ -87,7 +87,7 @@ class XBOXDEVICE {
|
|
|
87
87
|
this.disableLogInfo = config.disableLogInfo || false;
|
|
88
88
|
this.disableLogDeviceInfo = config.disableLogDeviceInfo || false;
|
|
89
89
|
this.infoButtonCommand = config.infoButtonCommand || 'nexus';
|
|
90
|
-
this.volumeControl = config.volumeControl
|
|
90
|
+
this.volumeControl = config.volumeControl >= 0 ? config.volumeControl : -1;
|
|
91
91
|
this.mqttEnabled = config.enableMqtt || false;
|
|
92
92
|
this.mqttDebug = config.mqttDebug || false;
|
|
93
93
|
this.mqttHost = config.mqttHost;
|
|
@@ -408,7 +408,7 @@ class XBOXDEVICE {
|
|
|
408
408
|
})
|
|
409
409
|
.onSet(async (state) => {
|
|
410
410
|
try {
|
|
411
|
-
const setPower =
|
|
411
|
+
const setPower = state ? await this.xboxLocalApi.powerOn() : await this.xboxLocalApi.powerOff();
|
|
412
412
|
const logInfo = this.disableLogInfo ? false : this.log(`Device: ${this.host} ${accessoryName}, set Power successful: ${state ? 'ON' : 'OFF'}`);
|
|
413
413
|
} catch (error) {
|
|
414
414
|
this.log.error(`Device: ${this.host} ${accessoryName}, set Power, error: ${error}`);
|
|
@@ -541,7 +541,7 @@ class XBOXDEVICE {
|
|
|
541
541
|
};
|
|
542
542
|
|
|
543
543
|
const channelName = 'systemInput';
|
|
544
|
-
const setPowerModeSelection = this.power
|
|
544
|
+
const setPowerModeSelection = this.power && this.webApiEnabled ? await this.xboxWebApi.sendButtonPress(command) : false;
|
|
545
545
|
const logInfo = this.disableLogInfo || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, set Power Mode Selection command successful: ${command}`);
|
|
546
546
|
} catch (error) {
|
|
547
547
|
this.log.error(`Device: ${this.host} ${accessoryName}, set Power Mode Selection command error: ${error}`);
|
|
@@ -756,8 +756,8 @@ class XBOXDEVICE {
|
|
|
756
756
|
const nameIdentifier = inputTitleId ? inputTitleId : inputReference ? inputReference : inputOneStoreProductId ? inputOneStoreProductId : false;
|
|
757
757
|
savedInputsNames[nameIdentifier] = name;
|
|
758
758
|
const newCustomName = JSON.stringify(savedInputsNames, null, 2);
|
|
759
|
-
|
|
760
|
-
const logInfo = this.
|
|
759
|
+
fs.writeFileSync(this.inputsNamesFile, newCustomName);
|
|
760
|
+
const logInfo = this.enableDebugMode || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, saved new Input name: ${name}, one store product id: ${inputOneStoreProductId}`);
|
|
761
761
|
} catch (error) {
|
|
762
762
|
this.log.error(`Device: ${this.host} ${accessoryName}, new Input name save error: ${error}`);
|
|
763
763
|
}
|
|
@@ -770,8 +770,8 @@ class XBOXDEVICE {
|
|
|
770
770
|
const targetVisibilityIdentifier = inputTitleId ? inputTitleId : inputReference ? inputReference : inputOneStoreProductId ? inputOneStoreProductId : false;
|
|
771
771
|
savedInputsTargetVisibility[targetVisibilityIdentifier] = state;
|
|
772
772
|
const newTargetVisibility = JSON.stringify(savedInputsTargetVisibility, null, 2);
|
|
773
|
-
|
|
774
|
-
const logInfo = this.
|
|
773
|
+
fs.writeFileSync(this.inputsTargetVisibilityFile, newTargetVisibility);
|
|
774
|
+
const logInfo = this.enableDebugMode || this.firstRun ? false : this.log(`Device: ${this.host} ${accessoryName}, saved new Input: ${inputName} target visibility state: ${state ? 'HIDEN' : 'SHOWN'}`);
|
|
775
775
|
inputService.setCharacteristic(Characteristic.CurrentVisibilityState, state);
|
|
776
776
|
} catch (error) {
|
|
777
777
|
this.log.error(`Device: ${this.host} ${accessoryName}, new target visibility state save error: ${error}`);
|
|
@@ -908,7 +908,7 @@ class XBOXDEVICE {
|
|
|
908
908
|
}
|
|
909
909
|
break;
|
|
910
910
|
}
|
|
911
|
-
const logInfo = this.
|
|
911
|
+
const logInfo = this.enableDebugMode || this.firstRun || buttonMode === -1 ? false : this.log(`Device: ${this.host} ${accessoryName}, set button successful, name: ${buttonName}, command: ${buttonCommand}`);
|
|
912
912
|
}
|
|
913
913
|
await new Promise(resolve => setTimeout(resolve, 300));
|
|
914
914
|
const setChar = this.power && state ? buttonService.updateCharacteristic(Characteristic.On, false) : false;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "Xbox TV",
|
|
3
3
|
"name": "homebridge-xbox-tv",
|
|
4
|
-
"version": "2.7.5
|
|
4
|
+
"version": "2.7.5",
|
|
5
5
|
"description": "Homebridge plugin (https://github.com/homebridge/homebridge) to control Xbox game consoles.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
|
@@ -289,8 +289,7 @@ class XBOXLOCALAPI extends EventEmitter {
|
|
|
289
289
|
powerOn() {
|
|
290
290
|
return new Promise(async (resolve, reject) => {
|
|
291
291
|
if (this.isConnected) {
|
|
292
|
-
|
|
293
|
-
resolve(true);
|
|
292
|
+
reject('Console already On.');
|
|
294
293
|
return;
|
|
295
294
|
};
|
|
296
295
|
|
|
@@ -326,9 +325,7 @@ class XBOXLOCALAPI extends EventEmitter {
|
|
|
326
325
|
powerOff() {
|
|
327
326
|
return new Promise(async (resolve, reject) => {
|
|
328
327
|
if (!this.isConnected) {
|
|
329
|
-
reject(
|
|
330
|
-
status: 'Console already Off.'
|
|
331
|
-
});
|
|
328
|
+
reject('Console already Off.');
|
|
332
329
|
return;
|
|
333
330
|
};
|
|
334
331
|
|
package/src/webApi/xboxwebapi.js
CHANGED
|
@@ -362,7 +362,7 @@ class XBOXWEBAPI extends EventEmitter {
|
|
|
362
362
|
powerOn() {
|
|
363
363
|
return new Promise(async (resolve, reject) => {
|
|
364
364
|
try {
|
|
365
|
-
await this.
|
|
365
|
+
await this.send('Power', 'WakeUp')
|
|
366
366
|
resolve(true);
|
|
367
367
|
} catch (error) {
|
|
368
368
|
reject(`power on error: ${error}`);
|
|
@@ -373,7 +373,7 @@ class XBOXWEBAPI extends EventEmitter {
|
|
|
373
373
|
powerOff() {
|
|
374
374
|
return new Promise(async (resolve, reject) => {
|
|
375
375
|
try {
|
|
376
|
-
await this.
|
|
376
|
+
await this.send('Power', 'TurnOff')
|
|
377
377
|
resolve(true);
|
|
378
378
|
} catch (error) {
|
|
379
379
|
reject(`power off error: ${error}`);
|
|
@@ -384,7 +384,7 @@ class XBOXWEBAPI extends EventEmitter {
|
|
|
384
384
|
reboot() {
|
|
385
385
|
return new Promise(async (resolve, reject) => {
|
|
386
386
|
try {
|
|
387
|
-
await this.
|
|
387
|
+
await this.send('Power', 'Reboot')
|
|
388
388
|
resolve(true);
|
|
389
389
|
} catch (error) {
|
|
390
390
|
reject(`reboot error: ${error}`);
|
|
@@ -395,7 +395,7 @@ class XBOXWEBAPI extends EventEmitter {
|
|
|
395
395
|
mute() {
|
|
396
396
|
return new Promise(async (resolve, reject) => {
|
|
397
397
|
try {
|
|
398
|
-
await this.
|
|
398
|
+
await this.send('Audio', 'Mute')
|
|
399
399
|
resolve(true);
|
|
400
400
|
} catch (error) {
|
|
401
401
|
reject(`mute error: ${error}`);
|
|
@@ -406,7 +406,7 @@ class XBOXWEBAPI extends EventEmitter {
|
|
|
406
406
|
unmute() {
|
|
407
407
|
return new Promise(async (resolve, reject) => {
|
|
408
408
|
try {
|
|
409
|
-
await this.
|
|
409
|
+
await this.send('Audio', 'Unmute')
|
|
410
410
|
resolve(true);
|
|
411
411
|
} catch (error) {
|
|
412
412
|
reject(`unmute error: ${error}`);
|
|
@@ -417,7 +417,7 @@ class XBOXWEBAPI extends EventEmitter {
|
|
|
417
417
|
launchApp(oneStoreProductId) {
|
|
418
418
|
return new Promise(async (resolve, reject) => {
|
|
419
419
|
try {
|
|
420
|
-
await this.
|
|
420
|
+
await this.send('Shell', 'ActivateApplicationWithOneStoreProductId', [{
|
|
421
421
|
'oneStoreProductId': oneStoreProductId
|
|
422
422
|
}])
|
|
423
423
|
resolve(true);
|
|
@@ -430,7 +430,7 @@ class XBOXWEBAPI extends EventEmitter {
|
|
|
430
430
|
launchDashboard() {
|
|
431
431
|
return new Promise(async (resolve, reject) => {
|
|
432
432
|
try {
|
|
433
|
-
await this.
|
|
433
|
+
await this.send('Shell', 'GoHome')
|
|
434
434
|
resolve(true);
|
|
435
435
|
} catch (error) {
|
|
436
436
|
reject(`launch dashboard error: ${error}`);
|
|
@@ -441,7 +441,7 @@ class XBOXWEBAPI extends EventEmitter {
|
|
|
441
441
|
openGuideTab() {
|
|
442
442
|
return new Promise(async (resolve, reject) => {
|
|
443
443
|
try {
|
|
444
|
-
await this.
|
|
444
|
+
await this.send('Shell', 'ShowGuideTab', [{
|
|
445
445
|
'tabName': 'Guide'
|
|
446
446
|
}])
|
|
447
447
|
resolve(true);
|
|
@@ -454,7 +454,7 @@ class XBOXWEBAPI extends EventEmitter {
|
|
|
454
454
|
launchOneGuide() {
|
|
455
455
|
return new Promise(async (resolve, reject) => {
|
|
456
456
|
try {
|
|
457
|
-
await this.
|
|
457
|
+
await this.send('TV', 'ShowGuide')
|
|
458
458
|
resolve(true);
|
|
459
459
|
} catch (error) {
|
|
460
460
|
reject(`launch one guide error: ${error}`);
|
|
@@ -465,7 +465,7 @@ class XBOXWEBAPI extends EventEmitter {
|
|
|
465
465
|
sendButtonPress(button) {
|
|
466
466
|
return new Promise(async (resolve, reject) => {
|
|
467
467
|
try {
|
|
468
|
-
await this.
|
|
468
|
+
await this.send('Shell', 'InjectKey', [{
|
|
469
469
|
'keyType': button
|
|
470
470
|
}])
|
|
471
471
|
resolve(true);
|
|
@@ -475,7 +475,7 @@ class XBOXWEBAPI extends EventEmitter {
|
|
|
475
475
|
});
|
|
476
476
|
}
|
|
477
477
|
|
|
478
|
-
|
|
478
|
+
send(commandType, command, params) {
|
|
479
479
|
return new Promise(async (resolve, reject) => {
|
|
480
480
|
try {
|
|
481
481
|
const sessionid = Uuid4();
|