homebridge-xbox-tv 4.3.4 → 4.4.0-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 +12 -0
- package/package.json +6 -6
- package/src/localApi/xboxlocalapi.js +36 -2
- package/src/reachability.js +15 -0
- package/src/xboxdevice.js +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -18,6 +18,18 @@ 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.0-beta.0] - (12.11.2026)
|
|
22
|
+
|
|
23
|
+
### Changes
|
|
24
|
+
|
|
25
|
+
- changed: a console that does not answer the ping for 20 seconds is shown as not responding in the Home app, the read of the accessory fails with a communication error, the plugin does not change the state of the console and the console works again when it answers the ping, the ping is now sent all the time and not only when the plugin is not connected to the console
|
|
26
|
+
|
|
27
|
+
## [4.3.5] - (04.11.2026)
|
|
28
|
+
|
|
29
|
+
### Changes
|
|
30
|
+
|
|
31
|
+
- updated: dependencies, @homebridge/plugin-ui-utils, axios, express, mqtt and uuid to the latest versions
|
|
32
|
+
|
|
21
33
|
## [4.3.4] - (29.10.2026)
|
|
22
34
|
|
|
23
35
|
### 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
|
+
"version": "4.4.0-beta.0",
|
|
5
5
|
"description": "Homebridge plugin to control Xbox game consoles.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"node": "^20 || ^22 || ^24 || ^25 || ^26"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@homebridge/plugin-ui-utils": "^2.2.
|
|
40
|
-
"mqtt": "^5.
|
|
39
|
+
"@homebridge/plugin-ui-utils": "^2.2.7",
|
|
40
|
+
"mqtt": "^5.16.1",
|
|
41
41
|
"hex-to-binary": "^1.0.1",
|
|
42
|
-
"uuid": "^14.0.
|
|
43
|
-
"express": "^5.
|
|
44
|
-
"axios": "^1.
|
|
42
|
+
"uuid": "^14.0.3",
|
|
43
|
+
"express": "^5.3.0",
|
|
44
|
+
"axios": "^1.21.0"
|
|
45
45
|
},
|
|
46
46
|
"keywords": [
|
|
47
47
|
"homebridge",
|
|
@@ -26,6 +26,10 @@ 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
|
+
this.pingOnline = true;
|
|
32
|
+
this.pinging = false;
|
|
29
33
|
this.power = false;
|
|
30
34
|
this.volume = 0;
|
|
31
35
|
this.mute = false;
|
|
@@ -45,11 +49,12 @@ class XboxLocalApi extends EventEmitter {
|
|
|
45
49
|
this.impulseGenerator = new ImpulseGenerator()
|
|
46
50
|
.on('connect', async () => {
|
|
47
51
|
try {
|
|
52
|
+
// the presence of the console in the network is checked all the time, also when the plugin is connected
|
|
53
|
+
const online = await this.checkReachability();
|
|
48
54
|
if (this.connected || this.connecting) return;
|
|
49
55
|
if (this.logDebug) this.emit('debug', `Plugin send heartbeat to console`);
|
|
50
56
|
|
|
51
|
-
|
|
52
|
-
if (!state.online) {
|
|
57
|
+
if (!online) {
|
|
53
58
|
return;
|
|
54
59
|
}
|
|
55
60
|
|
|
@@ -75,6 +80,35 @@ class XboxLocalApi extends EventEmitter {
|
|
|
75
80
|
});
|
|
76
81
|
};
|
|
77
82
|
|
|
83
|
+
// 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
|
+
async checkReachability() {
|
|
85
|
+
if (this.pinging) return this.pingOnline;
|
|
86
|
+
|
|
87
|
+
this.pinging = true;
|
|
88
|
+
try {
|
|
89
|
+
const state = await this.functions.ping(this.host);
|
|
90
|
+
const now = Date.now();
|
|
91
|
+
this.pingOnline = state.online;
|
|
92
|
+
|
|
93
|
+
if (state.online) {
|
|
94
|
+
this.lastPingOk = now;
|
|
95
|
+
if (!this.reachable) {
|
|
96
|
+
this.reachable = true;
|
|
97
|
+
this.emit('success', `Console is reachable again`);
|
|
98
|
+
this.emit('reachable', true);
|
|
99
|
+
}
|
|
100
|
+
} else if (this.reachable && now - this.lastPingOk >= 20000) {
|
|
101
|
+
this.reachable = false;
|
|
102
|
+
this.emit('warn', `Console is not reachable`);
|
|
103
|
+
this.emit('reachable', false);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return state.online;
|
|
107
|
+
} finally {
|
|
108
|
+
this.pinging = false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
78
112
|
async updateState() {
|
|
79
113
|
// reconnect and fires a spurious disconnect after 14 s of the new session.
|
|
80
114
|
if (this.acknowledgeInterval) {
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
};
|
package/src/xboxdevice.js
CHANGED
|
@@ -2,6 +2,7 @@ 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';
|
|
5
6
|
import HaDiscovery from './hadiscovery.js';
|
|
6
7
|
import AppIcons from './appicons.js';
|
|
7
8
|
import { DefaultInputs, WebApi } from './constants.js';
|
|
@@ -18,6 +19,8 @@ class XboxDevice extends EventEmitter {
|
|
|
18
19
|
Categories = api.hap.Categories;
|
|
19
20
|
Encode = api.hap.encode;
|
|
20
21
|
AccessoryUUID = api.hap.uuid;
|
|
22
|
+
this.hap = api.hap;
|
|
23
|
+
this.reachable = true;
|
|
21
24
|
|
|
22
25
|
//device configuration
|
|
23
26
|
this.device = device;
|
|
@@ -1012,6 +1015,8 @@ class XboxDevice extends EventEmitter {
|
|
|
1012
1015
|
}
|
|
1013
1016
|
}
|
|
1014
1017
|
|
|
1018
|
+
applyReachability(accessory, this.hap, () => this.reachable);
|
|
1019
|
+
|
|
1015
1020
|
return accessory;
|
|
1016
1021
|
} catch (error) {
|
|
1017
1022
|
throw new Error(error)
|
|
@@ -1154,6 +1159,7 @@ class XboxDevice extends EventEmitter {
|
|
|
1154
1159
|
|
|
1155
1160
|
// BŁ4 FIX: pass restFulEnabled/mqttEnabled booleans, not channelsFile string
|
|
1156
1161
|
this.xboxLocalApi = new XboxLocalApi(this.device, this.authTokenFile, this.devInfoFile, restFulEnabled, mqttEnabled)
|
|
1162
|
+
.on('reachable', (reachable) => { this.reachable = reachable; })
|
|
1157
1163
|
.on('deviceInfo', async (info) => {
|
|
1158
1164
|
this.emit('devInfo', `-------- ${this.name} --------`);
|
|
1159
1165
|
this.emit('devInfo', `Manufacturer: Microsoft`);
|