homebridge-xbox-tv 4.4.1 → 4.4.2

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
@@ -18,6 +18,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
18
18
  - For plugin < v4.1.0 use Homebridge UI <= v5.5.0
19
19
  - For plugin >= v4.1.0 use Homebridge UI >= v5.13.0
20
20
 
21
+ ## [4.4.2] - (14.11.2026)
22
+
23
+ ### Changes
24
+
25
+ - fixed: the console was shown as not responding in the Home app when it did not answer the ping, for example in the energy saving mode, the change of `4.4.0` is reverted, the state of the console is set by the connection with it again
26
+ - changed: removed the word console from the log messages
27
+
21
28
  ## [4.4.1] - (12.11.2026)
22
29
 
23
30
  ### Changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Xbox TV",
3
3
  "name": "homebridge-xbox-tv",
4
- "version": "4.4.1",
4
+ "version": "4.4.2",
5
5
  "description": "Homebridge plugin to control Xbox game consoles.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -26,8 +26,6 @@ class XboxLocalApi extends EventEmitter {
26
26
  this.mqttEnabled = mqttEnabled || false;
27
27
 
28
28
  this.connected = false;
29
- this.reachable = true;
30
- this.lastPingOk = Date.now();
31
29
  this.pingOnline = false;
32
30
  this.pinging = false;
33
31
  this.power = false;
@@ -55,13 +53,13 @@ class XboxLocalApi extends EventEmitter {
55
53
  // the presence of the console in the network is checked all the time, also when the plugin is connected
56
54
  const online = await this.checkReachability();
57
55
  if (this.connected || this.connecting) return;
58
- if (this.logDebug) this.emit('debug', `Plugin send heartbeat to console`);
56
+ if (this.logDebug) this.emit('debug', `Plugin send heartbeat`);
59
57
 
60
58
  if (!online) {
61
59
  return;
62
60
  }
63
61
 
64
- if (this.logDebug) this.emit('debug', `Plugin received heartbeat from console`);
62
+ if (this.logDebug) this.emit('debug', `Plugin received heartbeat`);
65
63
 
66
64
  this.connecting = true;
67
65
  try {
@@ -83,31 +81,18 @@ class XboxLocalApi extends EventEmitter {
83
81
  });
84
82
  };
85
83
 
