Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Working INTENTS to use with Community Hass.io Add-ons: Android Debug Bridge for your Nvidia Shield TV

Latest Update 2020-11-05 : Added @clapbr way to add search (Netflix & others) to HA Gui

Credits and thanks: Home Assistant Forum users & Github users: @ocso, @wiphye, @teachingbirds, @tboyce1, @simbesh, @JeffLIrion @ff12 @rebmemer @siaox @DiederikvandenB @Thebuz @clapbr


Starts specific Twitch stream (If stream is live)

{"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d twitch://stream/frenck"}
{"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d twitch://stream/drzzs"}

Start apps on your Shield from Home Assistant

alt text

# Starts Youtube App
{"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n com.google.android.youtube.tv/com.google.android.apps.youtube.tv.activity.ShellActivity"}

# Starts Kodi
{"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n org.xbmc.kodi/.Splash"}

# Starts Twitch
{"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n tv.twitch.android.app/tv.twitch.android.apps.TwitchActivity"}

# Starts Netflix (Shows profiles if its the first start.)
{"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n com.netflix.ninja/.MainActivity"}

# Starts TV4 Play (swedish streaming)
{"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n se.tv4.tv4playtab/se.tv4.tv4play.startup.SplashActivity"}

# Starts SVT Play (swedish streaming)
{"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n se.svt.android.svtplay/se.svt.svtplay.tv.ui.StartupActivity"}

# Starts C More (swedish streaming)
{"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n se.cmore.bonnier/.androidtv.splash.TvConfigurationActivity"}

KILL apps on your Shield from Home Assistant

# Kills YOUTUBE App
{"entity_id" :"media_player.shield", "command": "am force-stop com.google.android.youtube.tv"}

# Kills KODI App
{"entity_id" :"media_player.shield", "command": "am force-stop org.xbmc.kodi"}

# Kills TWITCH App
{"entity_id" :"media_player.shield", "command": "am force-stop tv.twitch.android.app"}

# Kills NETFLIX App
{"entity_id" :"media_player.shield", "command": "am force-stop com.netflix.ninja"}

# Kills SVT PLAY App
{"entity_id" :"media_player.shield", "command": "am force-stop se.svt.android.svtplay"}

# Kills TV4 PLAY App
{"entity_id" :"media_player.shield", "command": "am force-stop se.tv4.tv4playtab"}

# Kills C MORE App
{"entity_id" :"media_player.shield", "command": "am force-stop se.cmore.bonnier"}

Install apps on your Android Device from Home Assistant

Not tested my self, but tips from https://gist.github.com/JeffLIrion

entity_id: media_player.fire_tv_living_room
command: "pm install -r /sdcard/Download/something.apk"

Shield navigation and controlling

RIGHT   {"entity_id" :"media_player.shield", "command": "RIGHT"}
LEFT    {"entity_id" :"media_player.shield", "command": "LEFT"}
UP      {"entity_id" :"media_player.shield", "command": "UP"}
DOWN    {"entity_id" :"media_player.shield", "command": "DOWN"}
WAKE    {"entity_id" :"media_player.shield", "command": "MENU"} # use to be the "WAKEUP" command
SLEEP   {"entity_id" :"media_player.shield", "command": "SLEEP"}
ENTER   {"entity_id" :"media_player.shield", "command": "ENTER"}
BACK    {"entity_id" :"media_player.shield", "command": "BACK"}
HOME    {"entity_id" :"media_player.shield", "command": "HOME"}
PLAY    {"entity_id" :"media_player.shield", "command": "input keyevent 126"}
PAUSE   {"entity_id" :"media_player.shield", "command": "input keyevent 127"}
STOP    {"entity_id" :"media_player.shield", "command": "input keyevent 86"}

Intents i'm not using, but someone could have interest in.

(Not tested by me, but tested by people in the Home Assistant Forum.)

