androidtv.firetv.base_firetv module¶
Communicate with an Amazon Fire TV device via ADB over a network.
ADB Debugging must be enabled.
-
class
androidtv.firetv.base_firetv.
BaseFireTV
(host, port=5555, adbkey='', adb_server_ip='', adb_server_port=5037, state_detection_rules=None)[source]¶ Bases:
androidtv.basetv.basetv.BaseTV
Representation of an Amazon Fire TV device.
- 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 authenticationadb_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
= 'firetv'¶
-
_get_properties
(output, get_running_apps=True)[source]¶ Get the properties needed for Home Assistant updates.
This will send one of the following ADB commands:
androidtv.constants.CMD_FIRETV_PROPERTIES_LAZY_NO_RUNNING_APPS
androidtv.constants.CMD_FIRETV_PROPERTIES_NOT_LAZY_RUNNING_APPS
androidtv.constants.CMD_FIRETV_PROPERTIES_NOT_LAZY_NO_RUNNING_APPS
- Parameters
output (str, None) – The output of the ADB command used to retrieve the properties
get_running_apps (bool) – Whether or not to get the
running_apps
property
- Returns
screen_on (bool, None) – Whether or not the device is on, or
None
if it was not determinedawake (bool, None) – Whether or not the device is awake (screensaver is not running), or
None
if it was not determinedwake_lock_size (int, None) – The size of the current wake lock, or
None
if it was not determinedcurrent_app (str, None) – The current app property, or
None
if it was not determinedmedia_session_state (int, None) – The state from the output of
dumpsys media_session
, orNone
if it was not determinedrunning_apps (list, None) – A list of the running apps, or
None
if it was not determined
-
_update
(screen_on, awake, wake_lock_size, current_app, media_session_state, running_apps)[source]¶ Get the info needed for a Home Assistant update.
- Parameters
screen_on (bool, None) – Whether or not the device is on, or
None
if it was not determinedawake (bool, None) – Whether or not the device is awake (screensaver is not running), or
None
if it was not determinedwake_lock_size (int, None) – The size of the current wake lock, or
None
if it was not determinedcurrent_app (str, None) – The current app property, or
None
if it was not determinedmedia_session_state (int, None) – The state from the output of
dumpsys media_session
, orNone
if it was not determinedrunning_apps (list, None) – A list of the running apps, or
None
if it was not determined
- Returns
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_apps
is True, otherwise the list[current_app]