homebridge-eosstb 2.2.0 → 2.2.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 +12 -0
- package/README.md +6 -5
- package/index.js +58 -61
- package/package.json +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,18 @@ Please restart Homebridge after every plugin update.
|
|
|
10
10
|
* Implement refreshToken capabilities
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
## 2.2.2 (2023-02-18)
|
|
14
|
+
* Fixed bug causing 401 unauthorized when refreshing the master channel list
|
|
15
|
+
* Bumped dependency "axios": "^1.3.3"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 2.2.1 (2023-02-11)
|
|
19
|
+
* Fixed issue #96 with failled mqtt session not reconnecting automatically
|
|
20
|
+
* Cleaned up and optimized some code
|
|
21
|
+
* Bumped dependency "axios": "^1.3.2"
|
|
22
|
+
* Improved readme content and layout
|
|
23
|
+
|
|
24
|
+
|
|
13
25
|
## 2.2.0 (2023-01-28)
|
|
14
26
|
* Added support for new ARRIS VIP5002W set-top box as seen in NL in January 2023
|
|
15
27
|
* Added support for households which do not have recording entitlements
|
package/README.md
CHANGED
|
@@ -64,8 +64,9 @@ This plugin was written and tested on the author's set-top box (ARRIS mediabox m
|
|
|
64
64
|
## Why I chose the Name EOSSTB
|
|
65
65
|
I tried to find a good common name that works for this plugin for all countries. Each country uses a different marketing name for the box, so I could not use the local name. The EOS system, also known as the Horizon platform, originally used an ARRIS DCX960, but even this box comes in different types and with different firmware, so I decided not to use the model name. I stuck with the box identifier that appears in the mqtt messages: EOSSTB.
|
|
66
66
|
|
|
67
|
-
In March 2022, a newer version of the set-top box has started to appear in Telenet in Belgium: a HUMAX 2008C-STB-TN, which identifies itself as EOS2STB. This has since been seen in NL as a HUMAX 2008C-STB-ZG, and in CH as a HUMAX 2008C-STB-UPC/CH.
|
|
68
|
-
|
|
67
|
+
In March 2022, a newer version of the set-top box has started to appear in Telenet in Belgium: a HUMAX 2008C-STB-TN, which identifies itself as EOS2STB. This has since been seen in NL as a HUMAX 2008C-STB-ZG, and in CH as a HUMAX 2008C-STB-UPC/CH.
|
|
68
|
+
|
|
69
|
+
In January 2023, an ARRIS VIP5002W appeared, which identifies itself as an APLSTB. However, I will keep the plugin name unchanged at EOSSTB.
|
|
69
70
|
|
|
70
71
|
## Disclaimer (The Legal Stuff)
|
|
71
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.
|
|
@@ -86,9 +87,9 @@ This plugin is not provided by Magenta or Telenet or Sunrise or Virgin Media or
|
|
|
86
87
|
|
|
87
88
|
* **Powerful Key Macros**: You can program key macros to control your set-top box. Key macros are powerful ways of accessing any content such as radio channels that cannot be accessed directly via a channel number.
|
|
88
89
|
|
|
89
|
-
* **Siri Support** You can control your box with Siri (to the extent of what Apple Siri supports).
|
|
90
|
+
* **Siri Support** You can control your set-top box with Siri (to the extent of what Apple Siri supports).
|
|
90
91
|
|
|
91
|
-
* **Shortcuts Support** You can read and control your box with Shortcuts and HomeKit automations (to the extent of what Apple supports), allowing you to control switch-on and channel selection in Home Automations, Shortcuts and Personal Automations.
|
|
92
|
+
* **Shortcuts Support** You can read and control your set-top box with Shortcuts and HomeKit automations (to the extent of what Apple supports), allowing you to control switch-on and channel selection in Home Automations, Shortcuts and Personal Automations, as well as read a lot of status information from your set-top box.
|
|
92
93
|
|
|
93
94
|
* **Synchronised Set-Top Box Name**: Changing the name of the set-top box in the Home app changes it on the TV and backend systems in real time, and vice-versa. No reboot required. You can turn off the sync if desired in the config.
|
|
94
95
|
|
|
@@ -100,7 +101,7 @@ This plugin is not provided by Magenta or Telenet or Sunrise or Virgin Media or
|
|
|
100
101
|
|
|
101
102
|
* **Master Channel List Refreshed Daily**: The master channel list is refreshed daily, ensuring it is always up to date.
|
|
102
103
|
|
|
103
|
-
* **Ignores Non-Subscribed Channels**: Only the channels you subscribe to are shown in the Home app, saving you valuable slots in the
|
|
104
|
+
* **Ignores Non-Subscribed Channels**: Only the channels you subscribe to are shown in the Home app, saving you valuable slots in the Home app channel list.
|
|
104
105
|
|
|
105
106
|
* **Optional Channel Numbers**: If you wish, you can display a channel number before the channel name. As this consumes some space on the Home app tile, it is off by default.
|
|
106
107
|
|
package/index.js
CHANGED
|
@@ -123,7 +123,7 @@ const NO_CHANNEL_ID = 'ID_UNKNOWN'; // id for a channel not in the channel list,
|
|
|
123
123
|
const NO_CHANNEL_NAME = 'UNKNOWN'; // name for a channel not in the channel list
|
|
124
124
|
const MAX_INPUT_SOURCES = 95; // max input services. Default = 95. Cannot be more than 96 (100 - all other services)
|
|
125
125
|
const SESSION_WATCHDOG_INTERVAL_MS = 15000; // session watchdog interval in millisec. Default = 15000 (15s)
|
|
126
|
-
const MASTER_CHANNEL_LIST_VALID_FOR_S = 86400; // master channel list
|
|
126
|
+
const MASTER_CHANNEL_LIST_VALID_FOR_S = 86400; // master channel list stays valid for 24 hours from last refresh. 24hr = 86400 seconds
|
|
127
127
|
const MASTER_CHANNEL_LIST_REFRESH_CHECK_INTERVAL_S = 3600; // master channel list refresh check interval, in seconds. Default = 3600 (1hr) (increased from 600)
|
|
128
128
|
const SETTOPBOX_NAME_MINLEN = 3; // min len of the set-top box name
|
|
129
129
|
const SETTOPBOX_NAME_MAXLEN = 14; // max len of the set-top box name
|
|
@@ -132,13 +132,11 @@ const SETTOPBOX_NAME_MAXLEN = 14; // max len of the set-top box name
|
|
|
132
132
|
|
|
133
133
|
// state constants. Need to add an array for any characteristic that is not an array, or the array is not contiguous
|
|
134
134
|
const sessionState = { DISCONNECTED: 0, LOADING: 1, LOGGING_IN: 2, AUTHENTICATING: 3, VERIFYING: 4, AUTHENTICATED: 5, CONNECTED: 6 }; // custom
|
|
135
|
-
const mqttState = { DISCONNECTED: 0, OFFLINE: 1, CLOSED: 2, CONNECTED: 3, RECONNECTED: 4, ERROR: 5, END: 6, MESSAGERECEIVED: 7, PACKETSENT: 8, PACKETRECEIVED: 9 }; // custom
|
|
136
135
|
const powerStateName = ["OFF", "ON"]; // custom
|
|
137
136
|
const recordingState = { IDLE: 0, ONGOING_NDVR: 1, ONGOING_LOCALDVR: 2 }; // custom
|
|
138
137
|
const statusActiveName = ["NOT_ACTIVE", "ACTIVE"]; // ccustom, haracteristic is boolean, not an array
|
|
139
138
|
|
|
140
139
|
Object.freeze(sessionState);
|
|
141
|
-
Object.freeze(mqttState);
|
|
142
140
|
Object.freeze(powerStateName);
|
|
143
141
|
Object.freeze(recordingState);
|
|
144
142
|
Object.freeze(statusActiveName);
|
|
@@ -318,7 +316,6 @@ class stbPlatform {
|
|
|
318
316
|
// session flags
|
|
319
317
|
currentSessionState = sessionState.DISCONNECTED;
|
|
320
318
|
mqttClient.connected = false;
|
|
321
|
-
this.currentMqttState = mqttState.DISCONNECTED;
|
|
322
319
|
this.sessionWatchdogRunning = false;
|
|
323
320
|
this.watchdogCounter = 0;
|
|
324
321
|
this.mqttClientConnecting = false;
|
|
@@ -433,38 +430,36 @@ class stbPlatform {
|
|
|
433
430
|
// If no session exists: prepares the session, then prepares the device
|
|
434
431
|
this.watchdogCounter++; // increment global counter by 1
|
|
435
432
|
let watchdogInstance = 'sessionWatchdog(' + this.watchdogCounter + ')'; // set a log prefix for this instance of the watchdog to allow differentiation in the logs
|
|
436
|
-
let statusOverview =
|
|
433
|
+
let statusOverview = '';
|
|
437
434
|
callback = true;
|
|
438
435
|
//this.log('++++ SESSION WATCHDOG STARTED ++++');
|
|
439
436
|
|
|
440
437
|
// standard debugging
|
|
441
438
|
let debugPrefix='\x1b[33msessionWatchdog :: ' // 33=yellow
|
|
442
439
|
debug(debugPrefix + 'started')
|
|
443
|
-
if (this.config.debugLevel > 2) { this.log.warn(
|
|
440
|
+
if (this.config.debugLevel > 2) { this.log.warn('%s: Started watchdog instance %s', watchdogInstance, this.watchdogCounter); }
|
|
444
441
|
|
|
445
442
|
//robustness: if session state ever gets disconnected due to session creation problems, ensure the mqtt status is always disconnected
|
|
446
443
|
if (currentSessionState == sessionState.DISCONNECTED) {
|
|
447
444
|
this.mqttClientConnecting = false;
|
|
448
|
-
this.currentMqttState = mqttState.DISCONNECTED;
|
|
449
445
|
}
|
|
450
446
|
|
|
451
447
|
|
|
452
448
|
if (this.config.debugLevel > 0) {
|
|
453
449
|
statusOverview = statusOverview + ' sessionState=' + Object.keys(sessionState)[currentSessionState]
|
|
454
|
-
statusOverview = statusOverview + ' mqttState=' + Object.keys(mqttState)[this.currentMqttState]
|
|
455
450
|
statusOverview = statusOverview + ' mqttClient.connected=' + mqttClient.connected
|
|
456
451
|
statusOverview = statusOverview + ' sessionWatchdogRunning=' + this.sessionWatchdogRunning
|
|
457
452
|
}
|
|
458
453
|
|
|
459
454
|
// exit if shutting down
|
|
460
455
|
if (isShuttingDown) {
|
|
461
|
-
if (this.config.debugLevel > 2) { this.log.warn(
|
|
456
|
+
if (this.config.debugLevel > 2) { this.log.warn(watchdogInstance + ': Homebridge is shutting down, exiting %s without action', watchdogInstance); }
|
|
462
457
|
return;
|
|
463
458
|
}
|
|
464
459
|
|
|
465
460
|
// exit if a previous session is still running
|
|
466
461
|
if (this.sessionWatchdogRunning) {
|
|
467
|
-
if (this.config.debugLevel > 2) { this.log.warn(
|
|
462
|
+
if (this.config.debugLevel > 2) { this.log.warn(watchdogInstance + ': Previous sessionWatchdog still working, exiting %s without action', watchdogInstance); }
|
|
468
463
|
return;
|
|
469
464
|
|
|
470
465
|
// as we are called regularly by setInterval, check connection status and exit without action if required
|
|
@@ -472,29 +467,29 @@ class stbPlatform {
|
|
|
472
467
|
// session is connected, check mqtt state
|
|
473
468
|
|
|
474
469
|
if (mqttClient.connected) {
|
|
475
|
-
if (this.config.debugLevel > 2) { this.log.warn(
|
|
470
|
+
if (this.config.debugLevel > 2) { this.log.warn(watchdogInstance + ': Session and mqtt connected, exiting %s without action', watchdogInstance); }
|
|
476
471
|
return;
|
|
477
472
|
} else if (this.mqttClientConnecting) {
|
|
478
|
-
if (this.config.debugLevel > 2) { this.log.warn(
|
|
473
|
+
if (this.config.debugLevel > 2) { this.log.warn(watchdogInstance + ': Session connected but mqtt still connecting, exiting %s without action', watchdogInstance); }
|
|
479
474
|
return;
|
|
480
475
|
} else {
|
|
481
|
-
if (this.config.debugLevel > 2) { this.log.warn(
|
|
476
|
+
if (this.config.debugLevel > 2) { this.log.warn(watchdogInstance + ': Session connected but mqtt not connected, %s will try to reconnect mqtt now...', watchdogInstance); }
|
|
482
477
|
}
|
|
483
478
|
|
|
484
479
|
} else if (currentSessionState != sessionState.DISCONNECTED) {
|
|
485
480
|
// session is not disconnected, meaning it is between connected and disconnected, ie: a connection is in progress
|
|
486
|
-
if (this.config.debugLevel > 2) { this.log.warn(
|
|
481
|
+
if (this.config.debugLevel > 2) { this.log.warn(watchdogInstance + ': Session still connecting, exiting %s without action', watchdogInstance); }
|
|
487
482
|
return;
|
|
488
483
|
|
|
489
484
|
} else {
|
|
490
485
|
// session is not connected and is not in a state between connected and disconnected, so it is disconnected. ContinuecurrentMediaStateName(
|
|
491
|
-
if (this.config.debugLevel > 2) { this.log.warn(
|
|
486
|
+
if (this.config.debugLevel > 2) { this.log.warn(watchdogInstance + ': Session and mqtt not connected, %s will try to connect now...', watchdogInstance); }
|
|
492
487
|
|
|
493
488
|
}
|
|
494
489
|
|
|
495
490
|
// the watchdog will now attempt to reconnect the session. Flag that the watchdog is running
|
|
496
491
|
this.sessionWatchdogRunning = true;
|
|
497
|
-
if (this.config.debugLevel > 2) { this.log.warn('%s: sessionWatchdogRunning=%s', watchdogInstance, this.sessionWatchdogRunning); }
|
|
492
|
+
if (this.config.debugLevel > 2) { this.log.warn('%s: Status: sessionWatchdogRunning=%s', watchdogInstance, this.sessionWatchdogRunning); }
|
|
498
493
|
|
|
499
494
|
|
|
500
495
|
// detect if running on development environment
|
|
@@ -507,73 +502,73 @@ class stbPlatform {
|
|
|
507
502
|
let errorTitle;
|
|
508
503
|
if (currentSessionState == sessionState.DISCONNECTED ) {
|
|
509
504
|
this.log('Session %s. Starting session connection process', Object.keys(sessionState)[currentSessionState]);
|
|
510
|
-
if (this.config.debugLevel > 2) { this.log.warn('%s:
|
|
505
|
+
if (this.config.debugLevel > 2) { this.log.warn('%s: Attempting to create session', watchdogInstance); }
|
|
511
506
|
|
|
512
507
|
// asnyc startup sequence with chain of promises
|
|
513
|
-
this.log.debug('
|
|
508
|
+
this.log.debug('%s: ++++ step 1: calling createSession', watchdogInstance)
|
|
514
509
|
errorTitle = 'Failed to create session';
|
|
515
510
|
debug(debugPrefix + 'calling createSession')
|
|
516
511
|
await this.createSession(this.config.country.toLowerCase()) // returns householdId, stores session in this.session
|
|
517
512
|
.then((sessionHouseholdId) => {
|
|
518
|
-
this.log.debug('
|
|
519
|
-
this.log.debug('
|
|
513
|
+
this.log.debug('%s: ++++++ step 2: session was created, connected to sessionHouseholdId %s', watchdogInstance, sessionHouseholdId)
|
|
514
|
+
this.log.debug('%s: ++++++ step 2: calling getPersonalizationData with sessionHouseholdId %s ', watchdogInstance, sessionHouseholdId)
|
|
520
515
|
this.log('Discovering platform...');
|
|
521
516
|
errorTitle = 'Failed to discover platform';
|
|
522
517
|
debug(debugPrefix + 'calling getPersonalizationData')
|
|
523
518
|
return this.getPersonalizationData(this.session.householdId) // returns customer object, with devices and profiles, stores object in this.customer
|
|
524
519
|
})
|
|
525
520
|
.then((objCustomer) => {
|
|
526
|
-
this.log.debug('
|
|
527
|
-
this.log.debug('
|
|
521
|
+
this.log.debug('%s: ++++++ step 3: personalization data was retrieved, customerId %s customerStatus %s', watchdogInstance, objCustomer.customerId, objCustomer.customerStatus)
|
|
522
|
+
this.log.debug('%s: ++++++ step 3: calling getEntitlements with customerId %s ', watchdogInstance, objCustomer.customerId)
|
|
528
523
|
debug(debugPrefix + 'calling getEntitlements')
|
|
529
524
|
return this.getEntitlements(this.customer.customerId) // returns customer object
|
|
530
525
|
})
|
|
531
526
|
.then((objEntitlements) => {
|
|
532
|
-
this.log.debug('
|
|
533
|
-
this.log.debug('
|
|
527
|
+
this.log.debug('%s: ++++++ step 4: entitlements data was retrieved, objEntitlements.token %s', watchdogInstance, objEntitlements.token)
|
|
528
|
+
this.log.debug('%s: ++++++ step 4: calling refreshMasterChannelList', watchdogInstance)
|
|
534
529
|
debug(debugPrefix + 'calling refreshMasterChannelList')
|
|
535
530
|
return this.refreshMasterChannelList() // returns entitlements object
|
|
536
531
|
})
|
|
537
532
|
.then((objChannels) => {
|
|
538
|
-
this.log.debug('
|
|
533
|
+
this.log.debug('%s: ++++++ step 5: masterchannelList data was retrieved, channels found: %s', watchdogInstance, objChannels.length)
|
|
539
534
|
// Recording needs entitlements of PVR or LOCALDVR
|
|
540
535
|
const pvrFeatureFound = this.entitlements.features.find(feature => (feature === 'PVR' || feature === 'LOCALDVR'));
|
|
541
|
-
this.log.debug('
|
|
536
|
+
this.log.debug('%s: ++++++ step 5: foundPvrEntitlement %s', watchdogInstance, pvrFeatureFound);
|
|
542
537
|
if (pvrFeatureFound) {
|
|
543
|
-
this.log.debug('
|
|
538
|
+
this.log.debug('%s: ++++++ step 5: calling getRecordingState with householdId %s', watchdogInstance, this.session.householdId)
|
|
544
539
|
this.getRecordingState(this.session.householdId) // returns true when successful
|
|
545
540
|
}
|
|
546
541
|
return true
|
|
547
542
|
})
|
|
548
543
|
.then((objRecordingStateFound) => {
|
|
549
|
-
this.log.debug('
|
|
544
|
+
this.log.debug('%s: ++++++ step 6: recording state data was retrieved, objRecordingStateFound: %s', watchdogInstance, objRecordingStateFound)
|
|
550
545
|
// Recording needs entitlements of PVR or LOCALDVR
|
|
551
546
|
const pvrFeatureFound = this.entitlements.features.find(feature => (feature === 'PVR' || feature === 'LOCALDVR'));
|
|
552
|
-
this.log.debug('
|
|
547
|
+
this.log.debug('%s: ++++++ step 6: foundPvrEntitlement %s', watchdogInstance, pvrFeatureFound);
|
|
553
548
|
if (pvrFeatureFound) {
|
|
554
|
-
this.log.debug('
|
|
549
|
+
this.log.debug('%s: ++++++ step 6: calling getRecordingBookings with householdId %s', watchdogInstance, this.session.householdId)
|
|
555
550
|
this.getRecordingBookings(this.session.householdId) // returns true when successful
|
|
556
551
|
}
|
|
557
552
|
return true
|
|
558
553
|
})
|
|
559
554
|
.then((objRecordingBookingsFound) => {
|
|
560
|
-
this.log.debug('
|
|
561
|
-
this.log.debug('
|
|
555
|
+
this.log.debug('%s: ++++++ step 7: recording bookings data was retrieved, objRecordingBookingsFound: %s', watchdogInstance, objRecordingBookingsFound)
|
|
556
|
+
this.log.debug('%s: ++++++ step 7: calling discoverDevices', watchdogInstance)
|
|
562
557
|
errorTitle = 'Failed to discover devices';
|
|
563
558
|
debug(debugPrefix + 'calling discoverDevices')
|
|
564
559
|
return this.discoverDevices() // returns stbDevices object
|
|
565
560
|
})
|
|
566
561
|
.then((objStbDevices) => {
|
|
567
562
|
this.log('Discovery completed');
|
|
568
|
-
this.log.debug('
|
|
569
|
-
this.log.debug('
|
|
563
|
+
this.log.debug('%s: ++++++ step 8: devices found:', watchdogInstance, this.devices.length)
|
|
564
|
+
this.log.debug('%s: ++++++ step 8: calling getJwtToken', watchdogInstance)
|
|
570
565
|
errorTitle = 'Failed to start mqtt session';
|
|
571
566
|
debug(debugPrefix + 'calling getJwtToken')
|
|
572
567
|
return this.getJwtToken(this.session.username, this.session.accessToken, this.session.householdId);
|
|
573
568
|
})
|
|
574
569
|
.then((jwToken) => {
|
|
575
|
-
this.log.debug('
|
|
576
|
-
this.log.debug('
|
|
570
|
+
this.log.debug('%s: ++++++ step 9: getJwtToken token was retrieved, token %s', watchdogInstance, jwToken)
|
|
571
|
+
this.log.debug('%s: ++++++ step 9: start mqtt client', watchdogInstance)
|
|
577
572
|
debug(debugPrefix + 'calling startMqttClient')
|
|
578
573
|
return this.startMqttClient(this, this.session.householdId, jwToken); // returns true
|
|
579
574
|
})
|
|
@@ -585,10 +580,11 @@ class stbPlatform {
|
|
|
585
580
|
return true
|
|
586
581
|
});
|
|
587
582
|
debug(debugPrefix + 'end of promise chain')
|
|
588
|
-
|
|
589
|
-
//this.log.debug('
|
|
583
|
+
this.log.debug('%s: ++++++ End of promise chain', watchdogInstance)
|
|
584
|
+
//this.log.debug('%s: ++++ create session promise chain completed', watchdogInstance)
|
|
590
585
|
}
|
|
591
586
|
|
|
587
|
+
if (this.config.debugLevel > 2) { this.log.warn('%s: Exiting sessionWatchdog', watchdogInstance,); }
|
|
592
588
|
debug(debugPrefix + 'exiting sessionWatchdog')
|
|
593
589
|
//this.log('Exiting sessionWatchdog')
|
|
594
590
|
this.sessionWatchdogRunning = false;
|
|
@@ -672,7 +668,7 @@ class stbPlatform {
|
|
|
672
668
|
}
|
|
673
669
|
|
|
674
670
|
};
|
|
675
|
-
resolve(
|
|
671
|
+
resolve(this.stbDevices); // resolve the promise with the stbDevices object
|
|
676
672
|
}
|
|
677
673
|
|
|
678
674
|
//this.log.debug('discoverDevices: end of code block')
|
|
@@ -1331,13 +1327,15 @@ class stbPlatform {
|
|
|
1331
1327
|
// exit immediately if the session does not exist
|
|
1332
1328
|
if (currentSessionState != sessionState.CONNECTED) {
|
|
1333
1329
|
if (this.config.debugLevel > 1) { this.log.warn('refreshMasterChannelList: Session does not exist, exiting'); }
|
|
1334
|
-
|
|
1330
|
+
resolve(true);
|
|
1331
|
+
return
|
|
1335
1332
|
}
|
|
1336
1333
|
|
|
1337
1334
|
// exit immediately if channel list has not expired
|
|
1338
1335
|
if (this.masterChannelListExpiryDate > Date.now()) {
|
|
1339
1336
|
if (this.config.debugLevel > 1) { this.log.warn('refreshMasterChannelList: Master channel list has not expired yet. Next refresh will occur after %s', this.masterChannelListExpiryDate.toLocaleString()); }
|
|
1340
|
-
|
|
1337
|
+
resolve(true);
|
|
1338
|
+
return
|
|
1341
1339
|
}
|
|
1342
1340
|
|
|
1343
1341
|
this.log('Refreshing master channel list');
|
|
@@ -1366,7 +1364,11 @@ class stbPlatform {
|
|
|
1366
1364
|
// call the webservice to get all available channels
|
|
1367
1365
|
const axiosConfig = {
|
|
1368
1366
|
method: 'GET',
|
|
1369
|
-
url: url
|
|
1367
|
+
url: url,
|
|
1368
|
+
headers: {
|
|
1369
|
+
accept: '*/*',
|
|
1370
|
+
'x-oesp-username': this.session.username
|
|
1371
|
+
}
|
|
1370
1372
|
};
|
|
1371
1373
|
axiosWS(axiosConfig)
|
|
1372
1374
|
.then(response => {
|
|
@@ -1398,7 +1400,7 @@ class stbPlatform {
|
|
|
1398
1400
|
if (this.config.debugLevel > 0) {
|
|
1399
1401
|
this.log.warn('refreshMasterChannelList: Master channel list refreshed with %s channels, valid until %s', this.masterChannelList.length, this.masterChannelListExpiryDate.toLocaleString());
|
|
1400
1402
|
}
|
|
1401
|
-
resolve(
|
|
1403
|
+
resolve(this.masterChannelList); // resolve the promise with the masterChannelList object
|
|
1402
1404
|
|
|
1403
1405
|
})
|
|
1404
1406
|
.catch(error => {
|
|
@@ -1436,17 +1438,19 @@ class stbPlatform {
|
|
|
1436
1438
|
.then(() => {
|
|
1437
1439
|
this.log.debug('refreshRecordings: ++++++ step 2: calling getRecordingBookings with householdId %s ', householdId)
|
|
1438
1440
|
this.getRecordingBookings(householdId) // returns customer object, with devices and profiles, stores object in this.customer
|
|
1439
|
-
resolve(
|
|
1441
|
+
resolve(true); // resolve the promise
|
|
1442
|
+
return;
|
|
1440
1443
|
})
|
|
1441
1444
|
.catch(errorReason => {
|
|
1442
1445
|
// log any errors and set the currentSessionState
|
|
1443
1446
|
this.log.warn(errorTitle + ' - %s', errorReason);
|
|
1444
1447
|
reject(errorReason);
|
|
1448
|
+
return;
|
|
1445
1449
|
});
|
|
1446
1450
|
} else {
|
|
1447
1451
|
this.log.debug('refreshRecordings: no recordings entitlement found');
|
|
1448
1452
|
}
|
|
1449
|
-
|
|
1453
|
+
resolve(true); // resolve the promise
|
|
1450
1454
|
|
|
1451
1455
|
})
|
|
1452
1456
|
}
|
|
@@ -1545,7 +1549,7 @@ class stbPlatform {
|
|
|
1545
1549
|
//this.refreshMasterChannelList(); // async function, processing continues, must load after customer data is loaded
|
|
1546
1550
|
|
|
1547
1551
|
//this.log.warn('getPersonalizationData: all done, returnng customerStatus: %s', this.customer.customerStatus);
|
|
1548
|
-
resolve(
|
|
1552
|
+
resolve(this.customer); // resolve the promise with the customer object
|
|
1549
1553
|
})
|
|
1550
1554
|
.catch(error => {
|
|
1551
1555
|
let errReason;
|
|
@@ -1629,7 +1633,7 @@ class stbPlatform {
|
|
|
1629
1633
|
this.log.warn('getEntitlements: entitlements found:', this.entitlements.entitlements.length);
|
|
1630
1634
|
}
|
|
1631
1635
|
//his.log('getEntitlements: returning entitlements object');
|
|
1632
|
-
resolve(
|
|
1636
|
+
resolve(this.entitlements); // resolve the promise with the customer object
|
|
1633
1637
|
})
|
|
1634
1638
|
.catch(error => {
|
|
1635
1639
|
let errReason;
|
|
@@ -1743,7 +1747,7 @@ class stbPlatform {
|
|
|
1743
1747
|
|
|
1744
1748
|
});
|
|
1745
1749
|
}
|
|
1746
|
-
resolve(
|
|
1750
|
+
resolve(this.currentRecordingState); // resolve the promise
|
|
1747
1751
|
})
|
|
1748
1752
|
|
|
1749
1753
|
.catch(error => {
|
|
@@ -1871,7 +1875,7 @@ class stbPlatform {
|
|
|
1871
1875
|
|
|
1872
1876
|
});
|
|
1873
1877
|
}
|
|
1874
|
-
resolve(
|
|
1878
|
+
resolve(this.currentRecordingState); // resolve the promise
|
|
1875
1879
|
})
|
|
1876
1880
|
|
|
1877
1881
|
.catch(error => {
|
|
@@ -1893,7 +1897,7 @@ class stbPlatform {
|
|
|
1893
1897
|
this.log.warn(error)
|
|
1894
1898
|
}
|
|
1895
1899
|
reject(errReason);
|
|
1896
|
-
|
|
1900
|
+
});
|
|
1897
1901
|
})
|
|
1898
1902
|
}
|
|
1899
1903
|
|
|
@@ -1923,7 +1927,7 @@ class stbPlatform {
|
|
|
1923
1927
|
this.log.warn('getExperimentalEndpoint: response: %s %s', response.status, response.statusText);
|
|
1924
1928
|
this.log.warn(response.data);
|
|
1925
1929
|
return true
|
|
1926
|
-
//resolve(
|
|
1930
|
+
//resolve(true); // resolve the promise with the customer object
|
|
1927
1931
|
})
|
|
1928
1932
|
.catch(error => {
|
|
1929
1933
|
let errReason;
|
|
@@ -1994,7 +1998,7 @@ class stbPlatform {
|
|
|
1994
1998
|
}
|
|
1995
1999
|
//this.jwtToken = response.data.token; // store the token
|
|
1996
2000
|
mqttUsername = householdId; // used in sendKey to ensure that mqtt is connected
|
|
1997
|
-
resolve(
|
|
2001
|
+
resolve(response.data.token); // resolve with the tokwn
|
|
1998
2002
|
//this.startMqttClient(this, householdId, response.data.token); // this starts the mqtt session
|
|
1999
2003
|
|
|
2000
2004
|
})
|
|
@@ -2057,8 +2061,7 @@ class stbPlatform {
|
|
|
2057
2061
|
// https://github.com/mqttjs/MQTT.js#event-connect
|
|
2058
2062
|
mqttClient.on('connect', function () {
|
|
2059
2063
|
try {
|
|
2060
|
-
parent.log("mqttClient:
|
|
2061
|
-
parent.currentMqttState = mqttState.CONNECTED;
|
|
2064
|
+
parent.log("mqttClient: %s", mqttClient.connected ? 'Connected' : 'Disconnected' ); // Conditional (ternary) operator: condition ? trueValue : FalseValue
|
|
2062
2065
|
parent.mqttClientConnecting = false;
|
|
2063
2066
|
|
|
2064
2067
|
// https://prod.spark.sunrisetv.ch/eng/web/personalization-service/v1/customer/107xxxx_ch/profiles
|
|
@@ -2123,7 +2126,6 @@ class stbPlatform {
|
|
|
2123
2126
|
try {
|
|
2124
2127
|
|
|
2125
2128
|
// store some mqtt diagnostic data
|
|
2126
|
-
parent.currentMqttState = mqttState.CONNECTED; // set to connected on every message received event
|
|
2127
2129
|
parent.lastMqttMessageReceived = Date.now();
|
|
2128
2130
|
|
|
2129
2131
|
let mqttMessage = JSON.parse(message);
|
|
@@ -2372,7 +2374,6 @@ class stbPlatform {
|
|
|
2372
2374
|
mqttClient.on('close', function () {
|
|
2373
2375
|
try {
|
|
2374
2376
|
// mqttDeviceStateHandler(deviceId, powerState, mediaState, recordingState, channelId, eventId, sourceType, profileDataChanged, statusFault, programMode, statusActive, currInputDeviceType, currInputSourceType)
|
|
2375
|
-
parent.currentMqttState = mqttState.CLOSED;
|
|
2376
2377
|
parent.log('mqttClient: Connection closed');
|
|
2377
2378
|
currentSessionState = sessionState.DISCONNECTED; // to force a session reconnect
|
|
2378
2379
|
if (!isShuttingDown) {
|
|
@@ -2390,7 +2391,6 @@ class stbPlatform {
|
|
|
2390
2391
|
mqttClient.on('reconnect', function () {
|
|
2391
2392
|
try {
|
|
2392
2393
|
// mqttDeviceStateHandler(deviceId, powerState, mediaState, recordingState, channelId, eventId, sourceType, profileDataChanged, statusFault, programMode, statusActive, currInputDeviceType, currInputSourceType)
|
|
2393
|
-
parent.currentMqttState = mqttState.RECONNECTED;
|
|
2394
2394
|
parent.log('mqttClient: Reconnect started');
|
|
2395
2395
|
parent.mqttDeviceStateHandler(null, null, null, null, null, null, null, null, Characteristic.StatusFault.GENERAL_FAULT); // set statusFault to GENERAL_FAULT
|
|
2396
2396
|
} catch (err) {
|
|
@@ -2405,7 +2405,6 @@ class stbPlatform {
|
|
|
2405
2405
|
mqttClient.on('disconnect', function () {
|
|
2406
2406
|
try {
|
|
2407
2407
|
// mqttDeviceStateHandler(deviceId, powerState, mediaState, recordingState, channelId, eventId, sourceType, profileDataChanged, statusFault, programMode, statusActive, currInputDeviceType, currInputSourceType)
|
|
2408
|
-
parent.currentMqttState = mqttState.DISCONNECTED;
|
|
2409
2408
|
parent.log('mqttClient: Disconnect command received');
|
|
2410
2409
|
currentSessionState = sessionState.DISCONNECTED; // to force a session reconnect
|
|
2411
2410
|
parent.mqttDeviceStateHandler(null, null, null, null, null, null, null, null, Characteristic.StatusFault.GENERAL_FAULT); // set statusFault to GENERAL_FAULT
|
|
@@ -2421,7 +2420,6 @@ class stbPlatform {
|
|
|
2421
2420
|
mqttClient.on('offline', function () {
|
|
2422
2421
|
try {
|
|
2423
2422
|
// mqttDeviceStateHandler(deviceId, powerState, mediaState, recordingState, channelId, eventId, sourceType, profileDataChanged, statusFault, programMode, statusActive, currInputDeviceType, currInputSourceType)
|
|
2424
|
-
parent.currentMqttState = mqttState.OFFLINE;
|
|
2425
2423
|
parent.log('mqttClient: Client is offline');
|
|
2426
2424
|
currentSessionState = sessionState.DISCONNECTED; // to force a session reconnect
|
|
2427
2425
|
parent.mqttDeviceStateHandler(null, null, null, null, null, null, null, null, Characteristic.StatusFault.GENERAL_FAULT); // set statusFault to GENERAL_FAULT
|
|
@@ -2437,9 +2435,8 @@ class stbPlatform {
|
|
|
2437
2435
|
mqttClient.on('error', function(err) {
|
|
2438
2436
|
try {
|
|
2439
2437
|
// mqttDeviceStateHandler(deviceId, powerState, mediaState, recordingState, channelId, eventId, sourceType, profileDataChanged, statusFault, programMode, statusActive, currInputDeviceType, currInputSourceType)
|
|
2440
|
-
parent.currentMqttState = mqttState.ERROR;
|
|
2441
2438
|
parent.log.warn('mqttClient: Error', (err.syscall || '') + ' ' + (err.code || '') + ' ' + (err.hostname || ''));
|
|
2442
|
-
parent.log.
|
|
2439
|
+
parent.log.debug('mqttClient: Error object:', err);
|
|
2443
2440
|
currentSessionState = sessionState.DISCONNECTED; // to force a session reconnect
|
|
2444
2441
|
parent.mqttDeviceStateHandler(null, null, null, null, null, null, null, null, Characteristic.StatusFault.GENERAL_FAULT); // set statusFault to GENERAL_FAULT
|
|
2445
2442
|
mqttClient.end();
|
package/package.json
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
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.
|
|
6
|
+
"version": "2.2.2",
|
|
7
7
|
"platformname": "eosstb",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"axios-cookiejar-support": "^4.0.6",
|
|
10
|
-
"axios": "^1.
|
|
10
|
+
"axios": "^1.3.3",
|
|
11
11
|
"debug": "^4.3.4",
|
|
12
12
|
"mqtt": "^4.3.7",
|
|
13
13
|
"qs": "^6.11.0",
|
|
@@ -66,9 +66,11 @@
|
|
|
66
66
|
"VIP5002W",
|
|
67
67
|
"HUMAX",
|
|
68
68
|
"2008C",
|
|
69
|
+
"2008CSTB",
|
|
69
70
|
"2008C-STB",
|
|
70
71
|
"2008C-STB-TN",
|
|
71
|
-
"EOS1008R"
|
|
72
|
+
"EOS1008R",
|
|
73
|
+
"APLSTB"
|
|
72
74
|
],
|
|
73
75
|
"license": "MIT",
|
|
74
76
|
"main": "index.js",
|