Hulu                {"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n com.hulu.livingroomplus/.MainActivity"}
Live Channels       {"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n com.google.android.tv/com.android.tv.MainActivity"}
Amazon              {"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n com.amazon.amazonvideo.livingroom/com.amazon.ignition.IgnitionActivity"}
SPMC                {"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n com.semperpax.spmc17/.Splash"}
Haystack            {"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n com.haystack.android/.tv.ui.LoadingActivity"}
PBS                 {"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n com.pbs.video/.ui.main.activities.StartupActivity"}
Pluto TV            {"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n tv.pluto.android/.leanback.controller.LeanbackSplashOnboardActivity"}
Spotify             {"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n com.spotify.tv.android/.SpotifyTVActivity" }
HBO Go              {"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n eu.hbogo.androidtv.production/eu.hbogo.androidtv.MainActivity" }
Plex                {"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n com.plexapp.android/com.plexapp.plex.activities.SplashActivity" }
Perfect Player      {"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n com.niklabs.pp/com.niklabs.perfectplayer.MainActivity" }
S0undTV (twtich)    {"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n com.s0und.s0undtv/com.s0und.s0undtv.activities.MainActivity" }
SmartYoutubeTV:     {"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n com.liskovsoft.videomanager/com.liskovsoft.smartyoutubetv.bootstrap.BootstrapActivity" }
Steam Link (start): {"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n com.valvesoftware.steamlink/com.valvesoftware.steamlink.SteamShellActivity" }
Steam Link (stop):  {"entity_id" :"media_player.shield", "command": "am force-stop com.valvesoftware.steamlink" }
Ziggo TV:           {"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n com.ziggo.tv/com.lgi.horizongo.core.activity.splash.SplashActivity" }
Tivimate/ImPlayer:  {"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n ar.tvplayer.tv/.ui.MainActivity" }



### Show local video with KODI 
{"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d file:///storage/emulated/0/Android/data/files/sunrise.mp4 -n org.xbmc.kodi/.Splash"}

###  RTSP stream with VLC
{"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d rtsp://user:password@192.168.1.X:XXX/Streaming/Channels/301 -n org.videolan.vlc/.gui.video.VideoPlayerActivity"}

Intents to change the HDMI input on TVs with Android TV built in (@Thebuz)

HW1-9 Represent various inputs, 1-4 maybe for composite etc. depending on the model of TV

HDMI 1

adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW5 -n org.droidtv.playtv/.PlayTvActivity -f 0x10000000

HDMI 2

adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW6 -n org.droidtv.playtv/.PlayTvActivity -f 0x10000000

HDMI 3

adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW7 -n org.droidtv.playtv/.PlayTvActivity -f 0x10000000

HDMI 4

adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW8 -n org.droidtv.playtv/.PlayTvActivity -f 0x10000000

I got a lot of help from people in this thread: https://community.home-assistant.io/t/android-tv-hdmi/234411/28

ADB command to find out the intent from diffrent apps:

adb shell pm dump org.xbmc.kodi | grep -A 1 "MAIN" | grep org.xbmc.kodi | awk '{print $2}' | grep org.xbmc.kodi

adb shell pm dump tv.twitch.android.app | grep -A 1 "MAIN" | grep tv.twitch.android.app | awk '{print $2}' | grep tv.twitch.android.app

adb shell pm dump se.tv4.tv4playtab | grep -A 1 "MAIN" | grep se.tv4.tv4playtab | awk '{print $2}' | grep se.tv4.tv4playtab

adb shell pm dump se.svt.android.svtplay | grep -A 1 "MAIN" | grep se.svt.android.svtplay | awk '{print $2}' | grep se.svt.android.svtplay

adb shell pm dump com.google.android.youtube.tv | grep -A 1 "MAIN" | grep com.google.android.youtube.tv | awk '{print $2}' | grep com.google.android.youtube.tv

adb shell pm dump com.netflix.ninja | grep -A 1 "MAIN" | grep com.netflix.ninja | awk '{print $2}' | grep com.netflix.ninja

adb shell pm dump se.cmore.bonnier | grep -A 1 "MAIN" | grep se.cmore.bonnier | awk '{print $2}' | grep se.cmore.bonnier


Tested @tboyce1 command on my Shield and this is what i came up with:

