feat: add Moonlight and SmartTube app support
This commit is contained in:
@@ -56,11 +56,17 @@ apps: # remote.turn_on activity:... items
|
||||
color: "#244dd7"
|
||||
activity: org.jellyfin.androidtv
|
||||
app_id: org.jellyfin.androidtv
|
||||
- id: moonlight
|
||||
icon: mdi:moon-waning-crescent
|
||||
color: "#5c6bc0"
|
||||
activity: com.limelight
|
||||
app_id: com.limelight
|
||||
- id: smarttube
|
||||
icon: mdi:youtube
|
||||
color: "#ff0000"
|
||||
activity: org.smarttube.stable
|
||||
app_id: org.smarttube.stable, org.smarttube.beta, app.smarttube
|
||||
sources: # media_player.select_source items
|
||||
- id: playstation
|
||||
icon: mdi:sony-playstation
|
||||
color: "#0070d1"
|
||||
source: PS5 Game Console
|
||||
```
|
||||
|
||||
All keys except `entities.tv` and `entities.remote` are optional — omit `apps`
|
||||
@@ -75,7 +81,7 @@ or `sources` to hide the row, omit `power_script` to fall back to
|
||||
| `icon` | yes | MDI icon (e.g. `mdi:spotify`) |
|
||||
| `color` | no | Hex string for the icon tint and active-pill background |
|
||||
| `activity` | yes | Value passed to `remote.turn_on activity:` on `entities.remote` |
|
||||
| `app_id` | no | Matched against `media_player.<adb>.app_id` to set the active-state highlight |
|
||||
| `app_id` | no | Matched against `media_player.<adb>.app_id` to set the active-state highlight. Use comma-separated IDs when an app has multiple package variants. |
|
||||
|
||||
When you tap an app entry the card also fires `media_player.select_source` on
|
||||
`entities.tv` with `source: <shield_source>` so the TV switches back to the
|
||||
|
||||
Vendored
+3
-3
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ha-tv-remote",
|
||||
"version": "1.6.0",
|
||||
"version": "1.7.0",
|
||||
"private": true,
|
||||
"description": "Mobile-friendly TV remote Lovelace card for Home Assistant",
|
||||
"scripts": {
|
||||
|
||||
+10
-2
@@ -1,4 +1,4 @@
|
||||
const VERSION = "1.5.2";
|
||||
const VERSION = "1.7.0";
|
||||
|
||||
const POWER_POLL_THROTTLE_MS = 800;
|
||||
const POWER_POLL_POST_TOGGLE_DELAYS = [1500, 3500, 6000];
|
||||
@@ -254,7 +254,7 @@ class TvRemoteCard extends HTMLElement {
|
||||
const srcMatch = this._config.sources.find(s => s.source === tvSource);
|
||||
if (srcMatch) activeId = srcMatch.id;
|
||||
else if (adbAppId) {
|
||||
const appMatch = this._config.apps.find(a => a.app_id === adbAppId);
|
||||
const appMatch = this._config.apps.find(a => this._matchesAppId(a, adbAppId));
|
||||
if (appMatch) activeId = appMatch.id;
|
||||
}
|
||||
for (const el of this.shadowRoot.querySelectorAll(".app")) {
|
||||
@@ -314,6 +314,14 @@ class TvRemoteCard extends HTMLElement {
|
||||
this._setScreenOn(true);
|
||||
}
|
||||
|
||||
_matchesAppId(item, appId) {
|
||||
return String(item.app_id || "")
|
||||
.split(",")
|
||||
.map(id => id.trim())
|
||||
.filter(Boolean)
|
||||
.includes(appId);
|
||||
}
|
||||
|
||||
_launchItem(item) {
|
||||
this._wakeScreen();
|
||||
if (item.kind === "source") {
|
||||
|
||||
Reference in New Issue
Block a user