This is deprecated in favor of the official Android TV integration: https://www.home-assistant.io/integrations/androidtv/
No Python 2 service necessary! And it can also handle device authentication.
Copy the media_player/firetv.py
to your custom_components
folder (custom_components/media_player/firetv.py
) in your configuration directory. If you do not have a custom_components
folder, then you will need to create it.
# Example configuration.yaml entry
media_player:
# a device that does not require ADB authentication
- platform: firetv
name: Fire TV 1
host: 192.168.0.111
# a device that does require ADB authentication
- platform: firetv
name: Fire TV 2
host: 192.168.0.222
adbkey: "/config/android/adbkey"
# use an ADB server for sending ADB commands instead of the Python ADB implementation
- platform: firetv
name: Fire TV 3
host: 192.168.0.123
adb_server_ip: 127.0.0.1
Configuration variables:
- host (Required): The IP address your Fire TV device.
- name (Optional): The friendly name of the device; the default is 'Amazon Fire TV'.
- port (Optional): The port for your Fire TV device; the default is 5555.
- adbkey (Optional): The path to your
adbkey
file. Note that the fileadbkey.pub
must be in the same directory. - adb_server_ip (Optional): The IP address of the ADB server.
- adb_server_port (Optional): The port for the ADB server.
- get_sources (Optional): Whether or not to retrieve the running apps as the list of sources; the default is
true
.
This component works by sending ADB commands to your Fire TV device. There are two ways to accomplish this:
- Using the
adb
Python package. If your device requires ADB authentication, you will need to follow the instructions in the "ADB Authentication (for Fire TV devices with recent software)" section below. Once you have an authenticated key, this approach does not require any additional setup or addons. However, users with newer devices may find that the ADB connection is unstable. If setting theget_sources
configuration option tofalse
does not help, they should use the next option. - Using an ADB server. For Hass.io users, you can install the Android Debug Bridge addon. With this approach, Home Assistant will send the ADB commands to the server, which will then send them to the Fire TV device and report back to Home Assistant. To use this option, add the
adb_server_ip
option to your configuration. If you are running the server on the same machine as Home Assistant, you can use127.0.0.1
for this value.
If you get a "Device authentication required, no keys available" error when trying to set up Fire TV, then you'll need to create an adbkey and add its path to your configuration. Follow the instructions on this page to connect to your Fire TV from your computer: Connecting to Fire TV Through adb.
In the dialog appearing on your Fire TV, you must check the box that says "always allow connections from this device." ADB authentication in Home Assistant will only work using a trusted key.
Once you've successfully connected to your Fire TV via the command adb connect <ipaddress>
, the files adbkey
and adbkey.pub
will be created on your computer. The default locations for these files are (from https://developer.android.com/studio/command-line/adb):
- Linux and Mac:
$HOME/.android.
- Windows:
%userprofile%\.android.
Copy the adbkey
and adbkey.pub
files to your Home Assistant folder and add the path to the adbkey
file to your configuration.
Solution: Restart Home Assistant. This error occurs because HA needs some time to install the dependencies, and it tries to setup the component before the dependencies have been installed.
If you receive the error message Issue: Error while setting up platform firetv
in your log when trying to set up a Fire TV device with an ADB key, then there is probably an issue with your ADB key. Here are some possible causes.
-
ADB is not enabled on your Fire TV. To remedy this, enable ADB by following the instructions above.
-
Your key is not pre-authenticated. Before using the
adbkey
in Home Assistant, you must connect to your Fire TV device using the ADB binary and tell the Fire TV to always allow connections from this computer. For more information, see the section "ADB Authentication (for Fire TV devices with recent software)" above. -
Home Assistant does not have the appropriate permissions for the
adbkey
file and so it is not able to use it. Once you fix the permissions, the component should work. -
You are already connected to the Fire TV via ADB from another device. Only one device can be connected, so disconnect the other device, restart the Fire TV (for good measure), and then restart Home Assistant.
This is based on python-firetv by happyleavesaoc, and it depends on python-adb or pure-python-adb for sending its ADB commands.