Home Assistant Community Add-on: ADB - Android Debug Bridge

Thanx, it works!!!

And thanx to @teachingbirds for the remote code (from Github)!

It works here with this config

service: media_player.androidtv_key
  data:
    entity_id: media_player.shield_tv
    key: 'KEYCODE_ENTER'

Make sure to use media_player.androidtv_key as service.

2 Likes

I cannot get Plex to start. What intent do you use? i use

-n com.plexapp.android/com.plexapp.plex.activities.SplashActivity

i cannot get it to work.

I have this entities:
tv.emby.embyatv/.startup.StartupActivity
com.nst.iptvsmarterstvbox/.view.activity.SplashActivity
Where can I add it, canā€™t find where hassio stores all the other entitiesā€¦

See my previous comment if you just want it to work without messing around too much. In short, the intent you want is (including the leading semicolon)

; am start -a android.intent.action.MAIN -c android.intent.category.LEANBACK_LAUNCHER -n com.plexapp.android/com.plexapp.plex.activities.SplashActivity

The better way is in my followup comment but requires a modified androidtv.py (here).

Really, you should use one of those methods for every app if youā€™re launching via an activity. The ā€œ-nā€ flag doesnā€™t really get handled the way I thought it did and the fact that it works for most apps is just luck.

1 Like
127|once:/ $ 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
y --brief $x | tail -n 1 | grep -v "No activity found"; done                  <
com.mxtech.videoplayer.pro/.ActivityWelcomeMX
com.plexapp.android/com.plexapp.plex.activities.SplashActivity
com.crunchyroll.crunchyroid/.ui.views.activities.SplashActivity
de.cyberdream.androidtv.notifications.google/de.cyberdream.androidtv.notifications.StartActivity
com.silicondust.view/.App
com.android.vending/com.google.android.finsky.tvmainactivity.TvMainActivity
com.google.android.tv/com.android.tv.TvActivity
com.rcreations.WebCamViewerPaid/.IpCamViewerActivity
com.android.gallery3d/.app.GalleryActivity
tv.twitch.android.app/tv.twitch.android.apps.TVLandingActivity
org.xbmc.kodi/.Splash
com.facebook.katana/.Fb4FireTVLaunchActivity
com.google.android.youtube.tv/com.google.android.apps.youtube.tv.activity.ShellActivity
com.accuweather.android/com.accuweather.accutv.core.MainActivity
com.google.android.tv.remote.service/.settings.SettingsActivity
com.netflix.ninja/.MainActivity
com.nousguide.android.rbtv/com.redbull.launch.SplashActivity
com.yodo1.crossyroad/com.unity3d.player.UnityPlayerActivity

So the HD HomeRun package is com.silicondust.view/.App But im not sure how to find out what to send to it, to go to a specific channel?

Or can I use the inbuilt android TV Channels thing and send intents to that? Im not sure how to find the intents either for thatā€¦

Iā€™ve been looking into doing the Live Channels and honestly canā€™t figure it out. The best Iā€™ve gotten is opening the app with

content://android.media.tv/channel

I can get it to go to channel 1 with

content://android.media.tv/channel/1

but no other channels seem to work.

You can also open (and close) the program guide with

content://android.media.tv/program

Thatā€™s as far as I was able to get. I think the other way would be to just have a script that opens the app, types in the channel number, and hits enter.

'live_channel_nasa':
  alias: "NASA Live Channel"
  sequence:
  - service: script.live_channels
  - delay:
      milliseconds: 250
  - service: media_player.androidtv_key
    data:
      entity_id: media_player.shield_tv
      key: 13
  - service: media_player.androidtv_key
    data:
      entity_id: media_player.shield_tv
      key: 11
  - service: media_player.androidtv_key
    data:
      entity_id: media_player.shield_tv
      key: 10
  - service: media_player.androidtv_key
    data:
      entity_id: media_player.shield_tv
      key: 66

The script.live_channels just opens up the live channels app. I use a modified custom component to send the ADB command to start com.google.android.tv/com.android.tv.MainActivity, but any way that gets the app opened should work.

Amazing job. Thank you for sharing this. I use most of your config for the shield and it works very well.

Anyone else having issues after 0.88 with loading the custom component?

Checking the config with addon I get this. Dont know how to solve it though.

Failed config
General Errors:
- Platform not found: media_player.androidtv
- Platform not found: media_player.androidtv

1 Like

Yeah same for me after 0.88.0

Here is the migration guide for custom components: https://developers.home-assistant.io/blog/2019/02/19/the-great-migration.html
Hope it helps, I plan to upgrade to 0.88 soon.

1 Like

I havent upgraded yet. Just checked with addon to see what issues I would get. Fixed all but mentioned adb addon.

Tried to follow the guide and changed the directory to custom_components/androidtv/media_player.py but still doesnā€™t work. Something I have missed?

I have just recently updated to 0.87.1 and moved the component to this structure:
/config/custom_components/androidtv/media_player.py
also added an empty __init__.py file to the same folder.

The media player entity was created as before but its state was unknown. A restarted hassio host and after just sent an intent to start kodi and the media player state with attributes became available again.

I am using the latest androidtv.py from here: https://github.com/hassio-addons/addon-adb/blob/master/custom_components/media_player/androidtv.py
(changed 7 days ago)

Thanks! Downloaded the latest version and now everything seems to work again!

You downloaded the latest Androidtvpy. What else did you do to get it working with 88.0?

I also did this

I did this but Iā€™m still getting the error. I have also updated it to the most recent version.

Thanks! Works great!