homebridge-xbox-tv 3.9.2 → 3.9.3

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/index.js CHANGED
@@ -38,12 +38,12 @@ class XboxPlatform {
38
38
 
39
39
  //log config
40
40
  const logLevel = {
41
- devInfo: device.log.deviceInfo,
42
- success: device.log.success,
43
- info: device.log.info,
44
- warn: device.log.warn,
45
- error: device.log.error,
46
- debug: device.log.debug
41
+ devInfo: device.log?.deviceInfo,
42
+ success: device.log?.success,
43
+ info: device.log?.info,
44
+ warn: device.log?.warn,
45
+ error: device.log?.error,
46
+ debug: device.log?.debug
47
47
  };
48
48
  if (logLevel.debug) log.info(`Device: ${host} ${deviceName}, did finish launching.`);
49
49
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Xbox TV",
3
3
  "name": "homebridge-xbox-tv",
4
- "version": "3.9.2",
4
+ "version": "3.9.3",
5
5
  "description": "Homebridge plugin to control Xbox game consoles.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
package/src/xboxdevice.js CHANGED
@@ -24,28 +24,28 @@ class XboxDevice extends EventEmitter {
24
24
  this.host = device.host;
25
25
  this.xboxLiveId = device.xboxLiveId;
26
26
  this.displayType = device.displayType;
27
- this.webApiControl = device.webApi.enable || false;
28
- this.webApiClientId = device.webApi.clientId;
27
+ this.webApiControl = device.webApi?.enable || false;
28
+ this.webApiClientId = device.webApi?.clientId;
29
29
  this.webApiClientSecret = device.webApi.clientSecret;
30
- this.getInputsFromDevice = this.webApiControl ? device.inputs.getFromDevice : false;
31
- this.filterGames = device.inputs.filterGames || false;
32
- this.filterApps = device.inputs.filterApps || false;
33
- this.filterSystemApps = device.inputs.filterSystemApps || false;
34
- this.filterDlc = device.inputs.filterDlc || false;
35
- this.inputsDisplayOrder = device.inputs.displayOrder || 0;
36
- this.inputs = device.inputs.data || [];
30
+ this.getInputsFromDevice = this.webApiControl ? device.inputs?.getFromDevice : false;
31
+ this.filterGames = device.inputs?.filterGames || false;
32
+ this.filterApps = device.inputs?.filterApps || false;
33
+ this.filterSystemApps = device.inputs?.filterSystemApps || false;
34
+ this.filterDlc = device.inputs?.filterDlc || false;
35
+ this.inputsDisplayOrder = device.inputs?.displayOrder || 0;
36
+ this.inputs = device.inputs?.data || [];
37
37
  this.buttons = device.buttons || [];
38
- this.sensorPower = device.sensors.power || false;
39
- this.sensorInput = device.sensors.input || false;
40
- this.sensorScreenSaver = device.sensors.screenSaver || false;
41
- this.sensorInputs = device.sensors.inputs || [];
38
+ this.sensorPower = device.sensors?.power || false;
39
+ this.sensorInput = device.sensors?.input || false;
40
+ this.sensorScreenSaver = device.sensors?.screenSaver || false;
41
+ this.sensorInputs = device.sensors?.inputs || [];
42
+ this.volumeControl = device.volume?.displayType || 0;
43
+ this.volumeControlName = device.volume?.name || 'Volume';
44
+ this.volumeControlNamePrefix = device.volume?.namePrefix || false;
42
45
  this.infoButtonCommand = device.infoButtonCommand || 'nexus';
43
- this.volumeControl = device.volume.displayType || 0;
44
- this.volumeControlName = device.volume.name || 'Volume';
45
- this.volumeControlNamePrefix = device.volume.namePrefix || false;
46
- this.logInfo = device.log.info || false;
47
- this.logWarn = device.log.warn || false;
48
- this.logDebug = device.log.debug || false;
46
+ this.logInfo = device.log?.info || false;
47
+ this.logWarn = device.log?.warn || false;
48
+ this.logDebug = device.log?.debug || false;
49
49
  this.authTokenFile = authTokenFile;
50
50
  this.devInfoFile = devInfoFile;
51
51
  this.inputsFile = inputsFile;
@@ -202,8 +202,8 @@ class XboxDevice extends EventEmitter {
202
202
  port: this.mqtt.port || 1883,
203
203
  clientId: this.mqtt.clientId ? `microsoft_${this.mqtt.clientId}_${Math.random().toString(16).slice(3)}` : `microsoft_${Math.random().toString(16).slice(3)}`,
204
204
  prefix: this.mqtt.prefix ? `microsoft/${this.mqtt.prefix}/${this.name}` : `microsoft/${this.name}`,
205
- user: this.mqtt.auth.user,
206
- passwd: this.mqtt.auth.passwd,
205
+ user: this.mqtt.auth?.user,
206
+ passwd: this.mqtt.auth?.passwd,
207
207
  debug: this.mqtt.debug || false
208
208
  })
209
209
  .on('connected', (message) => {