(https://community.home-assistant.io/t/community-hass-io-add-on-adb-android-debug-bridge/96375/23)

Run service androidtv.adb_command, provide entity corresponding to your device and then add:

command: "pm list packages | sed -e 's/package://' | while read x; do cmd package resolve-activity --brief $x | tail -n 1 | grep -v 'No activity found'; done"

Or start the consol in the ADB container in Portainer.

(or connect from a pc consol)

adb connect 192.168.xxx.xxx:5555
adb shell

(not tested but might even work on one line) adb shell command when you have more than one android tv on the network.

adb -s 192.168.x.xx shell
pm list packages | sed -e "s/package://" | while read x; do cmd package resolve-activity --brief $x | tail -n 1 | grep -v "No activity found"; done

And got this:

  • de.blinkt.openvpn/.activities.MainActivity
  • com.plexapp.android/com.plexapp.plex.activities.SplashActivity
  • com.nvidia.tegrazone3/.LaunchActivity
  • com.android.documentsui/.LauncherActivity
  • com.plexapp.mediaserver.smb/com.plexapp.mediaserver.ui.main.MainActivity
  • com.spotify.tv.android/.SpotifyTVActivity
  • com.android.vending/com.google.android.finsky.tvmainactivity.TvMainActivity
  • se.viafree.android/com.viafree.android.SplashActivity
  • com.nvidia.inputviewer/.MainActivity
  • tv.emby.embyatv/.startup.StartupActivity
  • se.tv4.tv4playtab/se.tv4.tv4play.startup.SplashActivity
  • com.android.gallery3d/.app.GalleryActivity
  • tv.twitch.android.app/tv.twitch.android.apps.TVLandingActivity
  • com.nvidia.ota/.ui.LauncherActivity
  • org.xbmc.kodi/.Splash
  • pl.solidexplorer2/pl.solidexplorer.SolidExplorer
  • com.google.android.youtube.tv/com.google.android.apps.youtube.tv.activity.ShellActivity
  • com.joaomgcd.join/.activity.ActivityMain
  • com.google.android.tv.remote.service/.settings.SettingsActivity
  • com.netflix.ninja/.MainActivity

My LoveLace Remote Card

alt text

You find all info and code here https://github.com/mcfrojd/hassio_lovelace_multiremote


Credit to @clapbr

Sharing the method I've been using to use the search function on Shield directly from HA/Lovelace. Works well for a bunch of stuff, including Netflix (search example: "Vikings on Netflix")

configuration.yaml

input_text:
  androidtv_search_input:
    name: Android Search

scripts.yaml

'atvsearchscript':
  alias: Android TV Search
  sequence:
  - data_template:
      command: am start -a "android.search.action.GLOBAL_SEARCH" --es query "{{ states('input_text.androidtv_search_input')}}"
      entity_id: media_player.shield
    service: androidtv.adb_command

Lovelace raw

      - entities:
          - entity: input_text.androidtv_search_input
            type: 'custom:text-input-row'
          - action_name: Search Android TV
            icon: 'mdi:television-classic'
            name: ' '
            service: script.atvsearchscript
            type: call-service
@simbesh

This comment has been minimized.

Copy link

@simbesh simbesh commented Feb 15, 2019

Hi @mcfrojd, since you added these intents the package for "smart youtube tv" has changed here is the new working intent for the latest version. I forked your gist, updated the intent and reformatted my 3 intents to be the same as the ones above
for you to easily update:
https://gist.github.com/simbesh/7b714ca25a68eb35f4fdd5c4226dc5aa

@mcfrojd

This comment has been minimized.

Copy link
Owner Author

@mcfrojd mcfrojd commented Feb 26, 2019

Hi @mcfrojd, since you added these intents the package for "smart youtube tv" has changed here is the new working intent for the latest version. I forked your gist, updated the intent and reformatted my 3 intents to be the same as the ones above
for you to easily update:
https://gist.github.com/simbesh/7b714ca25a68eb35f4fdd5c4226dc5aa

Thanks, i have updated my page now :-)

@AndersTao

This comment has been minimized.

Copy link

@AndersTao AndersTao commented Mar 7, 2019

Hi @mcfrojd, are you able to start plex with the intent ?
{ "entity_id": "media_player.shield", "intent": "-n com.plexapp.android/com.plexapp.plex.activities.SplashActivity" }

The only way I have found working with plex, is the monkey command
adb shell monkey -p com.plexapp.android -c android.intent.category.LAUNCHER 1
But I have not found a way to send this command from HA

@jokke72

This comment has been minimized.

Copy link

@jokke72 jokke72 commented Mar 14, 2019

I'm trying to connect from my mac to my nVidia Shield with adb but it says its offline.
I have the latest platform-tools installed. I issued the following commands:

$ adb kill-server
$ adb start-server
$ adb connect 192.168.1.129:5037
failed to connect to 192.168.1.129:5037
$ adb connect 192.168.1.129:5037
already connected to 192.168.1.129:5037
$ adb devices
List of devices attached
192.168.1.129:5037	offline

What should i do that i can get a list of intents on my nVidia Shield?

My Hassio is running on a Ubuntu 18.0.4 LTS server
I have installed ADB - Android Debug Bridge and that is working fine.
I even got the multiremote nVidia part working

@mcfrojd

This comment has been minimized.

Copy link
Owner Author

@mcfrojd mcfrojd commented Mar 21, 2019

Hi @mcfrojd, are you able to start plex with the intent ?
{ "entity_id": "media_player.shield", "intent": "-n com.plexapp.android/com.plexapp.plex.activities.SplashActivity" }

