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

Hi,

I am trying to control my NVIDIA TV Shield with HA, but I am a little bit lost with the configuration. I would like to control the play / pause, volume and previous next button in order to change music on my shield for example.

Is there is a tutorial avalaible to to that, and the code that should be paste in the configuration.yaml file ?

Which is the easiest way to use ADB, python or ADB server ? I have HACS installed.

Thanks for your help!

Iā€™m using HA to control a 2017 and 2019 Pro Shield TV without any issues, so it is possible :wink:

If youā€™re using Hassio, youā€™ll need to install the ā€œADB - Android Debug Bridgeā€ add-on. In the config of that add-in, enter the IP address of your Shield TV and start it up.

Youā€™ll also need to enable the Developer options on the Shield TV to support this. Here are some generic Android instructions, but you should be able to follow this for your Shield TV (the menu options are the same name).

:tada: Release v0.5.4

Full Changelog

This is a general maintenance release.

:hammer: Changes

  • :books: Component > Integration (#18)
  • :arrow_up: Upgrades add-on base image to v4.0.2
  • :books: Update add-on installation instructions
  • :shirt: Fixes Markdownlint warnings

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

I think you should take a look here

hi guys,
I noticed when using the plex app on my shield home assistant sees anything i play as ā€œPausedā€, i can see a few people have had this issue, but I couldnā€™t see a fix.

could someone please help

Hi,

Is it possible to controle volume through ADB for my TV Shield ? I havenā€™t found the commande for volume UP or volume DOWN anyware.

Thanks

Anyone got the command to open Disney+ app?

I use a harmony remote to control my Shield TV. Harmony integrates well with hassio and you would be able to send a harmony command to control the volume.

So Disney+: com.disney.disneyplus/com.bamtechmedia.dominguez.main.MainActivity

Not seeing Android debug in the HA services drop down? I searched for ABD and Android. Any ideas? I made sure it was running and config right.Capture

I had the ADB server and AndroidTV working fine, but after upgrading to the latest versions of HassOS and Home Assistant, it no longer is working and the ADB service calls donā€™t exist in Developer Tools. Does anyone have any ideas? Details below:

Device: Raspberry Pi 3B+
Hass.io Supervisor: v193
OS: HassOS 3.7
HA Version: 0.103.4
ADB Server: 0.5.4

Devices: All are Amazon Fire TV STICK 4K

Core Configuration

media_player:
  - platform: androidtv
    name: Master Bedroom Fire TV 4K
    device_class: firetv
    host: 192.168.1.158
    adb_server_ip: 127.0.0.1
    adb_server_port: 5087

  - platform: androidtv
    name: Great Room Fire TV 4K
    device_class: firetv    
    host: 192.168.1.157
    adb_server_ip: 127.0.0.1
    adb_server_port: 5087
  
  - platform: androidtv
    name: Dining Room Fire TV 4K
    device_class: firetv    
    host: 192.168.1.156
    adb_server_ip: 127.0.0.1
    adb_server_port: 5087  

ADB Config

{
  "devices": [
    "192.168.1.156",
    "192.168.1.157",
    "192.168.1.158"
  ],
  "reconnect_timeout": 90
}

Portion of ADB Log

[10:54:33] INFO: Connecting to device: 192.168.1.158...
connected to 192.168.1.158:5555
[10:56:04] INFO: Connecting to device: 192.168.1.156...
connected to 192.168.1.156:5555
[10:56:04] INFO: Connecting to device: 192.168.1.157...
connected to 192.168.1.157:5555
[10:56:04] INFO: Connecting to device: 192.168.1.158...
connected to 192.168.1.158:5555
[10:57:34] INFO: Connecting to device: 192.168.1.156...
connected to 192.168.1.156:5555
[10:57:34] INFO: Connecting to device: 192.168.1.157...
connected to 192.168.1.157:5555
[10:57:34] INFO: Connecting to device: 192.168.1.158...
connected to 192.168.1.158:5555
[10:59:05] INFO: Connecting to device: 192.168.1.156...
connected to 192.168.1.156:5555
[10:59:05] INFO: Connecting to device: 192.168.1.157...
connected to 192.168.1.157:5555
[10:59:05] INFO: Connecting to device: 192.168.1.158...
connected to 192.168.1.158:5555

Portion of Home Assistant Log

2019-12-27 11:00:01 WARNING (SyncWorker_3) [androidtv.adb_manager] Couldn't connect to host 192.168.1.158:5555 via ADB server 127.0.0.1:5087, error: ERROR: connecting to 127.0.0.1:5087 [Errno 111] Connection refused.
Is adb running on your computer?
2019-12-27 11:00:01 WARNING (SyncWorker_13) [androidtv.adb_manager] Couldn't connect to host 192.168.1.157:5555 via ADB server 127.0.0.1:5087, error: ERROR: connecting to 127.0.0.1:5087 [Errno 111] Connection refused.
Is adb running on your computer?
2019-12-27 11:00:01 WARNING (SyncWorker_15) [androidtv.adb_manager] Couldn't connect to host 192.168.1.156:5555 via ADB server 127.0.0.1:5087, error: ERROR: connecting to 127.0.0.1:5087 [Errno 111] Connection refused.
Is adb running on your computer?
2019-12-27 11:00:01 WARNING (SyncWorker_3) [homeassistant.components.androidtv.media_player] Could not connect to Master Bedroom Fire TV 4K at 192.168.1.158:5555 using ADB server at 127.0.0.1:5087
2019-12-27 11:00:01 WARNING (SyncWorker_13) [homeassistant.components.androidtv.media_player] Could not connect to Great Room Fire TV 4K at 192.168.1.157:5555 using ADB server at 127.0.0.1:5087
2019-12-27 11:00:01 WARNING (SyncWorker_15) [homeassistant.components.androidtv.media_player] Could not connect to Dining Room Fire TV 4K at 192.168.1.156:5555 using ADB server at 127.0.0.1:5087
2019-12-27 11:00:01 WARNING (MainThread) [homeassistant.components.media_player] Platform androidtv not ready yet. Retrying in 180 seconds.
2019-12-27 11:00:01 WARNING (MainThread) [homeassistant.components.media_player] Platform androidtv not ready yet. Retrying in 180 seconds.
2019-12-27 11:00:01 WARNING (MainThread) [homeassistant.components.media_player] Platform androidtv not ready yet. Retrying in 180 seconds.
2019-12-27 11:03:02 WARNING (SyncWorker_3) [androidtv.adb_manager] Couldn't connect to host 192.168.1.158:5555 via ADB server 127.0.0.1:5087, error: ERROR: connecting to 127.0.0.1:5087 [Errno 111] Connection refused.
Is adb running on your computer?
2019-12-27 11:03:02 WARNING (SyncWorker_7) [androidtv.adb_manager] Couldn't connect to host 192.168.1.157:5555 via ADB server 127.0.0.1:5087, error: ERROR: connecting to 127.0.0.1:5087 [Errno 111] Connection refused.
Is adb running on your computer?
2019-12-27 11:03:02 WARNING (SyncWorker_4) [androidtv.adb_manager] Couldn't connect to host 192.168.1.156:5555 via ADB server 127.0.0.1:5087, error: ERROR: connecting to 127.0.0.1:5087 [Errno 111] Connection refused.
Is adb running on your computer?
2019-12-27 11:03:02 WARNING (SyncWorker_3) [homeassistant.components.androidtv.media_player] Could not connect to Master Bedroom Fire TV 4K at 192.168.1.158:5555 using ADB server at 127.0.0.1:5087
2019-12-27 11:03:02 WARNING (SyncWorker_7) [homeassistant.components.androidtv.media_player] Could not connect to Great Room Fire TV 4K at 192.168.1.157:5555 using ADB server at 127.0.0.1:5087
2019-12-27 11:03:02 WARNING (SyncWorker_4) [homeassistant.components.androidtv.media_player] Could not connect to Dining Room Fire TV 4K at 192.168.1.156:5555 using ADB server at 127.0.0.1:5087
2019-12-27 11:03:02 WARNING (MainThread) [homeassistant.components.media_player] Platform androidtv not ready yet. Retrying in 180 seconds.
2019-12-27 11:03:02 WARNING (MainThread) [homeassistant.components.media_player] Platform androidtv not ready yet. Retrying in 180 seconds.
2019-12-27 11:03:02 WARNING (MainThread) [homeassistant.components.media_player] Platform androidtv not ready yet. Retrying in 180 seconds.

Background
I originally setup ADB on my Mac and generated the keys and then used the Python add-on, and that worked, but when the TVs were off, the state constantly toggled between unknown and unavailable. I then deleted the key and switched to the ADB server. I let it self-generate the key and setup the Fire TV sticks to use the new key. That worked more reliably for me. When the TV was off, the Fire Stick 4K showed as OFF.

However, after upgrading the underlying HassOS from 2.#.# (donā€™t remember exact version) to 3.7, my media player devices no longer showed up, and the ADB server commands no longer existed in Services in Developers Tools.

Iā€™ve tried everything I can think of including uninstalling and re-installing, turning off ADB on the FireTV Stiick 4K, rebooting, turning ADB back on, rebooting HA, re-accepting the certificate on the Fire TV Stick 4K and telling it to remember the computer, but still it doesnā€™t show up in HA. I have hit a wall. :frowning:

Any help is much appreciated!

I turned off the ADB server and went back to the pythod method, and everything is working OK for now under that version. I still wonder why the ADB server isnā€™t working, but at least I have control back for now.

Iā€™ve recently acquired a new Sony Android |TV and have just been trying to set up the AndroidTV component on and off over the last few days.

I can report that Iā€™m getting the same symptoms as reported by @Salty. The ADB Server component has connected to the TV and Iā€™ve accepted the key etc. Logs from the the ADB Server show it connecting but HA logs are showing the same problems as Salty. I only just upgraded HassOS to 3.7 tonight and was getting the problem yesterday too, so not specific to 3.7

I hope thereā€™s a solution to this soon,as Iā€™ve not had any joy as yet connecting via Python method, but Iā€™ll give it another go.

EDIT: I just turned up the debug on HA and captured the following in the logs:

2019-12-29 22:53:34 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.androidtv
2019-12-29 22:53:34 WARNING (SyncWorker_7) [androidtv.adb_manager] Couldn't connect to host 192.168.0.111:5555 via ADB server 127.0.0.1:5087, error: ERROR: connecting to 127.0.0.1:5087 [Errno 111] Connection refused.
Is adb running on your computer?
2019-12-29 22:53:34 DEBUG (SyncWorker_7) [androidtv.adb_manager] ADB command not sent to 192.168.0.111:5555 via ADB server 127.0.0.1:5087 because pure-python-adb connection is not established: getprop ro.product.manufacturer && getprop ro.product.model && getprop ro.serialno && getprop ro.build.version.release && ip addr show wlan0 | grep -m 1 ether && ip addr show eth0 | grep -m 1 ether
2019-12-29 22:53:34 WARNING (SyncWorker_7) [homeassistant.components.androidtv.media_player] Could not connect to Sony TV at 192.168.0.111:5555 using ADB server at 127.0.0.1:5087

Besides your ADB problems, you should try this custom component. Since I use this one, I donā€™t have any problems with my Sony TV and the python adb connection. :wink:

Thanks for the pointer, Iā€™ll give it a try when Iā€™m back home in a few days.

:tada: Release v0.5.5

Full Changelog

This is a general maintenance release.

:hammer: Changes

  • :fireworks: Updates maintenance/license year to 2020
  • :arrow_up: Upgrades add-on base image to v4.0.3
  • :pencil2: Funding adjustments
  • :pencil2: Fixes some spelling and grammar

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work:
https://github.com/sponsors/frenck or https://patreon.com/frenck

Hello all,

This is great work, some awesome tutorials. Thanks to all.

I can get all my apps to launch except when I read my shield or Sony android tv with adb I am missing two. Nhl live and dazn

Any help would be appreciated.

Thanks

:tada: Release v0.5.6

Full Changelog

This is a small bugfix/improvement release.

:hammer: Changes

  • :hammer: Change adb-connect to wait on port (#20)

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work:
https://github.com/sponsors/frenck or https://patreon.com/frenck

Hi all, I installed the ADB debug bridge, and it connects to my Shield. The ADB log says itā€™s connected:

[22:17:01] INFO: Connecting to device: 192.168.178.133...
already connected to 192.168.178.133:5555

When I try to send any command to my nVidia Shield, like this:

action:
  service: androidtv.adb_command
  data:
    entity_id: media_player.shield
    command: "HOME"

I find an error in the log:

Error while executing automation automation.control_shield. Service not found for call_service at pos 1: Unable to find service androidtv/adb_command

And indeed in the services tool in the Developer Tools, I donā€™t seem to have androidtv.adb_command.

Did I miss a step in the install?

The add-on provides the service, you still need to configure the integration in Home Assistant.

So 2 things to set up. Home Assistant integration, and the add-on.