homebridge-eosstb 2.2.0 → 2.2.1
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 +6 -0
- package/README.md +6 -5
- package/index.js +47 -58
- package/package.json +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,12 @@ Please restart Homebridge after every plugin update.
|
|
|
9
9
|
* Add ability to log and read current program name
|
|
10
10
|
* Implement refreshToken capabilities
|
|
11
11
|
|
|
12
|
+
## 2.2.1 (2023-02-11)
|
|
13
|
+
* Fixed issue #96 with failled mqtt session not reconnecting automatically
|
|
14
|
+
* Cleaned up and optimized some code
|
|
15
|
+
* Bumped dependency "axios": "^1.3.2"
|
|
16
|
+
* Improved readme content and layout
|
|
17
|
+
|
|
12
18
|
|
|
13
19
|
## 2.2.0 (2023-01-28)
|
|
14
20
|
* Added support for new ARRIS VIP5002W set-top box as seen in NL in January 2023
|
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
|
@@ -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,13 @@ 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);
|
|
1335
1331
|
}
|
|
1336
1332
|
|
|
1337
1333
|
// exit immediately if channel list has not expired
|
|
1338
1334
|
if (this.masterChannelListExpiryDate > Date.now()) {
|
|
1339
1335
|
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
|
-
|
|
1336
|
+
resolve(true);
|
|
1341
1337
|
}
|
|
1342
1338
|
|
|
1343
1339
|
this.log('Refreshing master channel list');
|
|
@@ -1398,7 +1394,7 @@ class stbPlatform {
|
|
|
1398
1394
|
if (this.config.debugLevel > 0) {
|
|
1399
1395
|
this.log.warn('refreshMasterChannelList: Master channel list refreshed with %s channels, valid until %s', this.masterChannelList.length, this.masterChannelListExpiryDate.toLocaleString());
|
|
1400
1396
|
}
|
|
1401
|
-
resolve(
|
|
1397
|
+
resolve(this.masterChannelList); // resolve the promise with the masterChannelList object
|
|
1402
1398
|
|
|
1403
1399
|
})
|
|
1404
1400
|
.catch(error => {
|
|
@@ -1436,7 +1432,7 @@ class stbPlatform {
|
|
|
1436
1432
|
.then(() => {
|
|
1437
1433
|
this.log.debug('refreshRecordings: ++++++ step 2: calling getRecordingBookings with householdId %s ', householdId)
|
|
1438
1434
|
this.getRecordingBookings(householdId) // returns customer object, with devices and profiles, stores object in this.customer
|
|
1439
|
-
resolve(
|
|
1435
|
+
resolve(true); // resolve the promise
|
|
1440
1436
|
})
|
|
1441
1437
|
.catch(errorReason => {
|
|
1442
1438
|
// log any errors and set the currentSessionState
|
|
@@ -1446,7 +1442,7 @@ class stbPlatform {
|
|
|
1446
1442
|
} else {
|
|
1447
1443
|
this.log.debug('refreshRecordings: no recordings entitlement found');
|
|
1448
1444
|
}
|
|
1449
|
-
|
|
1445
|
+
resolve(true); // resolve the promise
|
|
1450
1446
|
|
|
1451
1447
|
})
|
|
1452
1448
|
}
|
|
@@ -1545,7 +1541,7 @@ class stbPlatform {
|
|
|
1545
1541
|
//this.refreshMasterChannelList(); // async function, processing continues, must load after customer data is loaded
|
|
1546
1542
|
|
|
1547
1543
|
//this.log.warn('getPersonalizationData: all done, returnng customerStatus: %s', this.customer.customerStatus);
|
|
1548
|
-
resolve(
|
|
1544
|
+
resolve(this.customer); // resolve the promise with the customer object
|
|
1549
1545
|
})
|
|
1550
1546
|
.catch(error => {
|
|
1551
1547
|
let errReason;
|
|
@@ -1629,7 +1625,7 @@ class stbPlatform {
|
|
|
1629
1625
|
this.log.warn('getEntitlements: entitlements found:', this.entitlements.entitlements.length);
|
|
1630
1626
|
}
|
|
1631
1627
|
//his.log('getEntitlements: returning entitlements object');
|
|
1632
|
-
resolve(
|
|
1628
|
+
resolve(this.entitlements); // resolve the promise with the customer object
|
|
1633
1629
|
})
|
|
1634
1630
|
.catch(error => {
|
|
1635
1631
|
let errReason;
|
|
@@ -1743,7 +1739,7 @@ class stbPlatform {
|
|
|
1743
1739
|
|
|
1744
1740
|
});
|
|
1745
1741
|
}
|
|
1746
|
-
resolve(
|
|
1742
|
+
resolve(this.currentRecordingState); // resolve the promise
|
|
1747
1743
|
})
|
|
1748
1744
|
|
|
1749
1745
|
.catch(error => {
|
|
@@ -1871,7 +1867,7 @@ class stbPlatform {
|
|
|
1871
1867
|
|
|
1872
1868
|
});
|
|
1873
1869
|
}
|
|
1874
|
-
resolve(
|
|
1870
|
+
resolve(this.currentRecordingState); // resolve the promise
|
|
1875
1871
|
})
|
|
1876
1872
|
|
|
1877
1873
|
.catch(error => {
|
|
@@ -1923,7 +1919,7 @@ class stbPlatform {
|
|
|
1923
1919
|
this.log.warn('getExperimentalEndpoint: response: %s %s', response.status, response.statusText);
|
|
1924
1920
|
this.log.warn(response.data);
|
|
1925
1921
|
return true
|
|
1926
|
-
//resolve(
|
|
1922
|
+
//resolve(true); // resolve the promise with the customer object
|
|
1927
1923
|
})
|
|
1928
1924
|
.catch(error => {
|
|
1929
1925
|
let errReason;
|
|
@@ -1994,7 +1990,7 @@ class stbPlatform {
|
|
|
1994
1990
|
}
|
|
1995
1991
|
//this.jwtToken = response.data.token; // store the token
|
|
1996
1992
|
mqttUsername = householdId; // used in sendKey to ensure that mqtt is connected
|
|
1997
|
-
resolve(
|
|
1993
|
+
resolve(response.data.token); // resolve with the tokwn
|
|
1998
1994
|
//this.startMqttClient(this, householdId, response.data.token); // this starts the mqtt session
|
|
1999
1995
|
|
|
2000
1996
|
})
|
|
@@ -2057,8 +2053,7 @@ class stbPlatform {
|
|
|
2057
2053
|
// https://github.com/mqttjs/MQTT.js#event-connect
|
|
2058
2054
|
mqttClient.on('connect', function () {
|
|
2059
2055
|
try {
|
|
2060
|
-
parent.log("mqttClient:
|
|
2061
|
-
parent.currentMqttState = mqttState.CONNECTED;
|
|
2056
|
+
parent.log("mqttClient: %s", mqttClient.connected ? 'Connected' : 'Disconnected' ); // Conditional (ternary) operator: condition ? trueValue : FalseValue
|
|
2062
2057
|
parent.mqttClientConnecting = false;
|
|
2063
2058
|
|
|
2064
2059
|
// https://prod.spark.sunrisetv.ch/eng/web/personalization-service/v1/customer/107xxxx_ch/profiles
|
|
@@ -2123,7 +2118,6 @@ class stbPlatform {
|
|
|
2123
2118
|
try {
|
|
2124
2119
|
|
|
2125
2120
|
// store some mqtt diagnostic data
|
|
2126
|
-
parent.currentMqttState = mqttState.CONNECTED; // set to connected on every message received event
|
|
2127
2121
|
parent.lastMqttMessageReceived = Date.now();
|
|
2128
2122
|
|
|
2129
2123
|
let mqttMessage = JSON.parse(message);
|
|
@@ -2372,7 +2366,6 @@ class stbPlatform {
|
|
|
2372
2366
|
mqttClient.on('close', function () {
|
|
2373
2367
|
try {
|
|
2374
2368
|
// mqttDeviceStateHandler(deviceId, powerState, mediaState, recordingState, channelId, eventId, sourceType, profileDataChanged, statusFault, programMode, statusActive, currInputDeviceType, currInputSourceType)
|
|
2375
|
-
parent.currentMqttState = mqttState.CLOSED;
|
|
2376
2369
|
parent.log('mqttClient: Connection closed');
|
|
2377
2370
|
currentSessionState = sessionState.DISCONNECTED; // to force a session reconnect
|
|
2378
2371
|
if (!isShuttingDown) {
|
|
@@ -2390,7 +2383,6 @@ class stbPlatform {
|
|
|
2390
2383
|
mqttClient.on('reconnect', function () {
|
|
2391
2384
|
try {
|
|
2392
2385
|
// mqttDeviceStateHandler(deviceId, powerState, mediaState, recordingState, channelId, eventId, sourceType, profileDataChanged, statusFault, programMode, statusActive, currInputDeviceType, currInputSourceType)
|
|
2393
|
-
parent.currentMqttState = mqttState.RECONNECTED;
|
|
2394
2386
|
parent.log('mqttClient: Reconnect started');
|
|
2395
2387
|
parent.mqttDeviceStateHandler(null, null, null, null, null, null, null, null, Characteristic.StatusFault.GENERAL_FAULT); // set statusFault to GENERAL_FAULT
|
|
2396
2388
|
} catch (err) {
|
|
@@ -2405,7 +2397,6 @@ class stbPlatform {
|
|
|
2405
2397
|
mqttClient.on('disconnect', function () {
|
|
2406
2398
|
try {
|
|
2407
2399
|
// mqttDeviceStateHandler(deviceId, powerState, mediaState, recordingState, channelId, eventId, sourceType, profileDataChanged, statusFault, programMode, statusActive, currInputDeviceType, currInputSourceType)
|
|
2408
|
-
parent.currentMqttState = mqttState.DISCONNECTED;
|
|
2409
2400
|
parent.log('mqttClient: Disconnect command received');
|
|
2410
2401
|
currentSessionState = sessionState.DISCONNECTED; // to force a session reconnect
|
|
2411
2402
|
parent.mqttDeviceStateHandler(null, null, null, null, null, null, null, null, Characteristic.StatusFault.GENERAL_FAULT); // set statusFault to GENERAL_FAULT
|
|
@@ -2421,7 +2412,6 @@ class stbPlatform {
|
|
|
2421
2412
|
mqttClient.on('offline', function () {
|
|
2422
2413
|
try {
|
|
2423
2414
|
// mqttDeviceStateHandler(deviceId, powerState, mediaState, recordingState, channelId, eventId, sourceType, profileDataChanged, statusFault, programMode, statusActive, currInputDeviceType, currInputSourceType)
|
|
2424
|
-
parent.currentMqttState = mqttState.OFFLINE;
|
|
2425
2415
|
parent.log('mqttClient: Client is offline');
|
|
2426
2416
|
currentSessionState = sessionState.DISCONNECTED; // to force a session reconnect
|
|
2427
2417
|
parent.mqttDeviceStateHandler(null, null, null, null, null, null, null, null, Characteristic.StatusFault.GENERAL_FAULT); // set statusFault to GENERAL_FAULT
|
|
@@ -2437,9 +2427,8 @@ class stbPlatform {
|
|
|
2437
2427
|
mqttClient.on('error', function(err) {
|
|
2438
2428
|
try {
|
|
2439
2429
|
// mqttDeviceStateHandler(deviceId, powerState, mediaState, recordingState, channelId, eventId, sourceType, profileDataChanged, statusFault, programMode, statusActive, currInputDeviceType, currInputSourceType)
|
|
2440
|
-
parent.currentMqttState = mqttState.ERROR;
|
|
2441
2430
|
parent.log.warn('mqttClient: Error', (err.syscall || '') + ' ' + (err.code || '') + ' ' + (err.hostname || ''));
|
|
2442
|
-
parent.log.
|
|
2431
|
+
parent.log.debug('mqttClient: Error object:', err);
|
|
2443
2432
|
currentSessionState = sessionState.DISCONNECTED; // to force a session reconnect
|
|
2444
2433
|
parent.mqttDeviceStateHandler(null, null, null, null, null, null, null, null, Characteristic.StatusFault.GENERAL_FAULT); // set statusFault to GENERAL_FAULT
|
|
2445
2434
|
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.1",
|
|
7
7
|
"platformname": "eosstb",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"axios-cookiejar-support": "^4.0.6",
|
|
10
|
-
"axios": "^1.2
|
|
10
|
+
"axios": "^1.3.2",
|
|
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",
|