androidtv.basetv module¶
Communicate with an Android TV or Amazon Fire TV device via ADB over a network.
ADB Debugging must be enabled.
-
class
androidtv.basetv.BaseTV(host, adbkey='', adb_server_ip='', adb_server_port=5037)[source]¶ Bases:
objectBase class for representing an Android TV / Fire TV device.
-
available¶ Check whether the ADB connection is intact.
Returns: Whether or not the ADB connection is intact Return type: bool
-
awake¶ Check if the device is awake (screensaver is not running).
Returns: Whether or not the device is awake (screensaver is not running) Return type: bool
-
connect(always_log_errors=True)[source]¶ Connect to an Android TV / Fire TV device.
Parameters: always_log_errors (bool) – If True, errors will always be logged; otherwise, errors will only be logged on the first failed reconnect attempt Returns: Whether or not the connection was successfully established and the device is available Return type: bool
-
current_app¶ Return the current app.
Returns: A dictionary with keys 'package'and'activity'if the current app was found; otherwise,NoneReturn type: dict
-
get_device_properties()[source]¶ Return a dictionary of device properties.
Returns: props – A dictionary with keys 'wifimac','ethmac','serialno','manufacturer','model', and'sw_version'Return type: dict
-
manufacturer¶ Get the ‘manufacturer’ property from the device.
Returns: The manufacturer of the device Return type: str, None
-
media_session_state¶ Get the state from the output of
dumpsys media_session.Returns: The state from the output of the ADB shell command dumpsys media_session, orNoneif it could not be determinedReturn type: int, None
Send menu action.
-
screen_on¶ Check if the screen is on.
Returns: Whether or not the device is on Return type: bool
-
wake_lock¶ Check for wake locks (device is playing).
Returns: Whether or not the wake_lock_sizeproperty is equal to 1.Return type: bool
-
wake_lock_size¶ Get the size of the current wake lock.
Returns: The size of the current wake lock, or Noneif it could not be determinedReturn type: int, None
-