homebridge-xbox-tv 3.5.7 → 3.5.9
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/package.json +2 -2
- package/src/xboxdevice.js +12 -10
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "Xbox TV",
|
|
3
3
|
"name": "homebridge-xbox-tv",
|
|
4
|
-
"version": "3.5.
|
|
4
|
+
"version": "3.5.9",
|
|
5
5
|
"description": "Homebridge plugin to control Xbox game consoles.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"uuid": "^11.1.0",
|
|
44
44
|
"ping": "^0.4.4",
|
|
45
45
|
"express": "^5.1.0",
|
|
46
|
-
"axios": "^1.
|
|
46
|
+
"axios": "^1.9.0"
|
|
47
47
|
},
|
|
48
48
|
"keywords": [
|
|
49
49
|
"homebridge",
|
package/src/xboxdevice.js
CHANGED
|
@@ -124,7 +124,6 @@ class XboxDevice extends EventEmitter {
|
|
|
124
124
|
try {
|
|
125
125
|
data = JSON.stringify(data, null, 2);
|
|
126
126
|
await fsPromises.writeFile(path, data);
|
|
127
|
-
const debug = this.enableDebugMode ? this.emit('debug', `Saved data: ${data}`) : false;
|
|
128
127
|
return true;
|
|
129
128
|
} catch (error) {
|
|
130
129
|
throw new Error(`Save data error: ${error}`);
|
|
@@ -134,7 +133,6 @@ class XboxDevice extends EventEmitter {
|
|
|
134
133
|
async readData(path) {
|
|
135
134
|
try {
|
|
136
135
|
const data = await fsPromises.readFile(path);
|
|
137
|
-
const debug = !this.enableDebugMode ? false : this.emit('debug', `Read data: ${data}`);
|
|
138
136
|
return data;
|
|
139
137
|
} catch (error) {
|
|
140
138
|
throw new Error(`Read data error: ${error}`);
|
|
@@ -259,8 +257,8 @@ class XboxDevice extends EventEmitter {
|
|
|
259
257
|
this.mqtt1 = new Mqtt({
|
|
260
258
|
host: this.mqtt.host,
|
|
261
259
|
port: this.mqtt.port || 1883,
|
|
262
|
-
clientId: this.mqtt.clientId || `
|
|
263
|
-
prefix:
|
|
260
|
+
clientId: this.mqtt.clientId || `microsoft_${Math.random().toString(16).slice(3)}`,
|
|
261
|
+
prefix: this.mqtt.prefix || `microsoft/${this.name}`,
|
|
264
262
|
user: this.mqtt.user,
|
|
265
263
|
passwd: this.mqtt.passwd,
|
|
266
264
|
debug: this.mqtt.debug || false
|
|
@@ -449,8 +447,10 @@ class XboxDevice extends EventEmitter {
|
|
|
449
447
|
let payload;
|
|
450
448
|
switch (this.power) {
|
|
451
449
|
case false:
|
|
452
|
-
|
|
453
|
-
|
|
450
|
+
for (let attempt = 0; attempt < 10; attempt++) {
|
|
451
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
452
|
+
const setInput = this.power && this.inputIdentifier !== activeIdentifier ? this.televisionService.setCharacteristic(Characteristic.ActiveIdentifier, activeIdentifier) : false;
|
|
453
|
+
}
|
|
454
454
|
break;
|
|
455
455
|
case true:
|
|
456
456
|
switch (inputOneStoreProductId) {
|
|
@@ -774,7 +774,7 @@ class XboxDevice extends EventEmitter {
|
|
|
774
774
|
});
|
|
775
775
|
this.volumeService.getCharacteristic(Characteristic.On)
|
|
776
776
|
.onGet(async () => {
|
|
777
|
-
const state = !this.mute;
|
|
777
|
+
const state = this.power ? !this.mute : false;
|
|
778
778
|
return state;
|
|
779
779
|
})
|
|
780
780
|
.onSet(async (state) => {
|
|
@@ -798,7 +798,7 @@ class XboxDevice extends EventEmitter {
|
|
|
798
798
|
});
|
|
799
799
|
this.volumeServiceFan.getCharacteristic(Characteristic.On)
|
|
800
800
|
.onGet(async () => {
|
|
801
|
-
const state = !this.mute;
|
|
801
|
+
const state = this.power ? !this.mute : false;
|
|
802
802
|
return state;
|
|
803
803
|
})
|
|
804
804
|
.onSet(async (state) => {
|
|
@@ -1063,14 +1063,16 @@ class XboxDevice extends EventEmitter {
|
|
|
1063
1063
|
.updateCharacteristic(Characteristic.Volume, volume)
|
|
1064
1064
|
.updateCharacteristic(Characteristic.Mute, mute);
|
|
1065
1065
|
if (this.volumeService) {
|
|
1066
|
+
const muteV = this.power ? !mute : false;
|
|
1066
1067
|
this.volumeService
|
|
1067
1068
|
.updateCharacteristic(Characteristic.Brightness, volume)
|
|
1068
|
-
.updateCharacteristic(Characteristic.On,
|
|
1069
|
+
.updateCharacteristic(Characteristic.On, muteV);
|
|
1069
1070
|
};
|
|
1070
1071
|
if (this.volumeServiceFan) {
|
|
1072
|
+
const muteV = this.power ? !mute : false;
|
|
1071
1073
|
this.volumeServiceFan
|
|
1072
1074
|
.updateCharacteristic(Characteristic.RotationSpeed, volume)
|
|
1073
|
-
.updateCharacteristic(Characteristic.On,
|
|
1075
|
+
.updateCharacteristic(Characteristic.On, muteV);
|
|
1074
1076
|
};
|
|
1075
1077
|
};
|
|
1076
1078
|
|