ADB Integration issues starting my journey

Didn’t see a specific spot for this so if this is the wrong area apologies. So I bought a NVidia Shield TV Pro. Wanted to integrate it into HA. All the documentation I found wasn’t super specific how to do this but think I was able to get it working and on a basic level have some issues was looking for help with.

What I did to set it up:

Enabled support for NVidia Shield:

Go to Settings > Device Preferences > Developer Options 
Enable USB debugging and Network debugging
When a request comes up to accept check the Always checkbox and OK

Then setup docker:

Launch portainer:
•	Under Containers click Add container
•	Name: adb
•	image: sorccu/adb
•	For Manual network port publishing select publish a new network port
•	Enter Host: 5037 and container 5037
•	Leave Access Control active and set to Administrator
•	For Command under Command & logging put:
sh -c "/config/startup.sh & adb -a -P 5037 server nodaemon"
•	Select the Volumes tab and click map additional volume

  volumes:
    - Container: /config
       Host: /home/homeassistant/adb_config
    - Container: /etc/timezone
       Host: /etc/timezone
       Read Only
    - Container: /etc/localtime
       Host: /etc/localtime
       Read Only	

Go to the Restart policy tab and set to Always

Click Deploy the container

Mkdir on the server of /home/homeassistant/adb_config

So that was the basic setup

Now create the config file referenced above:

Go to /home/homeassistant/adb_config
vi startup.sh and add:

#!/bin/sh

sleep 5

DEVICES=“192.168.0.55” # Shield IP

echo “Connecting to devices.”
for device in $DEVICES;do
adb connect $device
done
echo “Done.”

while true;do
for device in $DEVICES;do
adb connect $device > /dev/null 2>&1
done
sleep 60
done

chmod a+x startup.sh

Let’s see if things are talking:

Go back into portainer > Containers
Check adb and click Restart
Go to the adb logs and should see a successful connection like:

adb I 04-01 23:56:01 8 8 adb_auth_host.cpp:467] Calling send_auth_response
adb I 04-01 23:56:01 8 8 adb_auth_host.cpp:435] Calling send_auth_publickey
adb I 04-01 23:56:38 8 8 adb_auth_host.cpp:416] adb_auth_init…
adb I 04-01 23:56:38 8 8 adb_auth_host.cpp:174] read_key_file ‘/root/.android/adbkey’…
adb I 04-01 23:56:38 8 8 adb_auth_host.cpp:391] adb_auth_inotify_init…
Connecting to devices.
connected to 192.168.0.55:5555
Done.
adb I 04-01 23:56:43 8 8 adb_auth_host.cpp:467] Calling send_auth_response

OK looks good.

Add android TV component to HASS

Edit configuration.yaml
Under media_player add another sub branch like:
  - platform: androidtv
    name: "Family Room Nvidia Shield"
    host: 192.168.0.55 # <ip of shield tv>
    adb_server_ip: 192.168.0.50 # <ip of docker container for adb>
    adb_server_port: 5037

save the changes
restart
Now go to the OOTB group and add the Android TV to see if it’s working
Configure > + > Media Control
Entity: media_player.family_room_nvidia_shield
Save
Find the Family Room Nvidia Shield box and click the three dots
Click the source pulldown should see a list of services to connect to

Add your own pulldown values by updating the platform:androidtv with:

exclude_unnamed_apps: true
apps:
  com.google.android.tvlauncher: "Home"
  com.google.android.youtube.tv: "Youtube"
  com.plexapp.android: "Plex"
  com.spotify.tv.android: "Spotify"
  tv.twitch.android.viewer: "Twitch"

reboot

OK so done. So my final configuration.yaml looks like:

  - platform: androidtv
    name: "Family Room Nvidia Shield"
    host: 192.168.0.55 # IP of Shield
    adb_server_ip: 192.168.0.50 # IP of docker container
    adb_server_port: 5037
    exclude_unnamed_apps: true
    apps:
      com.google.android.tvlauncher: "Home"
      com.plexapp.android: "Plex"
      com.google.android.youtube.tv: "YouTube"
      com.spotify.tv.android: "Spotify"

So there’s my setup. Now the problem. The items I list above are not all showing on the pulldown, and those that are are not all working. So the pulldown:

So no Plex, no YouTube. Netflix is also on there but isn’t in the above and I have exclude_unnamed_apps to true.

The other problem. So I can flip between Netflix and Spotify but Home never works. I’ve tried it also before I defined the above and it’s app bundle was just showing in the pulldown and the Home option wouldn’t work.

Any thoughts?

Hi John,

I have a very similar configuration to yours, with some user defined apps and exclude_unnamed_apps to true.
To answer one of your question: Netflix is there because it is defined in the backend library. Actually, you should not have to include any of your apps: Plex, Youtube and Spotify are already defined in the code and should appear without any configuration in the dropdown list.
Now, I also have similar issues: I confirm that the “Home” entry does not work for me either. Some of my user defined apps will only appear in the source list after I open them, but it’s very inconsistent: Google Play Music never appears, and some will disappear after a few minutes.
To get more support, this thread should be moved to “Configuration” instead of “3rd party integrations” since the androidTV component comes by default with Home Assistant. Alternatively, open an issue on Github.

Cheers,
Mat