The only way I have found working with plex, is the monkey command
adb shell monkey -p com.plexapp.android -c android.intent.category.LAUNCHER 1
But I have not found a way to send this command from HA

I dont run plex, so i have not tested that command, maybe the new command
{"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n com.plexapp.android/com.plexapp.plex.activities.SplashActivity" } works?

@mcfrojd

This comment has been minimized.

Copy link
Owner Author

@mcfrojd mcfrojd commented Mar 21, 2019

I'm trying to connect from my mac to my nVidia Shield with adb but it says its offline.
I have the latest platform-tools installed. I issued the following commands:

$ adb kill-server
$ adb start-server
$ adb connect 192.168.1.129:5037
failed to connect to 192.168.1.129:5037
$ adb connect 192.168.1.129:5037
already connected to 192.168.1.129:5037
$ adb devices
List of devices attached
192.168.1.129:5037	offline

What should i do that i can get a list of intents on my nVidia Shield?

My Hassio is running on a Ubuntu 18.0.4 LTS server
I have installed ADB - Android Debug Bridge and that is working fine.
I even got the multiremote nVidia part working

I think i saw that you have solved this issue in the community forum?

@mcfrojd

This comment has been minimized.

Copy link
Owner Author

@mcfrojd mcfrojd commented Mar 21, 2019

If you post a question here it might take a while to get an answer, i dont get any notification when someone comments here.
Please contact / include me (@mcfrojd) in a community forum thread instead, then i will get the notification.

@AndersTao

This comment has been minimized.

Copy link

@AndersTao AndersTao commented Mar 22, 2019

Hi @mcfrojd, are you able to start plex with the intent ?
{ "entity_id": "media_player.shield", "intent": "-n com.plexapp.android/com.plexapp.plex.activities.SplashActivity" }

The only way I have found working with plex, is the monkey command
adb shell monkey -p com.plexapp.android -c android.intent.category.LAUNCHER 1
But I have not found a way to send this command from HA

Update
To keep all information togethere, this is my working script, to launch plex on my shield
HA 0.91
ADB 0.3.0

script:
  adb_open_plex:
    sequence:
      - service: androidtv.adb_command
        data:
          entity_id: media_player.shield
          command: "monkey -p com.plexapp.android -c android.intent.category.LAUNCHER 1"
@qingdong830

This comment has been minimized.

Copy link

@qingdong830 qingdong830 commented Mar 27, 2019

you can also use Tasker to perform intent, use mqtt as tunnel instead of adb

@garywilson4

This comment has been minimized.

Copy link

@garywilson4 garywilson4 commented Apr 6, 2019

is there a problem with this now i used to have it working now it doesn't

- id: '1554543074146'
  alias: Frenck Streaming
  trigger:
  - entity_id: sensor.frenck
    from: offline
    platform: state
    to: streaming
  condition:
  - after: 07:00:00
    before: '23:00:00'
    condition: time
  action:
  - data:
      command: am start -a android.intent.action.VIEW -d twitch://stream/frenck
      entity_id: media_player.firetv_1
    service: androidtv.adb_command 

this is my automation. Like i say it worked when i first set it up now i get nothing
i've also tried just calling the service and nothing there either

@kaijk

This comment has been minimized.

Copy link

@kaijk kaijk commented Apr 16, 2019

Here's an entity-button card example I'm using to turn on Plex (or whatever) based on either of my two FireTV instances:

              - type: custom:card-modder
                style:
                  background-color: rgba(56,60,69,1)
                  border-radius: 20px
                  border: solid 3px rgba(118,185,0,1)
                  box-shadow: 3px 3px rgba(0,0,0,0.4)
                card:
                  type: custom:config-template-card
                  variables:
                    - states['input_select.firetv_choices'].state
                  entities:
                    - input_select.firetv_choices
                  card:
                    type: custom:hui-entity-button-card # add "custom:" "hui-" and "-card" fore and aft of standard card names for the config-template-card
                    entity: "${vars[0] === 'FireTV Living Room' ? 'media_player.firetv_living_room' : 'media_player.firetv_bedroom'}"
                    icon: mdi:plex
                    name: PLEX
                    hold_action: none
                    tap_action:
                      action: call-service
                      service: androidtv.adb_command
                      service_data:
                        command: "monkey -p com.plexapp.android -c android.intent.category.LAUNCHER 1"
@mcfrojd

This comment has been minimized.

Copy link
Owner Author

@mcfrojd mcfrojd commented Apr 18, 2019

