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"