[TESTERS NEEDED] Android TV / Fire TV key generation

This custom component has been working great for me. I used to have to restart my FireTV after restarting HassIO using the ADB server but so far it’s seems to reconnect fine.

Is there a way to stop and start the adb connection? Just wondering is there’s an easier way to connect adblink without having to restart HA.

I don’t think this is currently possible. I tried disabling the entity in the entity registry, and that worked. At that point you could restart your Android TV / Fire TV device so that it can connect to a different computer via ADB. After you’re done, I suppose you would restart the device again. However, when I re-enabled the entity in HA, the media player entity did not get recreated and I had to restart HA, at which point it showed up again.

I don’t think there’s any sort of disconnect / reconnect service that could be reused for this purpose, and I think the use case is too obscure to justify registering a new service. But if you have an idea how this could work, you could submit a pull request to HA.

Hey @JeffLIrion So cant be 100% sure this didn’t happen before, but with the released version I’m getting:
Couldn't connect to host X.X.X.X:5555, error: Connection reset by peer

[homeassistant.components.androidtv.media_player] Could not connect to Fire TV at X.X.X.X:5555 using Python ADB implementation with adbkey='/config/.storage/androidtv_adbkey'

Am I reading item #3 right:

“You are already connected to the Android TV / Fire TV via ADB from another device. Only one device can be connected, so disconnect the other device, restart the Android TV / Fire TV (for good measure), and then restart Home Assistant.”

EDIT: Also seeing error: Broken pipe

I don’t know what causes those error codes, but the backend libraries didn’t change from HA 0.101 to 0.102.

I run a docker version of HA. My primary AndroidTVs throughout the house are Nvidia Shields. This is the steps required to get this setup running.

Setup the Nvidia Shield.
Enable ADB Debugging both for the Network and for the USB.

Nvidia Shield - Enable ADB over USB/Network

Prior to being able to use the Nvidia Shield with Network Debugging, you’ll have to connect the shield via USB to the server running Home Assistant to get authenticated with the server that will then connect over the network via ADB. This is only required one time.
On the server, install an ADB server for the initial authentication.

sudo apt update 
sudo apt install android-tools-adb android-tools-fastboot

To confirm install

adb version

Run
‘adb devices’

to connect to the Nvidia Shield and allow full access. I followed This Guide - Linux install ADB

Once ADB was enable, everything else worked just fine. My final Configuaration.yaml is

media_player:
  # Use the Python ADB implementation
  - platform: androidtv
    name: master_bedroom
    host: !secret nvidia_shield_master_bedroom_ip

Ok will try a bunch more tests and check

Why i get two devices for only one Fire TV?

This is my configuration about it:

  - platform: androidtv
    name: Fire TV
    host: 192.168.1.33
    device_class: firetv
    get_sources: true
    apps:
      com.dazn: "DAZN"
      it.rainet.androidtv: "RAI Play"

And which one is the correct to use in scripts and automations?

@JeffLIrion Thanks for this simpler version setting up the Fire TV as I could never get the other version to load properly. Quick question since I’m finally able to use this component. Is there a way to retrieve the media info such as artwork and time remaining?

That’s not supported, and I don’t know if it’s even feasible.

No problem. Thanks again for all your hard work on this platform!!

I cannot anymore have the Fire TV component working on my HASSIO.
This is the configuration i have:

  - platform: androidtv
    name: Fire TV
    host: 192.168.1.17
    device_class: firetv
    adb_server_ip: 192.168.1.17
    adb_server_port: 5037
    get_sources: true
    apps:
      com.dazn: "DAZN"

I am using ADB addon with the following configuration:

{
  "devices": [
    "192.168.1.17"
  ],
  "reconnect_timeout": 90
}

The log of the addon says:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Hass.io Add-on: ADB - Android Debug Bridge
 The Android Debug Bridge server program
-----------------------------------------------------------
 Add-on version: 0.5.4
 You are running the latest version of this add-on.
 System: HassOS 3.7  (armv7 / raspberrypi3)
 Home Assistant version: 0.103.5
 Supervisor version: 193
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] adb.sh: executing... 
[cont-init.d] adb.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[16:43:19] INFO: Starting the Android Debug Bridge server...
[16:43:20] INFO: Connecting to device: 192.168.1.17...
error: could not install *smartsocket* listener: Address already in use
ADB server didn't ACK
* failed to start daemon *
* daemon not running. starting it now on port 5037 *
error: cannot connect to daemon
[16:43:24] INFO: Connecting to device: 192.168.1.17...
connected to 192.168.1.17:5555
[16:44:58] INFO: Connecting to device: 192.168.1.17...
connected to 192.168.1.17:5555
[16:46:28] INFO: Connecting to device: 192.168.1.17...
connected to 192.168.1.17:5555
[16:48:00] INFO: Connecting to device: 192.168.1.17...
connected to 192.168.1.17:5555
[16:49:30] INFO: Connecting to device: 192.168.1.17...
already connected to 192.168.1.17:5555
[16:51:01] INFO: Connecting to device: 192.168.1.17...
already connected to 192.168.1.17:5555
[16:52:32] INFO: Connecting to device: 192.168.1.17...
already connected to 192.168.1.17:5555
[16:54:03] INFO: Connecting to device: 192.168.1.17...
already connected to 192.168.1.17:5555
[16:55:34] INFO: Connecting to device: 192.168.1.17...
already connected to 192.168.1.17:5555

But in the developers states i have only this:

Which is not the media_player i had working before (if you look at my previous messages you can understand what i mean), as previously i had media_player.fire_tv which was working good.

I resetted the fire stick, restarted HASSIO, but still have no media_player working.

For more infos this is what i have inside entity:

Any help?

Worked for me exactly as expected! Awesome