@garywilson4 Im not sure, and have not tested my self, but maybe try to add "-n" after "-d"

@mcfrojd

This comment has been minimized.

Copy link
Owner Author

@mcfrojd mcfrojd commented Apr 18, 2019

Updated the Twitch intent since a upgrade of the twitch app made the old one stop working.

@mcfrojd

This comment has been minimized.

Copy link
Owner Author

@mcfrojd mcfrojd commented Apr 18, 2019

Regarding Plex, i dont run plex my self so i have not been testing those intents out.

@j1mmyjones

This comment has been minimized.

Copy link

@j1mmyjones j1mmyjones commented May 19, 2019

Hello Complete noob to android intent here. After playing with it for a few hours i finally got it to work and its awesome. Iwas wondering if there is an intent to start HD Homerun app on shield tv? Can someone please share with me?

GOT IT!!! I Run this as a script and it loads everytime

`shield_hdhr:
alias: "HD HomeRun"
sequence:

  • service: androidtv.adb_command
    data:
    entity_id: media_player.nvidia_shield
    command: 'am start --user 0 -n "com.silicondust.view/.App"'`
@mcfrojd

This comment has been minimized.

Copy link
Owner Author

@mcfrojd mcfrojd commented Jun 12, 2019

The command/intent you have for plex wasn't working for me. It kept showing the Plex splash screen and then crashing.
This is working for me:
{"entity_id": "media_player.nvidia_shield", "command": "am start -a android.intent.action.VIEW -d -n com.plexapp.android/com.plexapp.plex.activities.SplashActivity"}

That is the same that i have execpt for the entity_id

@onkytonk

This comment has been minimized.

Copy link

@onkytonk onkytonk commented Jun 12, 2019

The command/intent you have for plex wasn't working for me. It kept showing the Plex splash screen and then crashing.
This is working for me:
{"entity_id": "media_player.nvidia_shield", "command": "am start -a android.intent.action.VIEW -d -n com.plexapp.android/com.plexapp.plex.activities.SplashActivity"}

That is the same that i have execpt for the entity_id

Deleted my comment. I don't know why but when I first tried your intent, I changed the entity ID, and it still wasn't working. I copied something from the forums, and it worked. Thanks though!

@s3frank

This comment has been minimized.

Copy link

@s3frank s3frank commented Jun 15, 2019

How would you access settings for sound using ADB? I am trying to figure out how to change the Surround mode using a command as I sometimes need it to be on "Always" and sometimes on "Auto". I would love to know how to do this via an ADB command so I can fully automate this. Thanks for any and all hints in advance!

@fourtrax01

This comment has been minimized.

Copy link

@fourtrax01 fourtrax01 commented Nov 10, 2019

Anyone know the intent for launching pandora? Even better to launch it to a certain station?

@Mikii67

This comment has been minimized.

Copy link

@Mikii67 Mikii67 commented Nov 17, 2019

Hi there. Is there a way to change the Bravia's network settings over adb? Thank you.

@mcfrojd

This comment has been minimized.

Copy link
Owner Author

@mcfrojd mcfrojd commented Nov 18, 2019

How would you access settings for sound using ADB? I am trying to figure out how to change the Surround mode using a command as I sometimes need it to be on "Always" and sometimes on "Auto". I would love to know how to do this via an ADB command so I can fully automate this. Thanks for any and all hints in advance!

Im sorry but i am not a very good ADB user, all the info posted above is either my "trial & error" attempts or someone else's contribution.

@mcfrojd

This comment has been minimized.

Copy link
Owner Author

@mcfrojd mcfrojd commented Nov 18, 2019

Hi there. Is there a way to change the Bravia's network settings over adb? Thank you.

Im sorry but i am not a very good ADB user, all the info posted above is either my "trial & error" attempts or someone else's contribution.

@mcfrojd

This comment has been minimized.

Copy link
Owner Author

@mcfrojd mcfrojd commented Nov 18, 2019

Anyone know the intent for launching pandora? Even better to launch it to a certain station?

