androidtv.firetv module¶
Communicate with an Amazon Fire TV device via ADB over a network.
ADB Debugging must be enabled.
-
class
androidtv.firetv.FireTV(host, adbkey='', adb_server_ip='', adb_server_port=5037)[source]¶ Bases:
androidtv.basetv.BaseTVRepresentation of an Amazon Fire TV device.
-
DEVICE_CLASS= 'firetv'¶
-
_send_intent(pkg, intent, count=1)[source]¶ Send an intent to the device.
Parameters: - pkg (str) – The command that will be sent is
monkey -p <intent> -c <pkg> <count>; echo $? - intent (str) – The command that will be sent is
monkey -p <intent> -c <pkg> <count>; echo $? - count (int, str) – The command that will be sent is
monkey -p <intent> -c <pkg> <count>; echo $?
Returns: A dictionary with keys
'output'and'retcode', if they could be determined; otherwise, an empty dictionaryReturn type: dict
- pkg (str) – The command that will be sent is
-
get_properties(get_running_apps=True, lazy=False)[source]¶ Get the properties needed for Home Assistant updates.
Parameters: - get_running_apps (bool) – Whether or not to get the
running_appsproperty - lazy (bool) – Whether or not to continue retrieving properties if the device is off or the screensaver is running
Returns: - screen_on (bool, None) – Whether or not the device is on, or
Noneif it was not determined - awake (bool, None) – Whether or not the device is awake (screensaver is not running), or
Noneif it was not determined - wake_lock_size (int, None) – The size of the current wake lock, or
Noneif it was not determined - media_session_state (int, None) – The state from the output of
dumpsys media_session, orNoneif it was not determined - current_app (dict, None) – The current app property, or
Noneif it was not determined - running_apps (list, None) – A list of the running apps, or
Noneif it was not determined
- get_running_apps (bool) – Whether or not to get the
-
get_properties_dict(get_running_apps=True, lazy=True)[source]¶ Get the properties needed for Home Assistant updates and return them as a dictionary.
Parameters: - get_running_apps (bool) – Whether or not to get the
running_appsproperty - lazy (bool) – Whether or not to continue retrieving properties if the device is off or the screensaver is running
Returns: A dictionary with keys
'screen_on','awake','wake_lock_size','media_session_state','current_app', and'running_apps'Return type: dict
- get_running_apps (bool) – Whether or not to get the
-
launch_app(app)[source]¶ Launch an app.
Parameters: app (str) – The ID of the app that will be launched Returns: A dictionary with keys 'output'and'retcode', if they could be determined; otherwise, an empty dictionaryReturn type: dict
-
stop_app(app)[source]¶ Stop an app.
Parameters: app (str) – The ID of the app that will be stopped Returns: The output of the am force-stopADB shell command, orNoneif the device is unavailableReturn type: str, None
-
update(get_running_apps=True)[source]¶ Get the info needed for a Home Assistant update.
Parameters: get_running_apps (bool) – Whether or not to get the running_appspropertyReturns: - state (str) – The state of the device
- current_app (str) – The current running app
- running_apps (list) – A list of the running apps if
get_running_appsis True, otherwise the list[current_app]
-