homebridge-xbox-tv 3.5.7 → 3.5.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Xbox TV",
3
3
  "name": "homebridge-xbox-tv",
4
- "version": "3.5.7",
4
+ "version": "3.5.8",
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.8.4"
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 || `lgwebos_${Math.random().toString(16).slice(3)}`,
263
- prefix: `${this.mqtt.prefix}/${this.name}`,
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
- await new Promise(resolve => setTimeout(resolve, 4000));
453
- const tryAgain = this.power ? this.televisionService.setCharacteristic(Characteristic.ActiveIdentifier, activeIdentifier) : false;
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) {