I dont have Pandora, but you might be able to use the command examples above to figure that out. (edit to match pandora app)
(https://gist.github.com/mcfrojd/9e6875e1db5c089b1e3ddeb7dba0f304#adb-command-to-find-out-the-intent-from-diffrent-apps)

@mcfrojd

This comment has been minimized.

Copy link
Owner Author

@mcfrojd mcfrojd commented Dec 28, 2019

Added info about the streaming channel C More

@empenoso

This comment has been minimized.

Copy link

@empenoso empenoso commented Dec 31, 2019

This is a lot of work! Thanks!

@lukasilestam

This comment has been minimized.

Copy link

@lukasilestam lukasilestam commented Feb 4, 2020

Is it possible to control Shield TV via http without adb?

@rapedapeda

This comment has been minimized.

Copy link

@rapedapeda rapedapeda commented Feb 7, 2020

I have the same setup with the shield. So thanks for all the helpful intents! I am wondering if it would be possible to turn off the tv (screen) with a command from home-assistant. So, shield keeps playing (spotify, for instance) over my speakers (not tv speakers), but the tv turns off? The triggers etc are fine to put in an automation, but I cannot wrap my head around a function to disable/turn off the tv screen.

@mcfrojd

This comment has been minimized.

Copy link
Owner Author

@mcfrojd mcfrojd commented Feb 7, 2020

Is it possible to control Shield TV via http without adb?

Not that i know of.

@mcfrojd

This comment has been minimized.

Copy link
Owner Author

@mcfrojd mcfrojd commented Feb 7, 2020

I have the same setup with the shield. So thanks for all the helpful intents! I am wondering if it would be possible to turn off the tv (screen) with a command from home-assistant. So, shield keeps playing (spotify, for instance) over my speakers (not tv speakers), but the tv turns off? The triggers etc are fine to put in an automation, but I cannot wrap my head around a function to disable/turn off the tv screen.

Probably depends on your tv.
I run a Broadlink RM mini 3 to control my TV and cant control it via the ADB and android tv way.
And since i run my audio optically from my tv to my sonos bar i would loose sound if i turned of the tv.

@mcfrojd

This comment has been minimized.

Copy link
Owner Author

@mcfrojd mcfrojd commented Mar 22, 2020

Added some commands to kill your running app on the Shield.
Some apps (ex twitch) if you are running a stream, and then change to another app (ex youtube) with the ADB command, the twitch stream will continue to run in the twitch app, so next time you start twitch, that stream will still be on.

@JeffLIrion

This comment has been minimized.

Copy link

@JeffLIrion JeffLIrion commented Mar 22, 2020

Can you add this command to install an APK:

entity_id: media_player.fire_tv_living_room
command: "pm install -r /sdcard/Download/something.apk"

Source: https://developer.android.com/studio/command-line/adb#pm

@jriker1

This comment has been minimized.

Copy link

@jriker1 jriker1 commented Apr 4, 2020

OK so I took the service image above under developer tools and tested it out with my NVidia Shield.

Put in androidtv.adb_command for the service

Put in media_player.family_room_nvidia_shield for the entity

For Service Data put in the whole block: {"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n com.google.android.youtube.tv/com.google.android.apps.youtube.tv.activity.ShellActivity"}

Sure enough my NVidia changed to YouTutbe.

Trying to duplicate that in my Lovelace code.

So when I do:

                tap_action:
                  action: call-service
                  service: androidtv.adb_command
                  service_data:
                    command: 'am start -a android.intent.action.VIEW -d -n com.google.android.youtube.tv/com.google.android.apps.youtube.tv.activity.ShellActivity'

OR even the full intent with the entity_id and all if that's the right term it keeps telling me data missing. Thoughts?

JR

@mcfrojd

This comment has been minimized.

Copy link
Owner Author

@mcfrojd mcfrojd commented Apr 4, 2020

it keeps telling me data missing.

Heres what i used before:

tap_action:
  action: call-service
  service: androidtv.adb_command
  service_data:
    entity_id: media_player.shield
    command: "am start -a android.intent.action.VIEW -d -n com.google.android.youtube.tv/com.google.android.apps.youtube.tv.activity.ShellActivity"

@DoubleAmperSand

This comment has been minimized.

Copy link

@DoubleAmperSand DoubleAmperSand commented May 2, 2020

When using ADB commands to handle navigation is there anyway to eliminate the lag between button presses ?
for instance if you navigate through a Plex library pressing left and right multiple times results in delayed presses with a delay between the presses often I will have to stop and wait for it to catch up it make navigation painfully slow and unusable.

@mcfrojd

This comment has been minimized.

Copy link
Owner Author

@mcfrojd mcfrojd commented May 4, 2020

When using ADB commands to handle navigation is there anyway to eliminate the lag between button presses ?
for instance if you navigate through a Plex library pressing left and right multiple times results in delayed presses with a delay between the presses often I will have to stop and wait for it to catch up it make navigation painfully slow and unusable.

Not that i know of.

@pplucky

This comment has been minimized.

Copy link

@pplucky pplucky commented Jul 17, 2020

On both my Amazon FireStick 4K, Youtube intent seems to have changed from "com.google.android.youtube.tv/com.google.android.apps.youtube.tv.activity.ShellActivity" to "com.amazon.firetv.youtube/dev.cobalt.app.MainActivity". Can you please check?

@mcfrojd

This comment has been minimized.

Copy link
Owner Author

@mcfrojd mcfrojd commented Jul 20, 2020

On both my Amazon FireStick 4K, Youtube intent seems to have changed from "com.google.android.youtube.tv/com.google.android.apps.youtube.tv.activity.ShellActivity" to "com.amazon.firetv.youtube/dev.cobalt.app.MainActivity". Can you please check?

Im sorry but i dont own any amazon device.

@CaptainSweatpants

This comment has been minimized.

Copy link

@CaptainSweatpants CaptainSweatpants commented Jul 22, 2020

I hate to be the guy asking for intent answers as i like to figure things out myself; but I’m trying to get the launch intents for com.disney.disneyplus: "Disney +"
ca.bellmedia.cravetv: "Crave TV"
com.amazon.amazonvideo.livingroom: "Amazon Prime Video"

but I’m having trouble getting the intent with the command listed above under “ ADB command to find out the intent from diffrent apps: “

Is this run through HA’s Service tab in dev tools? Because its not returning any result no matter what i try.

Appreciate any assistance.

@pplucky

This comment has been minimized.

Copy link

@pplucky pplucky commented Jul 22, 2020

Is this run through HA’s Service tab in dev tools? Because its not returning any result no matter what i try.

Yes, it can be.

Run service androidtv.adb_command, provide entity corresponding to your device and then add:
command: "pm list packages | sed -e 's/package://' | while read x; do cmd package resolve-activity --brief $x | tail -n 1 | grep -v 'No activity found'; done"

This works perfectly on my FireStick 4K and I get a list of intents for the installed apps, in attribute adb_response for the entity corresponding to your device (same you used above in the service call).

@pplucky

This comment has been minimized.

Copy link

@pplucky pplucky commented Jul 22, 2020

On both my Amazon FireStick 4K, Youtube intent seems to have changed from "com.google.android.youtube.tv/com.google.android.apps.youtube.tv.activity.ShellActivity" to "com.amazon.firetv.youtube/dev.cobalt.app.MainActivity". Can you please check?

Can anyone please confirm?

@HappySl0th

This comment has been minimized.

Copy link

@HappySl0th HappySl0th commented Jul 23, 2020

Has anybody have the adb command to open Blue Iris?

@rebmemer

This comment has been minimized.

Copy link

@rebmemer rebmemer commented Sep 2, 2020

Should anyone want/need it, the intents to start/stop Steam Link;

Start;
"am start -a android.intent.action.VIEW -d -n com.valvesoftware.steamlink/com.valvesoftware.steamlink.SteamShellActivity"

Stop;
"am force-stop com.valvesoftware.steamlink"

@mcfrojd

This comment has been minimized.

Copy link
Owner Author

@mcfrojd mcfrojd commented Sep 3, 2020

Should anyone want/need it, the intents to start/stop Steam Link;

Start;
"am start -a android.intent.action.VIEW -d -n com.valvesoftware.steamlink/com.valvesoftware.steamlink.SteamShellActivity"

Stop;
"am force-stop com.valvesoftware.steamlink"

Added to the list :-)

