homebridge-eosstb 2.2.5 → 2.2.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/CHANGELOG.md CHANGED
@@ -10,6 +10,20 @@ Please restart Homebridge after every plugin update.
10
10
  * Implement refreshToken capabilities
11
11
 
12
12
 
13
+ ## 2.2.8 (2023-05-22)
14
+ * Updated iOS version references
15
+ * Fixed bug causing Homebridge crash when master channel list is not yet loaded
16
+ * Fixed bug causing Homebridge crash when any error occurs in refresh of master channel list
17
+
18
+
19
+ ## 2.2.6 (2023-05-19)
20
+ * Fixed some minor logging typos
21
+ * Added logging of version info
22
+ * Updated engine version references
23
+ * Bumped dependency "axios": "^1.4.0",
24
+ * Bumped dependency "qs": "^6.11.2",
25
+
26
+
13
27
  ## 2.2.5 (2023-03-28)
14
28
  * Improved robustness when no set-top boxes detected in the user profile
15
29
  * Updated iOS version references
package/README.md CHANGED
@@ -72,8 +72,8 @@ In January 2023, an ARRIS VIP5002W appeared, which identifies itself as an APLST
72
72
  This plugin is not provided by Magenta or Telenet or Sunrise or Virgin Media or Ziggo any other affiliate of [UPC](https://en.wikipedia.org/wiki/UPC_Broadband). It is neither endorsed nor supported nor developed by [UPC](https://en.wikipedia.org/wiki/UPC_Broadband) or any affiliates. [UPC](https://en.wikipedia.org/wiki/UPC_Broadband) can change their systems at any time and that might break this plugin. But I hope not.
73
73
 
74
74
  ## Requirements
75
- * An Apple iPhone or iPad with iOS/iPadOS 14.0 (or later). Developed on iOS 14.1...16.4, earlier versions not tested.
76
- * [Homebridge](https://homebridge.io/) v1.1.116 (or later). Developed on Homebridge 1.1.116....1.6.0, earlier versions not tested.
75
+ * An Apple iPhone or iPad with iOS/iPadOS 14.0 (or later). Developed on iOS 14.1...16.5, earlier versions not tested.
76
+ * [Homebridge](https://homebridge.io/) v1.1.116 (or later). Developed on Homebridge 1.1.116....1.6.1, earlier versions not tested.
77
77
  * A TV subscription from one of the supported countries and TV providers.
78
78
  * An online account for viewing TV in the web app (often part of your TV package), see the table above.
79
79
  * An ARRIS DCX960 or HUMAX EOS1008R / 2008C / VIP5002W set-top box, provided by your TV provider as part of your TV subscription, called by the system an "EOSSTB", "EOS2STB" or "APLSTB" and marketed under different names in different countries.
@@ -115,7 +115,7 @@ This plugin is not provided by Magenta or Telenet or Sunrise or Virgin Media or
115
115
 
116
116
  * **Fully Configurable**: A large amount of configuration items exist to allow you to configure your plugin the way you want.
117
117
 
118
- * **Future Feature Support**: The plugin also supports current and target media state as well as closed captions, even though the Home app accessory cannot currently display or control this data in the home app (as at iOS 16.4). Hopefully, Apple will add support for these features in the future. You can however use this data in Home Automations or the Shortcuts app.
118
+ * **Future Feature Support**: The plugin also supports current and target media state as well as closed captions, even though the Home app accessory cannot currently display or control this data in the home app (as at iOS 16.5). Hopefully, Apple will add support for these features in the future. You can however use this data in Home Automations or the Shortcuts app.
119
119
 
120
120
 
121
121
 
@@ -136,7 +136,7 @@ The set-top box accessory is exposed as a separate external accessory and each s
136
136
  4. **Add Accessory**: tap **More options...** to add the accessory manually.
137
137
  5. **Select an Accessory to Add to \<HomeName\>**: Select the accessory you want to add. You should see your set-top box here. If not, check your Homebridge config.
138
138
  6. Accept the **Uncertified Accessory** warning by tapping **Add Anyway**.
139
- 7. **Enter HomeKit Setup Code**: Enter the **HomeKit Setup Code** (displayed in Homebridge under the QR code, format XXX-XX-XXX), or use the device's camera to scan the QR code in Homebridge and tap **Continue**.
139
+ 7. **Enter HomeKit Setup Code**: Enter the **HomeKit Setup Code** (displayed in Homebridge under the QR code, format XXXX-XXXX), or use the device's camera to scan the QR code in Homebridge and tap **Continue**.
140
140
  8. **Set-Top Box Location**: Select a room for your new accessory and tap **Continue**.
141
141
  9. **Set-Top Box Name**: Give your set-top box a different name if you wish (synchronised to your real set-top box, you can change this in the Home app later) and tap **Continue**.
142
142
  10. **Name TV Input Sources**: Re-name your TV input sources if you wish (you can change these in the Home app later) and tap **Continue**.
@@ -204,13 +204,13 @@ Services used in this set-top box accessory are:
204
204
  4. Input service. The input (TV channels) utilises one service per input. The maximum possible channels (inputs) are thus 100 - 3 = 97. I have limited the inputs to maximum 95, but you can override this in the config (helpful to reduce log entries when debugging). The inputs are hard limited to 95 inputs.
205
205
 
206
206
  ### Media State (Play/Pause) Limitations
207
- The eosstb plugin can detect the target and current media state and shows STOP, PLAY, PAUSE or LOADING (loading is displayed only for current media state when fast-forwarding or rewinding) in the Homebridge logs. Unfortunately, the Apple Home app cannot do anything with the media state (as at iOS 16.4) apart from allow you to read it in Shortcuts or Automations. Hopefully this will improve in the future.
207
+ The eosstb plugin can detect the target and current media state and shows STOP, PLAY, PAUSE or LOADING (loading is displayed only for current media state when fast-forwarding or rewinding) in the Homebridge logs. Unfortunately, the Apple Home app cannot do anything with the media state (as at iOS 16.5) apart from allow you to read it in Shortcuts or Automations. Hopefully this will improve in the future.
208
208
 
209
209
  ### Recording State Limitations
210
210
  The eosstb plugin can detect the current recording state of the set-top box, both for local HDD-based recording (for boxes that have a HDD fitted) and for network recording. The plugin shows IDLE, ONGOING_NDVR or ONGOING_LOCALDVR in the Homebridge logs. DVR means digital video recorder; N for network and LOCAL for local HDD based recording. The Apple Home app cannot natively do anything with the recording state but the eosstb plugin uses it to set the inUse charateristic if the set-top box is turned on or is recording to the local HDD. This is useful in Shortcuts or Automations.
211
211
 
212
212
  ### Closed Captions Limitations
213
- The eosstb plugin can detect the closed captions state (**Subtitle options** in the set-top box menu) and shows ENABLED or DISABLED in the Homebridge logs. Unfortunately, the Apple Home app cannot do anything with the closed captions state (as at iOS 16.4) apart from allow you to read it in Shortcuts or Automations. Hopefully this will improve in the future.
213
+ The eosstb plugin can detect the closed captions state (**Subtitle options** in the set-top box menu) and shows ENABLED or DISABLED in the Homebridge logs. Unfortunately, the Apple Home app cannot do anything with the closed captions state (as at iOS 16.5) apart from allow you to read it in Shortcuts or Automations. Hopefully this will improve in the future.
214
214
 
215
215
  ## Configuration
216
216
  Add a new platform to the platforms section of your homebridge `config.json`.
package/index.js CHANGED
@@ -14,6 +14,7 @@ const fsPromises = require('fs').promises;
14
14
  const path = require('path');
15
15
  const debug = require('debug')('eosstb'); // https://github.com/debug-js/debug
16
16
  // good example of debug usage https://github.com/mqttjs/MQTT.js/blob/main/lib/client.js
17
+ const semver = require('semver') // https://github.com/npm/node-semver
17
18
 
18
19
  const mqtt = require('mqtt'); // https://github.com/mqttjs
19
20
  const qs = require('qs'); // https://github.com/ljharb/qs
@@ -305,6 +306,10 @@ class stbPlatform {
305
306
  this.config = config;
306
307
  this.api = api;
307
308
  this.stbDevices = []; // store stbDevice in this.stbDevices
309
+ this.masterChannelList = [];
310
+
311
+ // show some useful version info
312
+ this.log.info('%s v%s, node %s, homebridge v%s', packagejson.name, packagejson.version, process.version, this.api.serverVersion)
308
313
 
309
314
  // only load if configured and mandatory items exist. Homebridge checks for platform itself, and name is not critical
310
315
  if (!this.config) { this.log.warn('%s config missing. Initialization aborted.', PLUGIN_NAME); return; }
@@ -334,7 +339,6 @@ class stbPlatform {
334
339
  //this.api.on('didFinishLaunching', () => {
335
340
  this.api.on('didFinishLaunching', async () => {
336
341
  if (this.config.debugLevel > 2) { this.log.warn('API event: didFinishLaunching'); }
337
- this.log('%s v%s', PLUGIN_NAME, PLUGIN_VERSION);
338
342
  debug('stbPlatform:apievent :: didFinishLaunching')
339
343
 
340
344
  // call the session watchdog once to create the session initially
@@ -344,7 +348,23 @@ class stbPlatform {
344
348
  this.checkSessionInterval = setInterval(this.sessionWatchdog.bind(this),SESSION_WATCHDOG_INTERVAL_MS);
345
349
 
346
350
  // check for a channel list update every MASTER_CHANNEL_LIST_REFRESH_CHECK_INTERVAL_S seconds
347
- this.checkChannelListInterval = setInterval(this.refreshMasterChannelList.bind(this),MASTER_CHANNEL_LIST_REFRESH_CHECK_INTERVAL_S * 1000);
351
+ //this.checkChannelListInterval = setInterval(this.refreshMasterChannelList.bind(this),MASTER_CHANNEL_LIST_REFRESH_CHECK_INTERVAL_S * 1000);
352
+
353
+
354
+ this.checkChannelListInterval = setInterval(() => {
355
+ // refreshMasterChannelList is an async function returning a promise, so handle any rejects
356
+ this.refreshMasterChannelList()
357
+ .then( response => {
358
+ if (this.config.debugLevel >= 0) {
359
+ this.log.warn('stbPlatform: refreshMasterChannelList completed OK');
360
+ }
361
+ })
362
+ .catch(error => {
363
+ if (this.config.debugLevel >= 0) {
364
+ this.log.warn('stbPlatform: could not refresh master channel list:', error);
365
+ }
366
+ })
367
+ }, MASTER_CHANNEL_LIST_REFRESH_CHECK_INTERVAL_S * 1000 ) // need to pass ms
348
368
 
349
369
  debug('stbPlatform:apievent :: didFinishLaunching end of code block')
350
370
  //this.log('stbPlatform: end of code block');
@@ -999,7 +1019,7 @@ class stbPlatform {
999
1019
  .catch(error => {
1000
1020
  //this.log.warn("Step 6 of 6: Unable to authorize with oauth code:", error.response.status, error.response.statusText);
1001
1021
  this.log.debug("Step 6 of 6: Unable to authorize with oauth code:",error);
1002
- reject("Step 6 of 6: Step 6 of 6: Unable to authorize with oauth code: " + error.response.status + ' ' + error.response.statusText); // reject the promise and return the error
1022
+ reject("Step 6 of 6: Unable to authorize with oauth code: " + error.response.status + ' ' + error.response.statusText); // reject the promise and return the error
1003
1023
  });
1004
1024
  };
1005
1025
  };
@@ -1008,7 +1028,8 @@ class stbPlatform {
1008
1028
  .catch(error => {
1009
1029
  //this.log.warn("Step 4 of 6: Unable to oauth authorize:", error.response.status, error.response.statusText);
1010
1030
  this.log.debug("Step 4 of 6: Unable to oauth authorize:",error);
1011
- reject("Step 2 of 6: Step 4 of 6: Unable to oauth authorize: " + error.response.status + ' ' + error.response.statusText); // reject the promise and return the error
1031
+ //reject("Step 4 of 6: Unable to oauth authorize: " + error.response.status + ' ' + error.response.statusText); // reject the promise and return the error
1032
+ reject("Step 4 of 6: Unable to oauth authorize: " + error); // reject the promise and return the error
1012
1033
  });
1013
1034
  };
1014
1035
  })
@@ -1366,6 +1387,7 @@ class stbPlatform {
1366
1387
  url: url,
1367
1388
  headers: {
1368
1389
  accept: '*/*',
1390
+ "x-oesp-token": this.session.accessToken, // to try and avoid the 401 auth issues
1369
1391
  'x-oesp-username': this.session.username
1370
1392
  }
1371
1393
  };
@@ -1374,6 +1396,11 @@ class stbPlatform {
1374
1396
  if (this.config.debugLevel > 0) { this.log.warn('refreshMasterChannelList: response: %s %s', response.status, response.statusText); }
1375
1397
  //this.log(response.data);
1376
1398
 
1399
+ // the header contains the following:
1400
+ // Cache-Control: max-age=600, public, stale-if-error=43200
1401
+ // this could be used to set expiry date...
1402
+
1403
+
1377
1404
  // set the masterChannelListExpiryDate to expire at now + MASTER_CHANNEL_LIST_VALID_FOR_S
1378
1405
  this.masterChannelListExpiryDate =new Date(new Date().getTime() + (MASTER_CHANNEL_LIST_VALID_FOR_S * 1000));
1379
1406
  //this.log('MasterChannelList valid until',this.masterChannelListExpiryDate.toLocaleString())
@@ -1419,7 +1446,6 @@ class stbPlatform {
1419
1446
 
1420
1447
 
1421
1448
 
1422
-
1423
1449
  // load all recording states and bookings
1424
1450
  // called when a mqtt topic is received indicating a recording settings change
1425
1451
  async refreshRecordings(householdId, callback) {
package/package.json CHANGED
@@ -3,20 +3,21 @@
3
3
  "displayName": "Homebridge EOSSTB",
4
4
  "description": "homebridge-plugin - Add your set-top box to Homekit (for Magenta AT, Telenet BE, Sunrise CH, Virgin Media GB & IE, Ziggo NL)",
5
5
  "author": "Jochen Siegenthaler (https://github.com/jsiegenthaler/)",
6
- "version": "2.2.5",
6
+ "version": "2.2.8",
7
7
  "platformname": "eosstb",
8
8
  "dependencies": {
9
9
  "axios-cookiejar-support": "^4.0.6",
10
- "axios": "^1.3.4",
10
+ "axios": "^1.4.0",
11
11
  "debug": "^4.3.4",
12
12
  "mqtt": "^4.3.7",
13
- "qs": "^6.11.1",
13
+ "qs": "^6.11.2",
14
+ "semver": "^7.5.1",
14
15
  "tough-cookie": "^4.1.2"
15
16
  },
16
17
  "deprecated": false,
17
18
  "engines": {
18
- "homebridge": ">=1.6.0",
19
- "node": ">=16.19.1"
19
+ "homebridge": "^1.6.1",
20
+ "node": "^18.16.0"
20
21
  },
21
22
  "homepage": "https://github.com/jsiegenthaler/homebridge-eosstb#readme",
22
23
  "keywords": [