androidtv package

Subpackages

Submodules

Module contents

Connect to a device and determine whether it’s an Android TV or an Amazon Fire TV.

ADB Debugging must be enabled.

androidtv.ha_state_detection_rules_validator(exc)[source]

Validate the rules (i.e., the state_detection_rules value) for a given app ID (i.e., a key in state_detection_rules).

See BaseTV for more info about the state_detection_rules parameter.

Parameters:

exc (Exception) – The exception that will be raised if a rule is invalid

Returns:

wrapped_state_detection_rules_validator – A function that is the same as state_detection_rules_validator(), but with the exc argument provided

Return type:

function

androidtv.setup(host, port=5555, adbkey='', adb_server_ip='', adb_server_port=5037, state_detection_rules=None, device_class='auto', auth_timeout_s=10.0, signer=None, transport_timeout_s=1.0, log_errors=True)[source]

Connect to a device and determine whether it’s an Android TV or an Amazon Fire TV.

Parameters:
  • host (str) – The address of the device; may be an IP address or a host name

  • port (int) – The device port to which we are connecting (default is 5555)

  • adbkey (str) – The path to the adbkey file for ADB authentication

  • adb_server_ip (str) – The IP address of the ADB server

  • adb_server_port (int) – The port for the ADB server

  • state_detection_rules (dict, None) – A dictionary of rules for determining the state (see BaseTV)

  • device_class (str) – The type of device: 'auto' (detect whether it is an Android TV or Fire TV device), 'androidtv', or 'firetv'`

  • auth_timeout_s (float) – Authentication timeout (in seconds)

  • signer (PythonRSASigner, None) – The signer for the ADB keys, as loaded by androidtv.adb_manager.adb_manager_sync.ADBPythonSync.load_adbkey()

  • transport_timeout_s (float) – Transport timeout (in seconds)

  • log_errors (bool) – Whether connection errors should be logged

Returns:

The representation of the device

Return type:

AndroidTVSync, FireTVSync