--- title: "Android TV" description: "Instructions on how to integrate Android TV and Fire TV devices into Home Assistant." logo: androidtv.png ha_category: - Media Player ha_release: 0.7.6 ha_iot_class: Local Polling redirect_from: - /components/media_player.firetv/ --- The `androidtv` platform allows you to control an Android TV device or [Amazon Fire TV](https://www.amazon.com/b/?node=8521791011) device. ## Device preparation To set up your device, you will need to find its IP address and enable ADB debugging. For Android TV devices, please consult the documentation for your device. For Fire TV devices, the instructions are as follows: - Turn on ADB Debugging on your Amazon Fire TV: - From the main (Launcher) screen, select Settings. - Select System > Developer Options. - Select ADB Debugging. - Find Amazon Fire TV device IP address: - From the main (Launcher) screen, select Settings. - Select System > About > Network. ## Configuration ```yaml # Example configuration.yaml entry media_player: # Use the Python ADB implementation without authentication - platform: androidtv name: Android TV 1 host: 192.168.0.111 # Use the Python ADB implementation with authentication - platform: androidtv name: Android TV 2 host: 192.168.0.222 adbkey: "/config/android/adbkey" # Use an ADB server for sending ADB commands - platform: androidtv name: Android TV 3 host: 192.168.0.123 adb_server_ip: 127.0.0.1 ``` {% configuration %} host: description: The IP address for your Android TV / Fire TV device. required: true type: string name: description: The friendly name of the device. required: false default: Android TV type: string port: description: The port for your Android TV / Fire TV device. required: false default: 5555 type: integer adbkey: description: The path to your `adbkey` file. required: false type: string adb_server_ip: description: The IP address of the ADB server. required: false type: string adb_server_port: description: The port for the ADB server. required: false default: 5037 type: integer get_sources: description: Whether or not to retrieve the running apps as the list of sources for Fire TV devices; not used for Android TV devices. required: false default: true type: boolean apps: description: A dictionary where the keys are app IDs and the values are app names that will be displayed in the UI; see example below. required: false default: {} type: map device_class: description: "The type of device: `auto` (detect whether it is an Android TV or Fire TV device), `androidtv`, or `firetv`." required: false default: auto type: string turn_on_command: description: An ADB shell command that will override the default `turn_on` command. required: false type: string turn_off_command: description: An ADB shell command that will override the default `turn_off` command. required: false type: string {% endconfiguration %} ### Full Configuration ```yaml # Example configuration.yaml entry media_player: # Use an ADB server to setup an Android TV device, provide # an app name, and override the default turn on/off commands - platform: androidtv name: Android TV device_class: androidtv host: 192.168.0.222 adb_server_ip: 127.0.0.1 apps: com.amazon.tv.launcher: "Fire TV" turn_on_command: "input keyevent 3" turn_off_command: "input keyevent 223" # Use the Python ADB implementation with authentication # to setup a Fire TV device and don't get the running apps - platform: androidtv name: Fire TV device_class: firetv host: 192.168.0.222 adbkey: "/config/android/adbkey" get_sources: false ``` ## ADB Setup This integration works by sending ADB commands to your Android TV / Fire TV device. There are two ways to accomplish this: ### 1. ADB Server You can use an ADB server to connect to your Android TV and Fire TV devices. For Hass.io users, you can install the [Android Debug Bridge](https://github.com/hassio-addons/addon-adb/blob/master/README.md) addon. Using this approach, Home Assistant will send the ADB commands to the server, which will then send them to the Android TV / 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 use `127.0.0.1` for this value. ### 2. Python ADB Implementation The second option is to connect to your device using the `adb` Python package. If your device requires ADB authentication, you will need to follow the instructions in the [ADB Authentication](#adb-authentication) 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. For a Fire TV device, you can try setting the `get_sources` configuration option to `false`. If the problem cannot be resolved, you should use the ADB server option. #### ADB Authentication If you get a "Device authentication required, no keys available" error when trying to set up your Android TV or 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 device from your computer: [Connecting to Fire TV Through adb](https://developer.amazon.com/zh/docs/fire-tv/connecting-adb-to-device.html).