androidtv.androidtv module¶
Communicate with an Android TV device via ADB over a network.
ADB Debugging must be enabled.
-
class
androidtv.androidtv.
AndroidTV
(host, adbkey='', adb_server_ip='', adb_server_port=5037)[source]¶ Bases:
androidtv.basetv.BaseTV
Representation of an Android TV device.
-
DEVICE_CLASS
= 'androidtv'¶
-
audio_state
¶ Check if audio is playing, paused, or idle.
Returns: The audio state, as determined from the ADB shell command dumpsys audio
, orNone
if it could not be determinedReturn type: str, None
-
device
¶ Get the current playback device.
Returns: The current playback device, or None
if it could not be determinedReturn type: str, None
-
get_properties
(lazy=False)[source]¶ Get the properties needed for Home Assistant updates.
Parameters: 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
None
if it was not determined - awake (bool, None) – Whether or not the device is awake (screensaver is not running), or
None
if it was not determined - wake_lock_size (int, None) – The size of the current wake lock, or
None
if it was not determined - media_session_state (int, None) – The state from the output of
dumpsys media_session
, orNone
if it was not determined - current_app (dict, None) – The current app property, or
None
if it was not determined - audio_state (str, None) – The audio state, as determined from “dumpsys audio”, or
None
if it was not determined - device (str, None) – The current playback device, or
None
if it was not determined - muted (bool, None) – Whether or not the volume is muted, or
None
if it was not determined - volume_level (int, None) – The absolute volume level, or
None
if it was not determined
- screen_on (bool, None) – Whether or not the device is on, or
-
get_properties_dict
(lazy=True)[source]¶ Get the properties needed for Home Assistant updates and return them as a dictionary.
Parameters: 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'
,'audio_state'
,'device'
,'muted'
, and'volume_level'
Return type: dict
-
muted
¶ Whether or not the volume is muted.
Returns: Whether or not the volume is muted, or None
if it could not be determinedReturn type: bool, None
-
start_intent
(uri)[source]¶ Start an intent on the device.
Parameters: uri (str) – The intent that will be sent is am start -a android.intent.action.VIEW -d <uri>
-
update
()[source]¶ Get the info needed for a Home Assistant update.
Returns: - state (str) – The state of the device
- current_app (str) – The current running app
- device (str) – The current playback device
- muted (bool) – Whether or not the volume is muted
- volume (float) – The volume level (between 0 and 1)
-
volume
¶ Get the relative volume level.
Returns: The volume level (between 0 and 1), or None
if it could not be determinedReturn type: float, None
-
volume_level
¶ Get the absolute volume level.
Returns: The absolute volume level, or None
if it could not be determinedReturn type: int, None
-