@Jovink

This comment has been minimized.

Copy link

@Jovink Jovink commented Sep 6, 2020

Has anybody have the adb command to open Ziggo go (dutch televison)

@arifroni

This comment has been minimized.

Copy link

@arifroni arifroni commented Sep 8, 2020

does anybody know what is the command to 'locate remote' function for Nvidia shield pro 2019?

@JeffLIrion

This comment has been minimized.

Copy link

@JeffLIrion JeffLIrion commented Sep 8, 2020

does anybody know what is the command to 'locate remote' function for Nvidia shield pro 2019?

https://amp.reddit.com/r/homeassistant/comments/i50115/nvidia_shield_remote_locator/

@labaland

This comment has been minimized.

Copy link

@labaland labaland commented Sep 24, 2020

adb command for to open a channel on IPTV app would be AWESOME! ( Tivimate / ImPlayer) The best 2 apps for iptv!

@ChalidNL

This comment has been minimized.

Copy link

@ChalidNL ChalidNL commented Sep 24, 2020

Does anyone of you know if it is possible to get this working in Hassio:

If I press the power button on my Firestick Remote it should trigger an automation to turn on the TV.

I have my tv working with broadlink and its fine but I want make use of the remote and my tv is to old.
Could this work or not?

@arifroni

This comment has been minimized.

