Public | Automated Build

Last pushed: 10 months ago
Short Description
Docker container to run the python2 fire tv service to remotely control fire tv instances.
Full Description


firetv is a Python 2.x package that provides state information and some control of an Amazon Fire TV device over a network. This is achieved via ADB, so therefore requires ADB Debugging to be turned on. It includes firetv-server, an HTTP server to facilitate RESTful access to configured devices.

Manual Installation

Install the following ADB dependencies via your package manager:

with apt-get: swig libssl-dev python-dev libusb-1.0-0

with yum: swig openssl-devel python-devel libusbx-devel

Be sure you install into a Python 2.x environment.

pip install firetv

If you want the HTTP server component installed as a script, use:

pip install firetv[firetv-server]

Consider installing adb directly from the git repository. It contains bugfixes not in the pip-packaged version:

pip install git+git://


To run the server when installed as a script:


If you want to set a default Amazon Fire TV device:

firetv-server -d X.X.X.X:5555

If you want to run on a port other than 5556:

firetv-server -p XXXX


Copy the firetv.service file to /etc/systemd/system/. Modify the ExecStart path and arguments as necessary.

systemctl enable firetv.service  # Enable on boot
systemctl start firetv.service   # Start server
systemctl stop firetv.service    # Stop server


To store multiple Amazon Fire TV devices persistent, you can load a yaml config file:
firetv-server -c some/config/file.yaml

The config file has to be in the following format:


Note: If you use -d and -c option together you must not name one of the devices in config file default or give one of the devices the same host as in -d option.

Docker Installation

If you want to skip the manual work above the following steps will get a docker container up and allow you to mount a volume for the configuration. This example is for Windows, change the paths to match your operating system.

docker run -d --restart=always -v F:/docker/firetv/config:/config --name python-firetv -p 5556:5556 sytone/python-firetv -c /config/house.yaml


All routes return JSON.

  • GET /devices/list (list all registered devices and state)
  • GET /devices/connect/<device_id> (force connection attempt)
  • GET /devices/state/<device_id> (return state)
  • GET /devices/action/<device_id>/<action_id> (request action)
  • GET /devices/<device_id>/apps/running (return running user apps)
  • GET /devices/<device_id>/apps/<app_id>/start (start an app)
  • GET /devices/<device_id>/apps/<app_id>/stop (stop an app)
  • GET /devices/<device_id>/apps/<app_id>/state (check app state)
  • GET /devices/<device_id>/apps/state/<app_id> (check app state, deprecated format)
  • POST /devices/add (see below)

Add A Device

If you use the -d option, the specified device is added automatically with the device identifier default. If you want to add further devices, or don't want to use the command line option for the initial device, use the POST /devices/add route. The device identifier can be any string meaningful to you, matching [-\w] (any alphanumeric character, plus -).

POST JSON in the following format with the HTTP header Content-Type: application/json:

  "device_id": "<your_device_id>",
  "host": "<address>:<port>"


firetv can detect device state and issue a number of actions. It can also get the running state of user apps.

Detected States

  • off (TV screen is dark)
  • standby (standard UI is active - not apps)
  • idle (screen saver is active)
  • play (video is playing)
  • pause (video is paused)
  • disconnected (can't communicate with device)


  • turn_on (turn on the device, showing the UI on screen)
  • turn_off (turn off the device, screen goes dark)
  • home (emulate Home button)
  • media_play_pause (emulate Play/Pause button)
  • media_play (simulate Play button)
  • media_pause (simulate Pause button)
  • media_next (emulate Fast-Forward button)
  • media_previous (emulate Rewind button)
  • volume_up (raise volume)
  • volume_down (lower volume)


  • GET /devices/<device_id>/apps/running
  • /devices/<device_id>/apps/state/<app_id>
  • /devices/<device_id>/apps/<app_id>/state

app_id can be anything from a single word, e.g. 'netflix' or the full package name, e.g.

You can start or stop an app with the following commands:

  • GET /devices/<device_id>/apps/<app_id>/start
  • GET /devices/<device_id>/apps/<app_id>/stop

app_id must be a package name, e.g. org.xbmc.kodi or

Python 3

firetv depends on python-adb, a pure-python implementation of the ADB protocol. It and its dependency M2Crypto are written for Python 2. Until they support Python 3, or an alternative is available, firetv will not support Python 3. The HTTP server is provided as a way for Python 3 (or other) software to utilize the features of firetv.


This package does not fully exploit the potential of ADB access to Amazon Fire TV devices, and lacks some robustness. Contributions are welcome.

Local development using Docker

Run the following commands in the root of this repo to generate a docker container and run the tool. Update folders as needed, this assumes you have a test configuration file in ./config

$currentPath = (get-Location).Path
$currentPath = "{0}/config" -f $currentPath.Replace('\','/')
docker build -t local-docker-firetv -f .\Dockerfile.development .\; docker run  -it --rm -v $("{0}:/config" -f $currentPath) --name local-python-firetv -p 5556:5556 local-docker-firetv -v -c /config/house.yaml
Docker Pull Command
Source Repository