Hi James,
I got an error message, when trying to use this service. When looking in developer tools, I don’t find it neither. Any suggestions ?
When going into developer tools, my android device can’t be chosen. Any other ideas ?
By the way, when I use
service: remote.turn_on
data:
activity: il.co.yes.yesplus
target:
entity_id: remote.androidtv_living
I’m getting to the app, but it doesn’t open it. Any ideas how to achieve this ?
Have you installed ADB integration? The one above should be the entity is gets, which typically has the device IP address in it or are you using Android TV?. If not it’s super easy to setup. It’s documented below. If you were using the add on that was deprecated then you have to install it as a.n integration or use the new add on which sounds like it has to manually be added to install. My Sony TV didn’t have network debugging as an option but just enabling USB debugging worked, which is actually kind of shady by Google because they are two different things.
You should also see a learnsendevent service. Also I forgot about of the fun key event options.
Instant BT pairing
input keyevent 225
Screenshot
screencap -p /storage/emulated/0/DuneHD/HDMI_Input/screenshot.png
You should see the below services if it’s installed. I don’t think the learn send event has worked in a long time but used to make it easier to figure out
Yeah, the remote domain is for Android TV remote integration .I never really used it but I installed it a while ago and just checked and the domain is remote and not media_player like ADB
In the past I used the bridge which was quite slow related to the arrows. In the Android TV remote integration, it’s almost instant. So wondering if I can have both integrations running at the same time on one android device. Does this work for you ? I’ll test it tomorrow early morning as the tv is now currently been used.
Sure, write the scripts or whatever that is slow in ADB using Android TV remote and others that can’t be done using remote using ADB. There are zero issues using them both at once. If you wanted to write say, an automation/script you could use .ADB to launch an app then use remote if you want to do some auto navigation using the remote integration. I’ve always felt ADB to be quicker but there are several ways to say, move the direction pad up and to be fair, I tried remote when it first came out and thought ADB was better and never used it again so it could be way faster now for navigation then ADB is. That’s one of the best things about HA, multiple ways to accomplish something and you get to pick what works best for you.
If it’s remote then it’s remote if it’s ADB, it’s ADB, if it’s sending IR commands through say, the Logitech integration then use that. Some things, particularly done through direct IP control vary from setup to setup. For example, my android devices are wired, wireless may slow them down due to latency or network gear and setup. Everyone doesn’t have the option to hard wire all their devices and latency will always be worse over WiFi then Ethernet.
My TV and the setup box are both hardwired. And effectively things change…
I restarted working again on it after a long period of time. I changed setup boxes from an IR driven box to an android box and didn’t felt the need (too much other stuff to do). However, I had already created the outline of a remote in the past (styling and stuff).
So I tried the androidtv.adb_command
service, works like a charm, however media_player.select_source
doesn’t work at all. Not sure why ?
Also the sendevent
commands unfortunately don’t work for me. Again not clear why ?
Regarding the LearnSendEvent command, it works, or should, but it comes up under notifications. For some reason I forgot this and expected it to just pop up on the services screen but it doesn’t. You will see the notification if it works. It makes the command long but it’s much faster, I also thought this was lost when ADB server was deprecated and removed. There used to be an add on, but now only the python implementation.
Regarding the select_source, I would need to see the yaml you are using. Should work, also verify the app id in android by going to settings, apps, the selecting the app where you can force stop it, clear cache, ect… and make sure it’s using that app id.
Found this, great list, I had looked forever for it, was liked in the HA docs.
Oh, mentioning the docs, I think it was the custom state detection rules that don’t work with Python but I could be wrong
service: androidtv.adb_command
data:
command: “sendevent /dev/input/event2 20 0 0 && sendevent /dev/input/event2 20 1 0 && sendevent /dev/input/event2 4 4 786498 && sendevent /dev/input/event2 1 103 1 && sendevent /dev/input/event2 0 0 0 && sendevent /dev/input/event2 4 4 786498 && sendevent /dev/input/event2 1 103 0 && sendevent /dev/input/event2 0 0 0”
target:
entity_id: media_player.android_tv_192_168_0_62
When sending commands like UP, DOWN, HOME, etc. via ADB, the device can be slow to respond. The problem isn’t ADB, but rather the Android command
input
that is used to perform those actions. A faster way to send these commands is using the Androidsendevent
command. The challenge is that these commands are device-specific.
Okay, easier way, connect via ADB from a computer. If Windows then intall WSL (windows subsystem for Linux) or if you are running Linux then you are obviously good to go. Install ADB “sudo apt install adb” then connect to the device via IP “adb connect 192.168.0.xx:5555” after that run the below. Just check trust like when configuring ADB on HA.
pm list packages | sed -e “s/package://” | while read x; do cmd package resolve-activity --brief $x | tail -n 1 | grep -v "No
This will list all the intents installed on that device, for example then use that’s the ADB commands. Also way faster
Netflix
service: androidtv.adb_command
data:
command: am start -a android.intent.action.VIEW -n com.netflix.ninja/.MainActivity
target:
entity_id: media_player.android_tv_192_168_0_27
HBO Max
service: androidtv.adb_command
data:
command: >-
am start -a android.intent.action.VIEW -n
com.wbd.stream/com.wbd.beam.BeamActivity
target:
entity_id: media_player.android_tv_192_168_0_27
Example output from above command
source_list: com.android.systemui, com.google.android.ext.services, com.android.providers.media.module, com.nvidia.blakepairing, com.dolby.android.audio.service, com.nvidia.shieldtech.accessoryui, com.nvidia.shield.remote.server, com.nvidia.osc, com.nvidia.app.messaging, flar2.homebutton, com.anydesk.anydeskandroid, com.nvidia.tegrazone3:PersonalGridService, com.nvidia.tegrazone3:telemetry, com.nvidia.shield.ask, com.google.process.gservices, com.google.android.inputmethod.latin, com.google.android.tv.remote.service, com.google.android.gms.persistent, com.android.providers.tv, com.google.android.gms, Live Channels, ar.tvplayer.tv, Android TV Launcher, it.rainet.androidtv, Google Cast, com.gaditek.purevpnics, com.gaditek.purevpnics:openvpn, com.google.android.permissioncontroller, Play Store, com.nvidia.ota, com.google.android.tvrecommendations, com.google.android.katniss:interactor
volume_level: 1
is_volume_muted: false
app_id: ar.tvplayer.tv
app_name: ar.tvplayer.tv
source: ar.tvplayer.tv
adb_response: com.apkmirror.helper.prod/com.apkmirror.presentation.start.StartActivity
com.plexapp.android/com.plexapp.plex.activities.SplashActivity
android/com.android.internal.app.ResolverActivity
com.nvidia.tegrazone3/com.nvidia.tegrazone.MainActivity
com.android.documentsui/.LauncherActivity
com.lonelycatgames.Xplore/.Browser
com.gaditek.purevpnics/com.purevpn.SplashActivity
com.plexapp.mediaserver.smb/com.plexapp.mediaserver.ui.main.MainActivity
com.android.vending/com.google.android.finsky.tvmainactivity.TvMainActivity
com.tcl.browser/.portal.home.activity.HomePageActivity
ar.tvplayer.tv/.ui.MainActivity
com.nst.iptvsmarterstvbox/.view.activity.SplashActivity
com.google.android.apps.tachyon/.MainActivity
com.nvidia.inputviewer/.AccessorySelectionActivity
com.mytv.stb.emu.tu/com.mvas.stbemu.activities.MainActivity
com.iptvstreamplayer.IPTVStreamPlayer/crc645bc3e740440b3816.MainActivity
com.google.android.youtube.tvmusic/com.google.android.apps.youtube.tvmusic.activity.MainActivity
com.android.gallery3d/.app.GalleryActivity
com.nvidia.ota/.ui.LauncherActivity
com.iqiyi.i18n.tv/.launch.LaunchActivity
flar2.homebutton/a.a
com.anydesk.anydeskandroid/.gui.activity.MainActivity
com.limelight/.PcView
com.google.android.youtube.tv/com.google.android.apps.youtube.tv.activity.ShellActivity
com.google.android.tv.remote.service/.settings.SettingsActivity
com.tvwebbrowser.v22/.MainActivity
com.netflix.ninja/.MainActivity
hdmi_input: null
device_class: tv
entity_picture: /api/media_player_proxy/media_player.nvidia?token=830388f9a03296bc464c1f533f0bc030b2b9b4cfc1cc7609da264b8c8c0dfcf3&cache=1674400958.010054
friendly_name: Nvidia Shield
supported_features: 23997
Thank you for your reply. I got the sendevent message correctly in the notification sector, but when I put it into a command, it doesn’t do anything.
I’ll try this later today. Will spin up a linux VM on my pve and see what it does…
Thank you for all your responses.
Once I have done this, how would a adb_command look like ?
When I ran the command on a linux VM after connected to device, I’m getting the following
Not sure where to go from here ?
I have a lot off apps that doe not have the icon automatically added.
At this moment I have added some standard mdi icons, but I’m wondering if it is possible to create my own svg icons. and where to put them.
some examples I need:
FilmPlus:
icon: mdi:filmstrip
videoland:
icon: mdi:monitor
hbomax:
icon: mdi:betamax
Yes, use image instead of icon. There may be some formats that need something from HACs but png icons work with zero issues without installing anything, possible other formats. I think most format can simply be opened then do a “save as” and change the extension to png. Small icons like 25x25 or 50x50 works out good, preferably transparent, although I think HA does some scaling so non square images will get the sides cut off. I know I had to install something for FAS icons from HACs under the Lovelace category. Flaticon is a great site and has png and svg options for existing ones like Netflix
You have to place them in the www folder or subdirectory underneath
In the ui-lovelace.yaml.or yaml editor for non Lovelace you reference local for the path and any subdirectories if needed. Below is an example from my setup with the png files being underneath www. You.could possibly place them other places using the allowlist_external_dirs option in configuration.yaml but I never had much luck using that method.
EDIT: updated to show mini-media-plqyer card from HACs. For Android TV remote use app is instead of the below id you use this custom card. So Spotify would be com.spotify.tv.android . That or go all out and create them inside HA using the the Swiss Army Knife Custom Card if you got the time and skills for animation among other granular customization
Non custom card or dashboard code editor (I love the kikabit custom theme but it sucks for editing text)
- entity: media_player.android_tv_192_168_0_62
type: custom:mini-media-player
artwork: cover
source: all
hide:
volume: false
shortcuts:
columns: 4 # Max buttons per row
buttons:
- image: /local/icons8-netflix-desktop-app-64.png
type: source
id: Netflix
# Change the source to Kodi
- image: /local/icons8-kodi-200.png
type: source
id: Kodi
- image: /local/icons8-youtube-squared-100.png
type: source
id: YouTube
- image: /local/icons8-spotify-100.png
type: source
id: Spotify
# columns: 4 # Max buttons per row
# buttons:
- image: /local/vnc-updated.png
type: source
id: com.realvnc.viewer.android
- image: /local/plex.png
type: source
id: Plex
- image: /local/icons8-remote-desktop-96.png
type: source
id: com.microsoft.rdc.androidx
- image: /local/totalcomander.png
type: source
id: pl.solidexplorer2
- image: /local/justplayer.png
type: source
id: com.brouken.player
- image: /local/Google-Play-Transparent.png
type: source
id: com.android.vending
- image: /local/Raspbery-pi.png
type: source
id: de.eidottermihi.raspicheck
- image: /local/Speedtest.png
type: source
id: com.rma.netpulsetv
The Android TV remote card is hard coded for the mdi and SVG icons which overrides anything you specify in yaml so you would have to manually change the JavaScript file in www/community/android-tv-card (see below for Netflix). Below is a line where I opened the js file and searched for Netflix.
action:“source”,source:“netflix://”},icon:“mdi:netflix”},paramount:{tap_action
It also appears some are svg files but you could easily mess something up so take a backup of that file if you want to try changing some icons. That way you can always get back to where you were at. There are zero results when searching for png though but SVG icons exist.
{action:“source”,source:“videoland-v2://”},icon:n.svg.videoland},vudu:{tap_action:{action:“source”,source:“vuduapp://”},icon:n.svg.vudu},youtube:{tap_action
If you create a new card and just add some entities it works like below. The Android TV remote card was written in a way to make it easy to setup with and uses specific mdi or SVG icons. Unless you know how to manually update the JavaScript file, which will get overwritten if there is an update, then it won’t work for that specific custom card. I primarily used png images but with some custom cards it’s not possible without manually updating the custom card. If the icons weren’t specified in the js file then nothing would have icons.
EDIT: after reading the docs you can change mdi icons (not sure about SVG in the custom actions portion but when using image like above it didn’t work on this particular custom card.
title: Sony Android TV
custom_actions:
youtube:
icon: mdi:mailbox-open-outline
rows:
As you can see the mailbox is now the YouTube icon. Also might be doable via json but I’m not a fan of json personally.
The code part
,disney:{tap_action:{action:"source",source:"https://www.disneyplus.com"},icon:n.svg.disney}
is linked with this part:
t.disney="M2.056 6.834C1.572 6.834 1 6.77 1 6.483c0-2.023 3.562-2.11 5.08-2.11c1.978 0 4.506.614 6.66 1.384c3.277 1.188 9.917 5.145 9.917 9.674c0 4.001-4.31 5.914-8.311 5.914a22 22 0 0 1-3.21-.33c-.066.243-.11.418-.264.924a4.3 4.3 0 0 1-.77.087l-.505-.043c-.33-.396-.44-1.033-.572-1.715c-2-1.165-3.298-2.155-3.891-2.836c-.506-.528-1.078-1.232-1.078-1.913c0-.351.22-.66.726-1.01c1.034-.77 2.352-1.188 4.507-1.563l.044-.9c.022-.22.242-2.573.748-3.013c.813.66.901 1.341.967 2.353c.022.44.044.901.11 1.385h.308c1.539 0 6.244.395 6.244 2.616c0 .528-.77 1.517-1.518 1.517a1.9 1.9 0 0 1-.966-.285c.329-.375.813-.704.945-.99c-.44-.528-2.814-1.143-4.551-1.143a4 4 0 0 0-.572.022l.022 4.815c.703.44 1.561.483 2.11.483c2.42 0 7.431-.417 7.431-4.331c0-3.87-4.946-6.86-8.64-8.266a21.4 21.4 0 0 0-7.937-1.496a7.2 7.2 0 0 0-1.803.198c-.373.088-.505.176-.505.264c0 .153.747.242.836.286a.22.22 0 0 1 .11.175a.26.26 0 0 1-.088.176c-.089 0-.286.022-.528.022M9.2 14.551c-2.176.177-4.595.397-4.595 1.166c0 .594 1.012 1.32 1.627 1.781a7.05 7.05 0 0 0 2.77 1.319zm11.155-9.85c-.02.428-.042.942-.042 1.723c0 .3 0 .642.01 1.027c-.042.193-.32.214-.46.278a1.2 1.2 0 0 1-.256-.192V4.83c0-.29.01-.588.01-1.038c0-.225 0-.482-.01-.792c0-.192.032-.374.15-.802a.34.34 0 0 1 .3-.224c.245.064.491.17.577.374c-.257.76-.235 1.594-.279 2.353m-.384-.085c.428.021.941.042 1.722.042c.3 0 .643 0 1.027-.01c.193.041.215.32.279.459q-.078.141-.193.257H20.1c-.289 0-.589-.01-1.037-.01c-.225 0-.482 0-.792.01c-.193.002-.375-.03-.803-.149a.35.35 0 0 1-.225-.299c.064-.246.172-.492.374-.578c.76.257 1.595.235 2.355.278z"
I understand that this is the SVG code,
Do you have any Idea how to create this? I found some svg > Javascript converters online, those generate something that looks similar but doesn’t work
APP Link for TiviMate:
With the suggested change of using ADB to deeplink to an app. Does anyone know if it is now possible to deeplink to “TiviMate”? I know it has been mentioned in this thread last year that the developer did not support deep linking, however I am curious to see if anyone knows of a workaround?
This is what ADB currently gives me:
With my STB I can access jellyfin and VLC by below given links. YMMV.
JellyFin: org.jellyfin.androidtv
VLC: org.videolan.vlc