homebridge-quickline-tv 0.0.0-stage → 1.3.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/CHANGELOG.md +64 -0
- package/LICENSE +21 -0
- package/README.md +140 -2
- package/bin/find-link.js +96 -0
- package/bin/pair.js +56 -0
- package/bin/send.js +118 -0
- package/config.schema.json +227 -0
- package/index.js +7 -0
- package/lib/apps.js +26 -0
- package/lib/connection.js +165 -0
- package/lib/keys.js +54 -0
- package/lib/platform.js +296 -0
- package/lib/proto/remotemessage.proto +459 -0
- package/lib/remote.js +161 -0
- package/package.json +42 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.3.3
|
|
4
|
+
- Neue Option „Alle getesteten Apps“ (`"apps": ["all"]`).
|
|
5
|
+
|
|
6
|
+
## 1.3.2
|
|
7
|
+
- Play Suisse im App-Katalog (`https://www.playsuisse.ch/de/show`).
|
|
8
|
+
- README: ADB-Anleitung zeigt auch die Pfade, die manche Apps verlangen.
|
|
9
|
+
|
|
10
|
+
## 1.3.1
|
|
11
|
+
- KiKA im App-Katalog (`ardkika://kika.de/`, mit dem Link-Finder gefunden).
|
|
12
|
+
- Link-Finder probiert zusätzlich Links mit Adresse und Schrägstrich (z.B. `name://name.ch/`).
|
|
13
|
+
|
|
14
|
+
## 1.3.0
|
|
15
|
+
- App-Katalog: Apps in den Einstellungen anhaken statt Links abtippen (Netflix, YouTube, Prime Video, Play SRF, Sky, ZDFtivi, Toggo; ungetestet: Disney+, Spotify, Plex).
|
|
16
|
+
- Eingang „Quickline“ ist immer dabei.
|
|
17
|
+
- Neues Werkzeug `bin/find-link.js`: findet den Deep Link einer App automatisch.
|
|
18
|
+
- README mit Anleitung „Neue App hinzufügen“ und GitHub-Vorlagen für App-Meldungen und Fehler.
|
|
19
|
+
|
|
20
|
+
## 1.2.1
|
|
21
|
+
- Test-Werkzeug: `wait <Sekunden>` für langsam startende Apps.
|
|
22
|
+
|
|
23
|
+
## 1.2.0
|
|
24
|
+
- Eingang „Quickline“ öffnet die Quickline-App direkt über `content://ch.quickline.tv.uhd` (per ADB aus der App ausgelesen).
|
|
25
|
+
- Senderwahl öffnet zuerst Quickline und tippt dann die Sendernummer.
|
|
26
|
+
|
|
27
|
+
## 1.1.4
|
|
28
|
+
- Tasten mit Codes ausserhalb der offiziellen Android-Liste können gesendet werden (Betreiber-Tasten).
|
|
29
|
+
|
|
30
|
+
## 1.1.3
|
|
31
|
+
- Test-Werkzeug: Suchlauf `scan` findet den Tastencode, der Quickline öffnet.
|
|
32
|
+
- Tastennamen DIGIT_1 bis DIGIT_9.
|
|
33
|
+
|
|
34
|
+
## 1.1.2
|
|
35
|
+
- Eingang „Live TV“ heisst jetzt „Quickline“.
|
|
36
|
+
- Neues Test-Werkzeug `bin/send.js`, um Tasten und App-Links direkt an die Box zu schicken.
|
|
37
|
+
- Weitere Tastennamen: ESCAPE, LAST_CHANNEL, TV_INPUT, DVR, LIVE_TV.
|
|
38
|
+
|
|
39
|
+
## 1.1.1
|
|
40
|
+
- Apps starten über Deep Links (`https://www.youtube.com`, `https://www.netflix.com/title`) statt über Play-Store-Links; die Quickline-Box trennt bei `market://`-Links die Verbindung.
|
|
41
|
+
- Live TV nutzt standardmässig die TV-Taste und wird an der Quickline-App erkannt.
|
|
42
|
+
|
|
43
|
+
## 1.1.0
|
|
44
|
+
- Eigene, robuste Verbindung zur Box statt der Verbindung aus `androidtv-remote`:
|
|
45
|
+
- mehrere oder lange Nachrichten pro Datenpaket werden korrekt verarbeitet (vorher blieb die Verbindung hängen)
|
|
46
|
+
- Fehlermeldungen der Box oder unlesbare Pakete bringen die Child Bridge nicht mehr zum Absturz
|
|
47
|
+
- genau eine Verbindung mit automatischem Wiederverbinden
|
|
48
|
+
- `androidtv-remote` wird nur noch für die Kopplung verwendet.
|
|
49
|
+
|
|
50
|
+
## 1.0.3
|
|
51
|
+
- Unvollständige Eingänge aus der Konfiguration werden ignoriert; bleibt keiner übrig, gelten die Standard-Eingänge.
|
|
52
|
+
- Eingänge werden beim Start im Log aufgelistet.
|
|
53
|
+
|
|
54
|
+
## 1.0.2
|
|
55
|
+
- „TV-Einstellungen anzeigen“ öffnet die Einstellungen der Box.
|
|
56
|
+
- Eingänge lassen sich in der Home-App ein- und ausblenden.
|
|
57
|
+
- Ein/Aus-Zustand der Box wird im Log angezeigt.
|
|
58
|
+
|
|
59
|
+
## 1.0.1
|
|
60
|
+
- Live TV startet direkt die Quickline-App (`ch.quickline.tv.uhd`) und wird in Apple Home als aktiver Eingang erkannt.
|
|
61
|
+
- Senderwahl öffnet Live TV nur, wenn es nicht schon läuft.
|
|
62
|
+
|
|
63
|
+
## 1.0.0
|
|
64
|
+
- Erste Version: Ein/Aus, Eingänge (Live TV, Apps, Lieblingssender), Fernbedienung, Lautstärke/Stumm.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 homebridge-quickline-tv contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,141 @@
|
|
|
1
|
-
#
|
|
1
|
+
# homebridge-quickline-tv
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Bringt die **Quickline TV-Box** (Android TV, Sagemcom M387_QL) als TV-Gerät in Apple Home:
|
|
4
|
+
|
|
5
|
+
- Ein/Aus, auch in Szenen und Automationen
|
|
6
|
+
- Eingänge: **Quickline** (Live TV), **Apps** aus einem Katalog zum Anhaken und **Lieblingssender** per Sendernummer
|
|
7
|
+
- Fernbedienung im iPhone-Kontrollzentrum (Pfeile, OK, Zurück, Play/Pause, Info)
|
|
8
|
+
- Lautstärke und Stummschalten über die Lautstärketasten des iPhones
|
|
9
|
+
- Sender hoch/runter über die Vor-/Zurück-Tasten der Fernbedienung im Kontrollzentrum
|
|
10
|
+
|
|
11
|
+
Das Plugin spricht das **Android-TV-Remote-Protokoll**, wie die Google-TV-App auf dem Handy.
|
|
12
|
+
Auf der Box muss dafür nichts freigeschaltet werden.
|
|
13
|
+
|
|
14
|
+
## Voraussetzungen
|
|
15
|
+
|
|
16
|
+
- Quickline TV-Box mit Android TV (getestet mit der Sagemcom M387_QL)
|
|
17
|
+
- Homebridge 1.6 oder neuer (auch 2.x), Node.js 18.15 oder neuer
|
|
18
|
+
- Box und Homebridge im selben Netzwerk
|
|
19
|
+
- Eine feste IP-Adresse für die Box (im Router reservieren)
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
Das Plugin ist noch nicht in der Homebridge-Suche veröffentlicht. Bis dahin installierst du es direkt von GitHub,
|
|
24
|
+
im Homebridge-Terminal (bei Docker; sonst `sudo npm install -g` mit derselben Adresse):
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
cd /homebridge && npm install --save https://github.com/Protodjango/homebridge-quickline-tv/archive/refs/heads/main.tar.gz
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Einrichten
|
|
31
|
+
|
|
32
|
+
In den Befehlen unten steht `<IP-der-Box>` für die IP-Adresse deiner Quickline-Box, zum Beispiel `192.168.1.100`.
|
|
33
|
+
Ersetze den Platzhalter samt spitzen Klammern durch deine Adresse.
|
|
34
|
+
|
|
35
|
+
1. **Plugin konfigurieren:** In den Plugin-Einstellungen eine Box hinzufügen, Name und IP-Adresse eintragen,
|
|
36
|
+
Apps anhaken und auf Wunsch Lieblingssender eintragen. Speichern und Homebridge neu starten.
|
|
37
|
+
2. **Koppeln (einmalig):** Fernseher und Box einschalten. Im Homebridge-Log steht ein Befehl wie
|
|
38
|
+
```bash
|
|
39
|
+
node "/homebridge/node_modules/homebridge-quickline-tv/bin/pair.js" <IP-der-Box> "/var/lib/homebridge/quickline-tv"
|
|
40
|
+
```
|
|
41
|
+
Diesen im Homebridge-Terminal ausführen und den Code eingeben, der auf dem Fernseher erscheint.
|
|
42
|
+
Homebridge verbindet sich danach innert ca. 10 Sekunden von selbst.
|
|
43
|
+
3. **In Apple Home hinzufügen:** Home-App → **+** → *Gerät hinzufügen* → *Weitere Optionen…* →
|
|
44
|
+
das Gerät mit dem **Fernseher-Symbol** wählen. Der Code dafür steht im Log in der Zeile
|
|
45
|
+
`Please add [… ] manually in Home app. Setup Code: …`.
|
|
46
|
+
Läuft das Plugin als Child Bridge, erscheint ein zweiter Eintrag mit Punkte-Symbol. Den braucht es nicht.
|
|
47
|
+
|
|
48
|
+
## App-Katalog
|
|
49
|
+
|
|
50
|
+
Die Quickline-Box startet Apps **nur über einen Deep Link**. Play-Store-Links (`market://…`) lehnt sie ab.
|
|
51
|
+
Darum bringt das Plugin einen Katalog mit erprobten Links mit. In den Einstellungen hakst du an, was du installiert hast,
|
|
52
|
+
oder wählst **„Alle getesteten Apps“** (in der `config.json`: `"apps": ["all"]`):
|
|
53
|
+
|
|
54
|
+
| App | Link | Status |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| Quickline | `content://ch.quickline.tv.uhd` | ✅ immer dabei |
|
|
57
|
+
| Netflix | `https://www.netflix.com/title` | ✅ getestet |
|
|
58
|
+
| YouTube | `https://www.youtube.com` | ✅ getestet |
|
|
59
|
+
| Prime Video | `https://app.primevideo.com` | ✅ getestet |
|
|
60
|
+
| Play Suisse | `https://www.playsuisse.ch/de/show` | ✅ getestet (öffnet ggf. die Anmeldeseite) |
|
|
61
|
+
| Play SRF | `playsrf://home` | ✅ getestet |
|
|
62
|
+
| Sky | `sky-ch-tv://entry-point` | ✅ getestet |
|
|
63
|
+
| ZDFtivi | `zdftivi://` | ✅ getestet |
|
|
64
|
+
| Toggo | `toggo://` | ✅ getestet |
|
|
65
|
+
| KiKA | `ardkika://kika.de/` | ✅ getestet |
|
|
66
|
+
| Disney+ | `https://www.disneyplus.com` | ❔ ungetestet |
|
|
67
|
+
| Spotify | `spotify://` | ❔ ungetestet |
|
|
68
|
+
| Plex | `plex://` | ❔ ungetestet |
|
|
69
|
+
|
|
70
|
+
Bisher **ohne funktionierenden Link**: blue TV, YouTube Music. Hinweise sind willkommen.
|
|
71
|
+
|
|
72
|
+
## Neue App hinzufügen
|
|
73
|
+
|
|
74
|
+
Steht eine App nicht im Katalog, trägst du sie unter **Eigene Eingänge** mit Name und App-Link ein.
|
|
75
|
+
So findest du den Link:
|
|
76
|
+
|
|
77
|
+
1. **Bekannte Links nachschlagen:** Viele Links sind im
|
|
78
|
+
[Home-Assistant-Leitfaden zu App-Links](https://community.home-assistant.io/t/android-tv-remote-app-links-deep-linking-guide/567921) gesammelt.
|
|
79
|
+
2. **Link-Finder:** Öffne die App einmal von Hand auf der Box. Im Homebridge-Log steht dann `Aktuelle App: <Paketname>`.
|
|
80
|
+
Danach im Homebridge-Terminal, mit dem Paketnamen und einem Stichwort (meist der App-Name):
|
|
81
|
+
```bash
|
|
82
|
+
node /homebridge/node_modules/homebridge-quickline-tv/bin/find-link.js <IP-der-Box> /var/lib/homebridge/quickline-tv com.plexapp.android plex
|
|
83
|
+
```
|
|
84
|
+
Das Werkzeug probiert typische Links durch (`plex://`, `plex://home`, `https://app.plex.tv`, …) und meldet den,
|
|
85
|
+
mit dem die App startet. Eigene Vermutungen kannst du am Ende anhängen. Tipp: Manche Apps brauchen eine
|
|
86
|
+
Adresse samt Schrägstrich hinter dem `://`, KiKA zum Beispiel `ardkika://kika.de/`.
|
|
87
|
+
3. **Per ADB auslesen** (für Fortgeschrittene): Auf der Box unter Geräteeinstellungen → Info 7× auf „Build“ klicken,
|
|
88
|
+
in den Entwickleroptionen USB-Debugging einschalten, dann am PC:
|
|
89
|
+
```bash
|
|
90
|
+
adb connect <IP-der-Box>:5555
|
|
91
|
+
adb shell dumpsys package <Paketname> | grep -E "Scheme:|Authority:|Path:"
|
|
92
|
+
```
|
|
93
|
+
Die Ausgabe zeigt die Link-Bestandteile, auf die die App reagiert. Stehen dort `Path:`-Zeilen, braucht der Link
|
|
94
|
+
diesen Pfad, bei Play Suisse etwa `https://www.playsuisse.ch/de/show`. Zum Testen:
|
|
95
|
+
```bash
|
|
96
|
+
node /homebridge/node_modules/homebridge-quickline-tv/bin/send.js <IP-der-Box> /var/lib/homebridge/quickline-tv link "plex://" wait 8
|
|
97
|
+
```
|
|
98
|
+
USB-Debugging danach wieder ausschalten.
|
|
99
|
+
|
|
100
|
+
**Funktionierenden Link gefunden?** Melde ihn bitte als
|
|
101
|
+
[Issue auf GitHub](https://github.com/Protodjango/homebridge-quickline-tv/issues), mit App-Name, Paketname und Link.
|
|
102
|
+
Dann kommt er in den Katalog der nächsten Version.
|
|
103
|
+
|
|
104
|
+
## Beispiel `config.json`
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"platform": "QuicklineTV",
|
|
109
|
+
"name": "Quickline TV",
|
|
110
|
+
"devices": [
|
|
111
|
+
{
|
|
112
|
+
"name": "Quickline TV",
|
|
113
|
+
"host": "192.168.1.100",
|
|
114
|
+
"apps": ["netflix", "youtube", "playsrf", "sky"],
|
|
115
|
+
"inputs": [
|
|
116
|
+
{ "name": "Plex", "type": "app", "appLink": "plex://", "package": "com.plexapp.android" }
|
|
117
|
+
],
|
|
118
|
+
"channels": [
|
|
119
|
+
{ "name": "SRF 1", "number": 1 },
|
|
120
|
+
{ "name": "SRF zwei", "number": 2 }
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Die Sendernummern sind die aus deiner Quickline-Senderliste.
|
|
128
|
+
|
|
129
|
+
## Tipps & Grenzen
|
|
130
|
+
|
|
131
|
+
- **Ein/Aus** ist eine Umschalttaste. Weicht der Zustand einmal ab, korrigiert er sich beim nächsten Statusupdate der Box.
|
|
132
|
+
- **Lautstärke** regelt, was die Box regelt. Ist die Quickline-Fernbedienung auf deinen Fernseher eingerichtet
|
|
133
|
+
(HDMI-CEC), ist es dessen Lautstärke.
|
|
134
|
+
- **Neue oder umbenannte Eingänge** übernimmt die Home-App manchmal erst, wenn man das Gerät entfernt und neu hinzufügt.
|
|
135
|
+
- Tasten für eigene Eingänge: `HOME, BACK, MENU, INFO, GUIDE, SETTINGS, CHANNEL_UP, CHANNEL_DOWN, DPAD_CENTER, MEDIA_PLAY_PAUSE`
|
|
136
|
+
oder eine Android-Keycode-Nummer.
|
|
137
|
+
|
|
138
|
+
## Danksagung
|
|
139
|
+
|
|
140
|
+
Die Protokolldefinition (`lib/proto/remotemessage.proto`) und die Kopplung stammen aus
|
|
141
|
+
[androidtv-remote](https://github.com/louis49/androidtv-remote) von louis49 (MIT-Lizenz).
|
package/bin/find-link.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Link-Finder: probiert typische Deep Links für eine App durch und meldet den, mit dem sie startet.
|
|
6
|
+
*
|
|
7
|
+
* node bin/find-link.js <IP> <Speicherordner> <Paketname> <Stichwort> [eigene Links ...]
|
|
8
|
+
* node bin/find-link.js <IP-der-Box> /var/lib/homebridge/quickline-tv com.plexapp.android plex
|
|
9
|
+
*
|
|
10
|
+
* Den Paketnamen zeigt das Homebridge-Log als „Aktuelle App: …“, wenn die App auf der Box läuft.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const { RemoteClient } = require('../lib/remote');
|
|
14
|
+
const { loadCert } = require('../lib/connection');
|
|
15
|
+
|
|
16
|
+
const QUICKLINE_LINK = 'content://ch.quickline.tv.uhd';
|
|
17
|
+
const QUICKLINE_APP = 'ch.quickline.tv.uhd';
|
|
18
|
+
|
|
19
|
+
const [host, storageDir, pkg, word, ...extra] = process.argv.slice(2);
|
|
20
|
+
if (!host || !storageDir || !pkg || !word) {
|
|
21
|
+
console.log('Aufruf: node bin/find-link.js <IP> <Speicherordner> <Paketname> <Stichwort> [eigene Links ...]');
|
|
22
|
+
console.log('Beispiel: node bin/find-link.js <IP-der-Box> /var/lib/homebridge/quickline-tv com.plexapp.android plex');
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const cert = loadCert(storageDir, host);
|
|
27
|
+
if (!cert) {
|
|
28
|
+
console.log(`Kein Zertifikat in ${storageDir} gefunden – zuerst koppeln (bin/pair.js).`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const w = word.toLowerCase();
|
|
33
|
+
const candidates = [...new Set([
|
|
34
|
+
...extra,
|
|
35
|
+
`${w}://`, `${w}://home`, `${w}://start`, `${w}://main`, `${w}://open`,
|
|
36
|
+
`${w}tv://`, `${w}-tv://`, `${w}tv://home`,
|
|
37
|
+
`${w}://${w}.ch/`, `${w}://${w}.de/`, `${w}://${w}.com/`, `${w}://home/`,
|
|
38
|
+
`https://www.${w}.com`, `https://app.${w}.com`, `https://${w}.com`, `https://tv.${w}.com`,
|
|
39
|
+
`https://www.${w}.tv`, `https://app.${w}.tv`, `https://${w}.tv`,
|
|
40
|
+
`https://www.${w}.ch`, `https://app.${w}.ch`, `https://www.${w}.de`,
|
|
41
|
+
])];
|
|
42
|
+
|
|
43
|
+
const log = { debug: () => {}, info: () => {}, warn: () => {}, error: () => {} };
|
|
44
|
+
const wait = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
45
|
+
|
|
46
|
+
/** Verbindet, öffnet Quickline, schickt den Link und wartet, welche App startet. */
|
|
47
|
+
function tryLink(link) {
|
|
48
|
+
return new Promise((resolve) => {
|
|
49
|
+
const client = new RemoteClient(host, 6466, cert, log);
|
|
50
|
+
let app = '';
|
|
51
|
+
let done = false;
|
|
52
|
+
const finish = (result) => {
|
|
53
|
+
if (done) return;
|
|
54
|
+
done = true;
|
|
55
|
+
client.close();
|
|
56
|
+
resolve(result);
|
|
57
|
+
};
|
|
58
|
+
client.on('app', (a) => {
|
|
59
|
+
app = a;
|
|
60
|
+
if (a === pkg) finish('ok');
|
|
61
|
+
});
|
|
62
|
+
client.on('close', () => finish('abgelehnt'));
|
|
63
|
+
client.on('ready', async () => {
|
|
64
|
+
await wait(800);
|
|
65
|
+
if (app !== QUICKLINE_APP) {
|
|
66
|
+
client.sendAppLink(QUICKLINE_LINK);
|
|
67
|
+
await wait(4000);
|
|
68
|
+
}
|
|
69
|
+
try { client.sendAppLink(link); } catch (_) { finish('ungültig'); return; }
|
|
70
|
+
await wait(9000);
|
|
71
|
+
finish(app && app !== QUICKLINE_APP ? `öffnet ${app}` : 'nichts');
|
|
72
|
+
});
|
|
73
|
+
setTimeout(() => finish('keine Antwort'), 25000);
|
|
74
|
+
client.connect();
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
(async () => {
|
|
79
|
+
console.log(`Suche einen Link für ${pkg} (${candidates.length} Kandidaten, ca. ${Math.ceil(candidates.length * 15 / 60)} Minuten) …\n`);
|
|
80
|
+
for (const link of candidates) {
|
|
81
|
+
process.stdout.write(`${link} → `);
|
|
82
|
+
const result = await tryLink(link);
|
|
83
|
+
console.log(result === 'ok' ? 'FUNKTIONIERT' : result);
|
|
84
|
+
if (result === 'ok') {
|
|
85
|
+
console.log(`\n*** Gefunden! Trag in den Plugin-Einstellungen unter „Eigene Eingänge“ ein:`);
|
|
86
|
+
console.log(` App-Link: ${link}`);
|
|
87
|
+
console.log(` Paketname: ${pkg}`);
|
|
88
|
+
console.log(`Funktioniert er, melde ihn gern auf GitHub, damit er in den App-Katalog kommt.`);
|
|
89
|
+
process.exit(0);
|
|
90
|
+
}
|
|
91
|
+
await wait(1500);
|
|
92
|
+
}
|
|
93
|
+
console.log('\nKein Link gefunden. Eigene Vermutungen kannst du am Ende des Befehls anhängen, z.B. "plex://library".');
|
|
94
|
+
console.log('Oder per ADB die Links der App auslesen (siehe README).');
|
|
95
|
+
process.exit(0);
|
|
96
|
+
})();
|
package/bin/pair.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Koppelt Homebridge mit der Quickline TV-Box.
|
|
6
|
+
* Aufruf: node bin/pair.js <IP-der-Box> [Speicherordner]
|
|
7
|
+
* Standard-Speicherordner: ~/.homebridge/quickline-tv
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const os = require('os');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const readline = require('readline');
|
|
13
|
+
const { loadLib, saveCert, certPath } = require('../lib/connection');
|
|
14
|
+
|
|
15
|
+
async function main() {
|
|
16
|
+
const host = process.argv[2];
|
|
17
|
+
const storageDir = process.argv[3] || path.join(os.homedir(), '.homebridge', 'quickline-tv');
|
|
18
|
+
if (!host) {
|
|
19
|
+
console.log('Aufruf: node bin/pair.js <IP-der-Box> [Speicherordner]');
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const { AndroidRemote } = await loadLib();
|
|
24
|
+
const remote = new AndroidRemote(host, {
|
|
25
|
+
pairing_port: 6467,
|
|
26
|
+
remote_port: 6466,
|
|
27
|
+
service_name: 'Homebridge Quickline',
|
|
28
|
+
cert: {},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
32
|
+
|
|
33
|
+
remote.on('secret', () => {
|
|
34
|
+
rl.question('Code, der jetzt auf dem Fernseher angezeigt wird: ', (code) => {
|
|
35
|
+
remote.sendCode(code.trim().toUpperCase());
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
remote.on('ready', () => {
|
|
40
|
+
saveCert(storageDir, host, remote.getCertificate());
|
|
41
|
+
console.log(`\nGekoppelt! Zertifikat gespeichert in ${certPath(storageDir, host)}`);
|
|
42
|
+
console.log('Homebridge verbindet sich innert ca. 10 Sekunden automatisch.');
|
|
43
|
+
rl.close();
|
|
44
|
+
setTimeout(() => process.exit(0), 500);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
remote.on('error', (err) => console.error('Fehler:', err && err.message ? err.message : err));
|
|
48
|
+
|
|
49
|
+
console.log(`Verbinde mit ${host} … (Box und Fernseher müssen eingeschaltet sein)`);
|
|
50
|
+
await remote.start();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
main().catch((err) => {
|
|
54
|
+
console.error('Kopplung fehlgeschlagen:', err.message);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
});
|
package/bin/send.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Test-Werkzeug: schickt Tasten oder App-Links an die gekoppelte Box und zeigt, welche App danach läuft.
|
|
6
|
+
*
|
|
7
|
+
* node bin/send.js <IP> <Speicherordner> HOME
|
|
8
|
+
* node bin/send.js <IP> <Speicherordner> 111 BACK
|
|
9
|
+
* node bin/send.js <IP> <Speicherordner> link https://www.youtube.com wait 6
|
|
10
|
+
* node bin/send.js <IP> <Speicherordner> scan [von] [bis] – sucht die Taste, die Quickline öffnet
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const { RemoteClient } = require('../lib/remote');
|
|
14
|
+
const { loadCert } = require('../lib/connection');
|
|
15
|
+
const { resolveKey } = require('../lib/keys');
|
|
16
|
+
|
|
17
|
+
const [host, storageDir, ...args] = process.argv.slice(2);
|
|
18
|
+
if (!host || !storageDir || args.length === 0) {
|
|
19
|
+
console.log('Aufruf: node bin/send.js <IP> <Speicherordner> <Taste|Keycode|link URL> [...]');
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const cert = loadCert(storageDir, host);
|
|
24
|
+
if (!cert) {
|
|
25
|
+
console.log(`Kein Zertifikat in ${storageDir} gefunden – zuerst koppeln (bin/pair.js).`);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const log = { debug: () => {}, info: console.log, warn: console.log, error: console.log };
|
|
30
|
+
const client = new RemoteClient(host, 6466, cert, log);
|
|
31
|
+
const wait = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
32
|
+
|
|
33
|
+
let currentApp = '';
|
|
34
|
+
client.on('app', (app) => { currentApp = app; if (!scanning) console.log(` → aktuelle App: ${app}`); });
|
|
35
|
+
let scanning = false;
|
|
36
|
+
|
|
37
|
+
const YOUTUBE = 'com.google.android.youtube.tv';
|
|
38
|
+
const QUICKLINE = 'ch.quickline.tv.uhd';
|
|
39
|
+
// Nicht getestet: Ein/Aus, Schlafmodus, Lautstärke, Anrufe, Kamera, Sprachassistent, TV-Eingänge, Helligkeit
|
|
40
|
+
const SKIP = new Set([5, 6, 24, 25, 26, 27, 84, 91, 164, 177, 178, 219, 220, 221, 223, 224, 225, 231, 276]);
|
|
41
|
+
for (let k = 230; k <= 258; k += 1) SKIP.add(k);
|
|
42
|
+
|
|
43
|
+
async function scan(from, to) {
|
|
44
|
+
scanning = true;
|
|
45
|
+
console.log(`Suchlauf über die Tastencodes ${from}–${to}. Das dauert einige Minuten …`);
|
|
46
|
+
for (let code = from; code <= to; code += 1) {
|
|
47
|
+
if (SKIP.has(code)) continue;
|
|
48
|
+
if (currentApp !== YOUTUBE) {
|
|
49
|
+
client.sendAppLink('https://www.youtube.com');
|
|
50
|
+
await wait(3500);
|
|
51
|
+
}
|
|
52
|
+
if (code % 20 === 0) console.log(` … bei Code ${code}`);
|
|
53
|
+
lastCode = code;
|
|
54
|
+
const before = currentApp;
|
|
55
|
+
try {
|
|
56
|
+
client.sendKey(code);
|
|
57
|
+
} catch (_) {
|
|
58
|
+
continue; // Code kennt das Protokoll nicht
|
|
59
|
+
}
|
|
60
|
+
await wait(1500);
|
|
61
|
+
if (currentApp !== before) {
|
|
62
|
+
console.log(` Code ${code}: App gewechselt zu ${currentApp}`);
|
|
63
|
+
if (currentApp === QUICKLINE) {
|
|
64
|
+
console.log(`\n*** GEFUNDEN: Tastencode ${code} öffnet Quickline ***`);
|
|
65
|
+
client.close();
|
|
66
|
+
process.exit(0);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
console.log('Suchlauf beendet, kein Code hat Quickline geöffnet.');
|
|
71
|
+
client.close();
|
|
72
|
+
process.exit(0);
|
|
73
|
+
}
|
|
74
|
+
client.on('power', (on) => console.log(` → Box ist ${on ? 'an' : 'aus'}`));
|
|
75
|
+
let lastCode = 0;
|
|
76
|
+
client.on('close', () => {
|
|
77
|
+
console.log('Verbindung geschlossen.');
|
|
78
|
+
if (scanning) console.log(`Weitermachen mit: ... scan ${lastCode + 1}`);
|
|
79
|
+
process.exit(0);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
client.on('ready', async () => {
|
|
83
|
+
await wait(800);
|
|
84
|
+
if (args[0] === 'scan') {
|
|
85
|
+
clearTimeout(noAnswer);
|
|
86
|
+
await scan(Number(args[1]) || 1, Number(args[2]) || 304);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
90
|
+
if (args[i] === 'wait') {
|
|
91
|
+
const sec = Number(args[i + 1]) || 5;
|
|
92
|
+
i += 1;
|
|
93
|
+
await wait(sec * 1000);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (args[i] === 'link') {
|
|
97
|
+
const url = args[i + 1];
|
|
98
|
+
i += 1;
|
|
99
|
+
console.log(`Sende Link: ${url}`);
|
|
100
|
+
client.sendAppLink(url);
|
|
101
|
+
} else {
|
|
102
|
+
const code = resolveKey(args[i]);
|
|
103
|
+
if (code === undefined) {
|
|
104
|
+
console.log(`Unbekannte Taste: ${args[i]}`);
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
console.log(`Sende Taste: ${args[i]} (${code})`);
|
|
108
|
+
client.sendKey(code);
|
|
109
|
+
}
|
|
110
|
+
await wait(2500);
|
|
111
|
+
}
|
|
112
|
+
client.close();
|
|
113
|
+
process.exit(0);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
console.log(`Verbinde mit ${host} …`);
|
|
117
|
+
client.connect();
|
|
118
|
+
const noAnswer = setTimeout(() => { console.log('Keine Antwort von der Box.'); process.exit(1); }, 20000);
|