aio_androidtv.androidtv module¶
Communicate with an Android TV device via ADB over a network.
ADB Debugging must be enabled.
-
class
aio_androidtv.androidtv.AndroidTV(host, port=5555, adbkey='', state_detection_rules=None)[source]¶ Bases:
aio_androidtv.basetv.BaseTVRepresentation 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
adbkeyfile for ADB authenticationstate_detection_rules (dict, None) – A dictionary of rules for determining the state (see
BaseTV)
-
DEVICE_CLASS= 'androidtv'¶
-
async
get_properties(get_running_apps=True, lazy=False)[source]¶ Get the properties needed for Home Assistant updates.
This will send one of the following ADB commands:
aio_androidtv.constants.CMD_ANDROIDTV_PROPERTIES_LAZYaio_androidtv.constants.CMD_ANDROIDTV_PROPERTIES_NOT_LAZY
- Parameters
get_running_apps (bool) – Whether or not to get the
running_apps()propertylazy (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 determinedawake (bool, None) – Whether or not the device is awake (screensaver is not running), or
Noneif it was not determinedaudio_state (str, None) – The audio state, as determined from “dumpsys audio”, or
Noneif it was not determinedwake_lock_size (int, None) – The size of the current wake lock, or
Noneif it was not determinedcurrent_app (str, None) – The current app property, or
Noneif it was not determinedmedia_session_state (int, None) – The state from the output of
dumpsys media_session, orNoneif it was not determinedaudio_output_device (str, None) – The current audio playback device, or
Noneif it was not determinedis_volume_muted (bool, None) – Whether or not the volume is muted, or
Noneif it was not determinedvolume (int, None) – The absolute volume level, or
Noneif it was not determinedrunning_apps (list, None) – A list of the running apps, or
Noneif it was not determined
-
async
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_apps()propertylazy (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','current_app','media_session_state','audio_state','audio_output_device','is_volume_muted','volume', and'running_apps'- Return type
dict
-
async
running_apps()[source]¶ Return a list of running user applications.
- Returns
A list of the running apps
- Return type
list
-
async
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_apps()property- 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_appsis 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)