[Deprecated] Native support for Fire TV

I have a Gen2 (1K). I’m not using the add-on, so it may be different…but I would think not very much different. I also have to use the Android Debug Bridge to build the keys and such.

Tried the native way again (getting the keys using Android Debug Bridge) and then using the configuration you are showing.
FireTV Shows up in Lovelace and I can control it once, then it disconnects and won’t reconnect until I restart HA. It’s the same as described here.

It’s not seeing your custom component due to how they are picked up now, so it’s not overwriting the inbuilt one.
Should be called media_player.py in a folder named after the component, so…

firetv/media_player.py

1 Like

How do I use/install the adb server if I do not use hass.io? I tried running both:
adb -a server nodaemon &
adb start-server &

but the commponent will not connect. Should I use your below docker script as a service?
https://raw.githubusercontent.com/JeffLIrion/hassio-adb-server-addon/master/adb_server/run.sh

@jaaem what does your yaml look like? I also noticed that you need to run adb connect <IP> on the device you wish to connect with in order for it to connect.

Thanks. I edited a version of the docker script, and it seems to work now. I only hard coded one device, but hopefully it will work

#!/bin/bash

DEVICES=(192.168.1.167)

echo "Starting up ADB..."

while true; do
  adb -a server nodaemon > /dev/null 2>&1
  sleep 10
done &

echo "Server started. Waiting for 30 seconds..."
sleep 30

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
2 Likes

This unfortunately has been a headache and a half trying to get it work with HA. Both HA and ADB containers are running in unraid. If I just pull sorccu/adb container and then manual connect and restart ha. It connects np. Once I try adding a script for it to auto connect it does connect np but HA will not connect to adb at all. So stuck with this. This is the script im using. The Jaaem one I tried but the container just shuts down right away.

#!/bin/sh

sleep 5

DEVICES="192.168.0.206"

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

I can not use media_player.select_source to open netflix as sample in Android TV component on hassio 0.92.1 and Fire 4k Stick
script file:

      mo_youtube:
       sequence:
         - service: media_player.turn_on
           data:
             entity_id:  media_player.fire_4k_tv
         - service: media_player.select_source
           data:
             entity_id: media_player.living_room_tv
             source: "HDMI 1"
         - service: media_player.select_source
           data:
             entity_id:  media_player.fire_4k_tv
             source: 'com.netflix.ninja'

Besides, how can i get app id of firefox browser (or other apps) on amazon fire 4k tv? Please help me @JeffLIrion

Try sending this command via the androidtv.adb_command service and see if it launches Netflix:

monkey -p android.intent.category.LAUNCHER -c com.netflix.ninja 1; echo $?

Regarding your script, you might need to wait until HA recognizes that the device is on before calling the media_player.select_source service. You can do that via:

  - wait_template: "{{ not is_state('media_player.fire_4k_tv', 'off') }}"
    timeout: 00:00:10

To find out the app_id, open the app and look at the app_id attribute for the media player on the states page.

Thanks for replying @JeffLIrion.

=> I tried but it can not launch Netflix

https://gist.github.com/mcfrojd/9e6875e1db5c089b1e3ddeb7dba0f304#start-apps-on-your-shield

Try this:

{"entity_id" :"media_player.shield", "command": "am start -a android.intent.action.VIEW -d -n com.netflix.ninja/.MainActivity"}
1 Like

It works like a charm. Thank you so much

Hi, i got hassio to connect to firetv using ADB add on. On/off and pause/play work, but the volume controls are not working. I tried calling androidtv.adb_command with command VOLUME_UP, and also media_player.volume_up service, both do not work. I have info logging enabled for hassio, i do not see any errors or anything in log. please help. thank you.

Fire TV devices don’t support volume control. At least, my 2nd generation Fire TV sticks do not, not have I heard of anyone with a newer device reporting that it supports volume control.

Hello, I have been trying to get my firestick set up using
Hassio
ADB - Android Debug Bridge

media_player:

  • platform: androidtv
    name: Firestick
    device_class: firetv
    host: 192.168.0.7
    adb_server_ip: 127.0.0.1

I can’t see my media_player.firestick entity

Please tell me whats wrong thank you
adb logs say i am connected to the IP adress

I’m not sure of the details of previous issue but I just tried it with media_player volume_up service which worked and I have it set with a key_event in a script also and both change the volume on my Toshiba with FireTV built in… if I can provide anymore info let me know.

Edit: it seems I have two entities though and the Volume_up service is working with one that I think possibly got generated from my Alexa App having the fire tv linked. (Would have been pulled from the alexa as media player custom component most likely)

@acraig91 Same issue here, asked on discord, they said I wasn’t the first person with the problem, so I’m just waiting for something to be mentioned in the changelog.

@Ericthegreat @acraig91 Same issue here, too. Please let me know as soon as you have any solution.

@Ericthegreat, @acraig91, @Cello92 what does the Home Assistant log say?

I followed this guideline: https://www.home-assistant.io/components/androidtv/
Android Debug Bridge Add On is installed and connected to my Fire TV:

[14:27:28] INFO: Connecting to device: 192.168.2.129...
already connected to 192.168.2.129:5555

The Home Assistant log says this:

2019-05-22 13:26:52 WARNING (SyncWorker_11) [root] Couldn’t connect to host: 192.168.2.129:5555, error: Connection reset by peer
2019-05-22 13:26:52 WARNING (SyncWorker_11) [homeassistant.components.androidtv.media_player] Could not connect to Fire TV at 192.168.2.129:5555
2019-05-22 13:26:52 WARNING (MainThread) [homeassistant.components.media_player] Platform androidtv not ready yet. Retrying in 30 seconds.

Any ideas why the connection is being rejected?