86
- // The console that does not answer the ping for 20 seconds is shown as not responding in the Home app, the state of the console is not changed
84
+ // The presence of the console in the network, the state of the console is set by the connection with it
87
85
  async checkReachability() {
88
86
  if (this.pinging) return false;
89
87
 
90
88
  this.pinging = true;
91
89
  try {
92
90
  const state = await this.functions.ping(this.host);
93
- const now = Date.now();
94
91
  this.pingOnline = state.online;
95
92
 
96
- if (state.online) {
97
- this.lastPingOk = now;
98
- if (!this.onlineEmitted) {
99
- this.onlineEmitted = true;
100
- this.emit('online');
101
- }
102
- if (!this.reachable) {
103
- this.reachable = true;
104
- this.emit('success', `reachable again`);
105
- this.emit('reachable', true);
106
- }
107
- } else if (this.reachable && now - this.lastPingOk >= 20000) {
108
- this.reachable = false;
109
- this.emit('warn', `not reachable`);
110
- this.emit('reachable', false);
93
+ if (state.online && !this.onlineEmitted) {
94
+ this.onlineEmitted = true;
95
+ this.emit('online');
111
96
  }
112
97
 
113
98
  return state.online;
@@ -447,12 +432,12 @@ class XboxLocalApi extends EventEmitter {
447
432
  if (!this.acknowledgeInterval) {
448
433
  this.acknowledgeInterval = setInterval(async () => {
449
434
  const elapsed = (Date.now() - this.heartBeatStartTime) / 1000;
450
- if (this.logDebug) this.emit('debug', `Console last seen: ${elapsed.toFixed(1)}s ago`);
435
+ if (this.logDebug) this.emit('debug', `Last seen: ${elapsed.toFixed(1)}s ago`);
451
436
 
452
437
  if (elapsed >= 14) {
453
438
  clearInterval(this.acknowledgeInterval);
454
439
  this.acknowledgeInterval = null;
455
- if (this.logDebug) this.emit('debug', `Console inactivity timeout — disconnecting`);
440
+ if (this.logDebug) this.emit('debug', `Inactivity timeout, disconnecting`);
456
441
  // Close socket first so on('close') triggers updateState().
457
442
  // Calling updateState() directly would null this.socket before
458
443
  // close(), causing the old socket to leak in the OS.
@@ -467,7 +452,7 @@ class XboxLocalApi extends EventEmitter {
467
452
  if (Math.round(elapsed) % 5 === 0 && Math.round(elapsed) > 0) {
468
453
  try {
469
454
  const pingResult = await this.functions.ping(this.host);
470
- if (this.logDebug) this.emit('debug', `Ping ${pingResult.online ? 'OK' : 'failed'} — console ${pingResult.online ? 'reachable' : 'unreachable'}`);
455
+ if (this.logDebug) this.emit('debug', `Ping ${pingResult.online ? 'OK' : 'failed'}`);
471
456
  } catch (error) {
472
457
  if (this.logError) this.emit('error', `Ping error: ${error}`);
473
458
  }
@@ -106,18 +106,18 @@ class XboxWebApi extends EventEmitter {
106
106
  async consolesList() {
107
107
  try {
108
108
  const { data } = await this.axiosInstance.get('/lists/devices?queryCurrentDevice=false&includeStorageDevices=true');
109
- if (this.logDebug) this.emit('debug', `Consoles list data: ${JSON.stringify(data, null, 2)}`);
109
+ if (this.logDebug) this.emit('debug', `List data: ${JSON.stringify(data, null, 2)}`);
110
110
 
111
111
  const status = data.status?.errorCode === 'OK';
112
112
  const error = data.status?.errorMessage;
113
113
  if (!status) {
114
- if (this.logDebug) this.emit('debug', `Console list data error: ${error}`);
114
+ if (this.logDebug) this.emit('debug', `List data error: ${error}`);
115
115
  return false;
116
116
  }
117
117
 
118
118
  const console = data.result.find(c => c.id === this.liveId);
119
119
  if (!console) {
120
- if (this.logWarn) this.emit('warn', `Console with Live ID ${this.liveId} not found on server`);
120
+ if (this.logWarn) this.emit('warn', `Live ID ${this.liveId} not found on server`);
121
121
  return false;
122
122
  }
123
123
 
@@ -143,7 +143,7 @@ class XboxWebApi extends EventEmitter {
143
143
  }))
144
144
  };
145
145
 
146
- if (!obj.remoteManagementEnabled && this.logWarn) this.emit('warn', `Console with Live ID ${this.liveId} remote management not enabled`);
146
+ if (!obj.remoteManagementEnabled && this.logWarn) this.emit('warn', `Live ID ${this.liveId} remote management not enabled`);
147
147
  this.rmEnabled = obj.remoteManagementEnabled;
148
148
 
149
149
  if (this.restFulEnabled) this.emit('restFul', 'consoleslist', data);
@@ -151,7 +151,7 @@ class XboxWebApi extends EventEmitter {
151
151
 
152
152
  return true;
153
153
  } catch (error) {
154
- throw new Error(`Consoles list error: ${error.message}`, { cause: error });
154
+ throw new Error(`List error: ${error.message}`, { cause: error });
155
155
  }
156
156
  }
157
157
 
@@ -159,7 +159,7 @@ class XboxWebApi extends EventEmitter {
159
159
  try {
160
160
  const url = `/consoles/${this.liveId}`;
161
161
  const { data } = await this.axiosInstance.get(url);
162
- if (this.logDebug) this.emit('debug', `Console status data: ${JSON.stringify(data, null, 2)}`);
162
+ if (this.logDebug) this.emit('debug', `Status data: ${JSON.stringify(data, null, 2)}`);
163
163
 
164
164
  const status = {
165
165
  id: data.id,
@@ -180,7 +180,7 @@ class XboxWebApi extends EventEmitter {
180
180
  };
181
181
 
182
182
  if (!status.status) {
183
- if (this.logDebug) this.emit('debug', `Console status error: ${status.error}`);
183
+ if (this.logDebug) this.emit('debug', `Status error: ${status.error}`);
184
184
  return;
185
185
  }
186
186
 
@@ -191,7 +191,7 @@ class XboxWebApi extends EventEmitter {
191
191
 
192
192
  return true;
193
193
  } catch (error) {
194
- throw new Error(`Console status error: ${error.message}`, { cause: error });
194
+ throw new Error(`Status error: ${error.message}`, { cause: error });
195
195
  }
196
196
  }
197
197
 
package/src/xboxdevice.js CHANGED
@@ -2,7 +2,6 @@ import EventEmitter from 'events';
2
2
  import XboxWebApi from './webApi/xboxwebapi.js';
3
3
  import XboxLocalApi from './localApi/xboxlocalapi.js';
4
4
  import Functions from './functions.js';
5
- import { applyReachability } from './reachability.js';
6
5
  import HaDiscovery from './hadiscovery.js';
7
6
  import AppIcons from './appicons.js';
8
7
  import { DefaultInputs, WebApi } from './constants.js';
@@ -19,8 +18,6 @@ class XboxDevice extends EventEmitter {
19
18
  Categories = api.hap.Categories;
20
19
  Encode = api.hap.encode;
21
20
  AccessoryUUID = api.hap.uuid;
22
- this.hap = api.hap;
23
- this.reachable = true;
24
21
 
25
22
  //device configuration
26
23
  this.device = device;
@@ -970,7 +967,7 @@ class XboxDevice extends EventEmitter {
970
967
  }
971
968
 
972
969
  if (!this.power) {
973
- if (this.logWarn) this.emit('warn', `console is off`);
970
+ if (this.logWarn) this.emit('warn', `power is off`);
974
971
  return;
975
972
  }
976
973
 
@@ -1015,8 +1012,6 @@ class XboxDevice extends EventEmitter {
1015
1012
  }
1016
1013
  }
1017
1014
 
1018
- applyReachability(accessory, this.hap, () => this.reachable);
1019
-
1020
1015
  return accessory;
1021
1016
  } catch (error) {
1022
1017
  throw new Error(error)
@@ -1170,7 +1165,6 @@ class XboxDevice extends EventEmitter {
1170
1165
 
1171
1166
  // BŁ4 FIX: pass restFulEnabled/mqttEnabled booleans, not channelsFile string
1172
1167
  this.xboxLocalApi = new XboxLocalApi(this.device, this.authTokenFile, this.devInfoFile, restFulEnabled, mqttEnabled)
1173
- .on('reachable', (reachable) => { this.reachable = reachable; })
1174
1168
  .on('online', async () => {
1175
1169
  try {
1176
1170
  await this.onConsoleOnline?.();
@@ -1,15 +0,0 @@
1
- // While the device cannot be reached every read of the accessory fails with a communication error, so the Home app shows the accessory
2
- // as not responding and decides itself what to do with it. The plugin does not pretend any state of the device.
3
- export const applyReachability = (accessory, hap, isReachable) => {
4
- for (const service of accessory.services) {
5
- for (const characteristic of service.characteristics) {
6
- const handler = characteristic.getHandler;
7
- if (typeof handler !== 'function') continue;
8
-
9
- characteristic.getHandler = async (...args) => {
10
- if (!isReachable()) throw new hap.HapStatusError(hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE);
11
- return handler.apply(characteristic, args);
12
- };
13
- }
14
- }
15
- };