Copy link

@arifroni arifroni commented Sep 24, 2020

Does anyone of you know if it is possible to get this working in Hassio:

If I press the power button on my Firestick Remote it should trigger an automation to turn on the TV.

I have my tv working with broadlink and its fine but I want make use of the remote and my tv is to old.
Could this work or not?

your TV doesn't turn on by the fire stick?
if you can control your TV from home assistant, you can make an automation:
if fire stick is active>>turn on TV
but i fire stick turning on/off TV with HDMI CEC is a better option.

@ChalidNL

This comment has been minimized.

Copy link

@ChalidNL ChalidNL commented Sep 24, 2020

Does anyone of you know if it is possible to get this working in Hassio:
If I press the power button on my Firestick Remote it should trigger an automation to turn on the TV.
I have my tv working with broadlink and its fine but I want make use of the remote and my tv is to old.
Could this work or not?

your TV doesn't turn on by the fire stick?
if you can control your TV from home assistant, you can make an automation:
if fire stick is active>>turn on TV
but i fire stick turning on/off TV with HDMI CEC is a better option.

Thanks for the suggestion. I liked the idea but I need to investage a bit more. I have read that the remote of the Firestick is RF one. Now I have a sonoff rf bridge but he is not able to receive the signal I think it is not on the 433 freq. Anyways. More investigation is needed. Thanks

@Thebuz

This comment has been minimized.

Copy link

@Thebuz Thebuz commented Oct 18, 2020

Intents to change the HDMI input on TVs with Android TV built in

HW1-9 Represent various inputs, 1-4 maybe for composite etc. depending on the model of TV

HDMI 1
adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW5 -n org.droidtv.playtv/.PlayTvActivity -f 0x10000000

HDMI 2
adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW6 -n org.droidtv.playtv/.PlayTvActivity -f 0x10000000

HDMI 3
adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW7 -n org.droidtv.playtv/.PlayTvActivity -f 0x10000000

HDMI 4
adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW8 -n org.droidtv.playtv/.PlayTvActivity -f 0x10000000

I got a lot of help from people in this thread:
https://community.home-assistant.io/t/android-tv-hdmi/234411/28

@DiederikvandenB

This comment has been minimized.

Copy link

@DiederikvandenB DiederikvandenB commented Oct 20, 2020

@Jovink This works for me:

am start -a android.intent.action.VIEW -d -n com.ziggo.tv/com.lgi.horizongo.core.activity.splash.SplashActivity

As far as I can tell, there is no way to select a specific channel.

@Jovink

This comment has been minimized.

Copy link

@Jovink Jovink commented Oct 20, 2020

@Jovink This works for me:

am start -a android.intent.action.VIEW -d -n com.ziggo.tv/com.lgi.horizongo.core.activity.splash.SplashActivity

As far as I can tell, there is no way to select a specific channel.
Thank you! Indeed it is working but only if my Shield is on.

@siaox

This comment has been minimized.

Copy link

@siaox siaox commented Oct 22, 2020

Hi thanks for the write up - been using it everyday.

Thought id just add the adb shell command when you have more than one android tv on the network.

adb -s 192.168.x.xx shell

@siaox

This comment has been minimized.

Copy link

@siaox siaox commented Oct 22, 2020

adb command for to open a channel on IPTV app would be AWESOME! ( Tivimate / ImPlayer) The best 2 apps for iptv!

am start -a android.intent.action.VIEW -d -n ar.tvplayer.tv/.ui.MainActivity

I use the adb command to open the app but then use the Logitech Harmony to input the numbers - works pretty well so far.

But an intent would be super easy!!

@clapbr

This comment has been minimized.

Copy link

@clapbr clapbr commented Nov 4, 2020

Sharing the method I've been using to use the search function on Shield directly from HA/Lovelace. Works well for a bunch of stuff, including Netflix (search example: "Vikings on Netflix")

configuration.yaml

input_text:
  androidtv_search_input:
    name: Android Search

scripts.yaml

'atvsearchscript':
  alias: Android TV Search
  sequence:
  - data_template:
      command: am start -a "android.search.action.GLOBAL_SEARCH" --es query "{{ states('input_text.androidtv_search_input')}}"
      entity_id: media_player.shield
    service: androidtv.adb_command

Lovelace raw

      - entities:
          - entity: input_text.androidtv_search_input
            type: 'custom:text-input-row'
          - action_name: Search Android TV
            icon: 'mdi:television-classic'
            name: ' '
            service: script.atvsearchscript
            type: call-service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.