FireTV cannot be added to HA

Version: core-2021.8.8
Installationstyp: Home Assistant Container

I added the following snippet to my configuration.yaml:

media_player:
  - platform: androidtv
    name: FireTV
    host: 192.168.x.y
    device_class: androidtv

After restarting the log says:

Could not connect to FireTV at 192.168.x.y:5555 using Python ADB implementation with adbkey=‘/config/.storage/androidtv_adbkey’

The automatic keygen worked. There is a key at this location. On my computer I can connect to this IP:5555 via adb.

Anyone experienced the same or is able to help me to debug this?

Is the Fire TV an Android TV device or a Fire TV device? I’m using a Fire Stick 4K and your config looks the same as mine, except I don’t have any entry for device_class. You might want to try commenting that line out to let it default to auto detect the device type.

Did you watch the TV screen after the HA restart and answer the prompt to allow the connection, as well as check the box to “always allow”?

I discovered that once I successfully connected HA to my Fire Stick I was no longer able to connect to the stick using ADB from my laptop. I had to comment out the media_player entry and restart HA before I could connect with the laptop again, It acts like the Fire Stick only allows one ADB connection at a time. You might want to make sure there is nothing else connected to your Fire TV when HA makes it’s initial connection. You could also try renaming those androidtv_adbkey files to start over.

1 Like

Thank you for your detailed answer! You actually solved my problem. There can be only one adb connection at a time. When I connected via PC I have to restart, then it’s working. Thank you :slight_smile:

Since you are also using your FireTV with HA: Can you tell me how to start apps properly? For me its working 1 out of 10 times. And I cannot see any pattern when it’s working. I tried the services androidtv.adb_command and media_palyer.select_source. Do you have any working automation steps defined?

I’m currently not trying to do anything like that, but I was able to send commands using Node Red. It doesn’t seem to respond to the commands quickly, so you may need to wait a few seconds after sending the command before you see it change.

Launch the VLC app on the FIre Stick:
Domain: media_player
Service: select_source
Entity ID: media_player.fire_stick_lr
Data: {“source”:“VLC”} (json)

Send the Home command:
Domain: androidtv
Service: adb_command
Entity ID: media_player.fire_stick_lr
Data: {“command”:“HOME”} (JSONata expression)

This is the resource I used for some of the commands I tested with:
https://github.com/JeffLIrion/python-androidtv/blob/bf1058a2f746535921b3f5247801469c4567e51a/androidtv/constants.py#L143-L186