How to use the androidtv.AndroidTV function in androidtv

To help you get started, we’ve selected a few androidtv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github frenck / home-assistant-config / config / custom_components / androidtv / media_player.py View on Github external
if CONF_ADB_SERVER_IP not in config:
        atv = AndroidTV(host)
        if not atv.available:
            # "python-adb" with adbkey
            if CONF_ADBKEY in config:
                adbkey = config[CONF_ADBKEY]
            else:
                adbkey = DEFAULT_ADBKEY
            atv = AndroidTV(host, adbkey)
            adb_log = " using adbkey='{0}'".format(adbkey)
        else:
            adb_log = ""

    else:
        # "pure-python-adb"
        atv = AndroidTV(
            host,
            adb_server_ip=config[CONF_ADB_SERVER_IP],
            adb_server_port=config[CONF_ADB_SERVER_PORT])
        adb_log = " using ADB server at {0}:{1}".format(
            config[CONF_ADB_SERVER_IP], config[CONF_ADB_SERVER_PORT])

    if not atv.available:
        _LOGGER.warning(
            "Could not connect to Android TV at %s%s", host, adb_log)
        raise PlatformNotReady

    if host in hass.data[DATA_KEY]:
        _LOGGER.warning("Platform already setup on %s, skipping.", host)
    else:
        device = AndroidTVDevice(atv, name, config[CONF_APPS])
        add_entities([device])
github mcfrojd / hassio_lovelace_multiremote / custom_components / androidtv / media_player.py View on Github external
if CONF_ADB_SERVER_IP not in config:
        atv = AndroidTV(host)
        if not atv.available:
            # "python-adb" with adbkey
            if CONF_ADBKEY in config:
                adbkey = config[CONF_ADBKEY]
            else:
                adbkey = DEFAULT_ADBKEY
            atv = AndroidTV(host, adbkey)
            adb_log = " using adbkey='{0}'".format(adbkey)
        else:
            adb_log = ""

    else:
        # "pure-python-adb"
        atv = AndroidTV(
            host,
            adb_server_ip=config[CONF_ADB_SERVER_IP],
            adb_server_port=config[CONF_ADB_SERVER_PORT])
        adb_log = " using ADB server at {0}:{1}".format(
            config[CONF_ADB_SERVER_IP], config[CONF_ADB_SERVER_PORT])

    if not atv.available:
        _LOGGER.warning(
            "Could not connect to Android TV at %s%s", host, adb_log)
        raise PlatformNotReady

    if host in hass.data[DATA_KEY]:
        _LOGGER.warning("Platform already setup on %s, skipping.", host)
    else:
        device = AndroidTVDevice(atv, name, config[CONF_APPS])
        add_entities([device])
github mcfrojd / hassio_lovelace_multiremote / custom_components / androidtv / media_player.py View on Github external
from androidtv import AndroidTV
    if DATA_KEY not in hass.data:
        hass.data[DATA_KEY] = {}

    host = '{0}:{1}'.format(config[CONF_HOST], config[CONF_PORT])
    name = config.get(CONF_NAME)

    if CONF_ADB_SERVER_IP not in config:
        atv = AndroidTV(host)
        if not atv.available:
            # "python-adb" with adbkey
            if CONF_ADBKEY in config:
                adbkey = config[CONF_ADBKEY]
            else:
                adbkey = DEFAULT_ADBKEY
            atv = AndroidTV(host, adbkey)
            adb_log = " using adbkey='{0}'".format(adbkey)
        else:
            adb_log = ""

    else:
        # "pure-python-adb"
        atv = AndroidTV(
            host,
            adb_server_ip=config[CONF_ADB_SERVER_IP],
            adb_server_port=config[CONF_ADB_SERVER_PORT])
        adb_log = " using ADB server at {0}:{1}".format(
            config[CONF_ADB_SERVER_IP], config[CONF_ADB_SERVER_PORT])

    if not atv.available:
        _LOGGER.warning(
            "Could not connect to Android TV at %s%s", host, adb_log)
github frenck / home-assistant-config / config / custom_components / androidtv / media_player.py View on Github external
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the androidtv platform."""
    from androidtv import AndroidTV
    if DATA_KEY not in hass.data:
        hass.data[DATA_KEY] = {}

    host = '{0}:{1}'.format(config[CONF_HOST], config[CONF_PORT])
    name = config.get(CONF_NAME)

    if CONF_ADB_SERVER_IP not in config:
        atv = AndroidTV(host)
        if not atv.available:
            # "python-adb" with adbkey
            if CONF_ADBKEY in config:
                adbkey = config[CONF_ADBKEY]
            else:
                adbkey = DEFAULT_ADBKEY
            atv = AndroidTV(host, adbkey)
            adb_log = " using adbkey='{0}'".format(adbkey)
        else:
            adb_log = ""

    else:
        # "pure-python-adb"
        atv = AndroidTV(
            host,
            adb_server_ip=config[CONF_ADB_SERVER_IP],
github mcfrojd / hassio_lovelace_multiremote / custom_components / androidtv / media_player.py View on Github external
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the androidtv platform."""
    from androidtv import AndroidTV
    if DATA_KEY not in hass.data:
        hass.data[DATA_KEY] = {}

    host = '{0}:{1}'.format(config[CONF_HOST], config[CONF_PORT])
    name = config.get(CONF_NAME)

    if CONF_ADB_SERVER_IP not in config:
        atv = AndroidTV(host)
        if not atv.available:
            # "python-adb" with adbkey
            if CONF_ADBKEY in config:
                adbkey = config[CONF_ADBKEY]
            else:
                adbkey = DEFAULT_ADBKEY
            atv = AndroidTV(host, adbkey)
            adb_log = " using adbkey='{0}'".format(adbkey)
        else:
            adb_log = ""

    else:
        # "pure-python-adb"
        atv = AndroidTV(
            host,
            adb_server_ip=config[CONF_ADB_SERVER_IP],
github frenck / home-assistant-config / config / custom_components / androidtv / media_player.py View on Github external
from androidtv import AndroidTV
    if DATA_KEY not in hass.data:
        hass.data[DATA_KEY] = {}

    host = '{0}:{1}'.format(config[CONF_HOST], config[CONF_PORT])
    name = config.get(CONF_NAME)

    if CONF_ADB_SERVER_IP not in config:
        atv = AndroidTV(host)
        if not atv.available:
            # "python-adb" with adbkey
            if CONF_ADBKEY in config:
                adbkey = config[CONF_ADBKEY]
            else:
                adbkey = DEFAULT_ADBKEY
            atv = AndroidTV(host, adbkey)
            adb_log = " using adbkey='{0}'".format(adbkey)
        else:
            adb_log = ""

    else:
        # "pure-python-adb"
        atv = AndroidTV(
            host,
            adb_server_ip=config[CONF_ADB_SERVER_IP],
            adb_server_port=config[CONF_ADB_SERVER_PORT])
        adb_log = " using ADB server at {0}:{1}".format(
            config[CONF_ADB_SERVER_IP], config[CONF_ADB_SERVER_PORT])

    if not atv.available:
        _LOGGER.warning(
            "Could not connect to Android TV at %s%s", host, adb_log)