androidtv.androidtv.base_androidtv module
Communicate with an Android TV device via ADB over a network.
ADB Debugging must be enabled.
- class androidtv.androidtv.base_androidtv.BaseAndroidTV(host, port=5555, adbkey='', adb_server_ip='', adb_server_port=5037, state_detection_rules=None)[source]
Bases:
BaseTV
Representation of an Android 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 = 'androidtv'
- DEVICE_ENUM = 1
- _update(screen_on, awake, audio_state, wake_lock_size, current_app, media_session_state, audio_output_device, is_volume_muted, volume, running_apps, hdmi_input)[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 determinedaudio_state (str, None) – The audio state, as determined from “dumpsys audio”, 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 determinedaudio_output_device (str, None) – The current audio playback device, or
None
if it was not determinedis_volume_muted (bool, None) – Whether or not the volume is muted, or
None
if it was not determinedvolume (int, None) – The absolute volume level, or
None
if it was not determinedrunning_apps (list, None) – A list of the running apps, or
None
if it was not determinedhdmi_input (str, None) – The HDMI input, or
None
if it could not be 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]
audio_output_device (str) – The current audio playback device
is_volume_muted (bool) – Whether or not the volume is muted
volume_level (float) – The volume level (between 0 and 1)
hdmi_input (str, None) – The HDMI input, or
None
if it could not be determined