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

Updated 2019-03-21 with new "intents" since hassio 0.90, ADB 0.3.0 and the new androidtv component (service "androidtv.adb_command")

Credits and thanks: Home Assistant Forum users: @ocso, @wiphye, @teachingbirds, @tboyce1, @simbesh, @JeffLIrion


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

# 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 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 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 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"}

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" }

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


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)

Started the consol in the ADB container in Portainer.

adb 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

@simbesh

This comment has been minimized.

Copy link

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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!

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.