Native support for Android TV / Android devices

Can you try this instead?

com.formulaone.production/com.avs.f1.ui.splash.SplashActivity

Thx for the suggestion. Unfortunately that doesn’t work either

Hi all,
Many releases ago, I (FireTV Stick) was able to use the UI to select a source from a list of several apps. At some point, this stopped working as there is only one and only source in the list, and this one item in the list corresponds to the app that is currently running.
I never pursued a fix for this until today, and still not having much luck. Any suggestions:

  - platform: androidtv  
    name: Fire TV
    host: MY_FIRE_TV_ADDRESS
    device_class: firetv 
    adbkey: ADB_KEY_DIRECTORY
    get_sources: true #default true. 
    apps:
      com.amazon.device.controllermanager: "FireTV Controller"
      com.amazon.tv.settings.v2: "FireTV Settings Menu"
      com.amazon.tv.launcher: "FireTV Home" 
      com.hulu.plus: "Hulu"
      com.att.tv: "DirecTV Stream"
      com.netflix.ninja: "Netflix"
      com.pbs.video: "PBS"
      com.amazon.firetv.youtube: "YouTube"
      com.hbo.hbonow: "HBO Now"

EDIT/UPDATE:
After digging around in the code I think I see what the problem is.
First some background on how I think the source list is built and used.
When it comes to building a list of sources, the HA AndroidTV Integration code will periodically ask what I will call the lower level device dependent driver code to get a list of running apps (which it will do if get_sources is true).

This device dependent driver code uses various adb shell commands to talk directly with the device to perform various things, including getting a list of running apps. It is basically getting a list of app_ids, i.e. com.xxx.yyy. When the HA AndroidTV Integration receives the running app list, it essentially will do a look up into the config parameter apps (as well as another list that resides embedded in the code) so that it can change the app id to a more user friendly string. For example: com.hulu.plus will be shown as “Hulu” in the source list. If it can not find a matching appid in the look up, it will simply show the appid in the source list.

There may be cases, where there are lots of appids that are showing up and they are more or less internal apps, and if you don’t want these showing up in your sources list, you can set the config exclude_unnamed_apps to true to eliminate them. Finally, there appears to be a separate flow of code that is retrieving the current running app, and this is the one of course that shows as currently selected.

So I found that the problem is in the retrieving of the running apps. The adb shell command that is used for the Fire device is not retrieving any any running apps, and so the HA AndroidTV Integration gets an empty list of running apps so the source list is empty and all that is left to show is the current running app and no more. The solution I found is to use the same adb shell command that is used for Android devices. I’ve submitted an issue on this, so we’ll see where it goes.

Hello,

I`m having a similar issue as described above with my Shield TV, only I don’t see any sources (apps) at all. The rest of the media_player is working as expected (I can turn it on/off, change volume and see the album art).

Here is my config:

  - platform: androidtv
    name: Shield (Android TV)
    host: 192.168.1.XXX
    device_class: androidtv

I can check its state (mostly ‘idle’) and here are the attributes of the entity:

adb_response: null
hdmi_input: null
entity_picture: >-
  /api/media_player_proxy/media_player.shield_android_tv?token=XXXXXX&cache=XXXX
friendly_name: Shield (Android TV)
supported_features: 23997

Any help?

1 Like

@kirpat @Molodax hi guys, have you resole it? i have the same issue on my new smart tv philips android tv 65pus8556, appid dont show in the attributes, and the state doesnt change, thanks :slight_smile:

i have stopped using this. so cant say does it still works.

1 Like

I noticed today (since there’s now a proper integration page) that the attributes do show the apps installed on my shield however, this integration does (up till now) not support Android TV 11. See Alerts – Home Assistant

Hello.

I have a 2 server landscape (TST/PRD), in which I run the ‘ADB - Android Debug Bridge’ add-on in PRD and connect the TST server to send the ADB commands through it.

As this add-on is now deprecated for a while, I am considering changing the setup to Python-adb instead.

Still then, considering that I can only have a single ADB connection at a time per device, is there a way to move it to Python-adb and still be able to send ADB commands from the 2 servers “at the same time”?

Thanks in advance for any insights.

I’m having the same issue with my Shield TV. I just installed the integration after I upgraded to the latest 2022.2 release.

I can stop and start apps using ADB directly. Good enough for me. I have the latest Shield update and latest HA release.

service: androidtv.adb_command
entity_id: media_player.android_xxxxxxxxxxxxxxx
data:
command: >-
am force-stop
com.google.android.youtube.tvunplugged

1 Like

Wow, this was driving me insane… it thought it had something to do with other integrations…

But this clearly makes the issue clear

Thanks for posting this, using the command to stop vpn in background on Firestick after starting geolocked stream to get full speed/quality.

I’m new to Home Assistant so forgive me for the basic question, but I’ve installed the Android TV integration.

Everything seems to be working fine with my ShieldTV but I’m trying to change the app names from com.xxxxxx to something more meaningful.

The instructions I’ve found say to edit the yaml as follows:

media_player:
  - platform: androidtv
    name: media_player.android_tv_192_168_1_135
    host: 192.168.1.135
    apps:
      com.bamnetworks.mobile.android.gameday.atbat: "MLB"
      com.maz.combo587: "Law and Crime"

I’m placing that in my configuration.yaml file, however it isn’t changing the app names. Should I be placing this code somewhere else other than my configuration.yaml? If not, any other suggestions?

Thanks.

AndroidTV integration is no longer supported in YAML configuration since 2022.2.

Please make sure you set up your AndroidTV integration via UI configuration (you can also set up your apps there) and you should be OK.

1 Like

I have a 2019 Nvidia Shield TV Pro, Is there anyway through this integration that I can turn on the night time listening mode after a certain time during the day?

I’m not familiar with “night time listening mode”. Is it an app (like Netflix, NBC, BBC, Kodi or VLC) ? or a feature of one of the apps (like a particular NBC or BBC channel) ?

You can start an app - I saw instructions for finding out what the apps are named some time ago - but once you start an app I understand that you are stuck with sending keystrokes to the device - emulating its remote control.

Hi,

I need to keep an app running on my Google TV. I can get the status of an app with adb but is there a command to keep an app alive ?

No it is not an app. It is a system setting built into the Nvidia Shield TV

Hi. I use the state of a ShieldTV device to turn on amps for overhead speakers. However, my wife sometimes uses a portable bluetooth speaker, and I would like to not have the amp switch on when the shield is using a bluetooth speaker instead of HDMI audio out.

Is there a way with this plugin to figure out which audio device is active, so I can make the proper decision in the automation about amp power?

Hi,
is does this integration also support android 13?
I have a problem with Android TV version 13 to get the currently running application. I can get the state of the application - “wake_lock_size”, but the name of the application is not in the adb response. I don’t know if this is a bug of android 13 of this ROM or if there is a problem in the integration.
Thanks.