Exemple #1
0
from custom_components.hacs.const import DOMAIN, ELEMENT_TYPES, STARTUP, VERSION
from custom_components.hacs.constrains import check_constrains
from custom_components.hacs.helpers.remaining_github_calls import get_fetch_updates_for
from custom_components.hacs.hacsbase.configuration import Configuration
from custom_components.hacs.hacsbase.data import HacsData
from custom_components.hacs.setup import (
    add_sensor,
    load_hacs_repository,
    setup_frontend,
)

from custom_components.hacs.globals import get_hacs

from custom_components.hacs.helpers.network import internet_connectivity_check

CONFIG_SCHEMA = vol.Schema({DOMAIN: hacs_config_combined()},
                           extra=vol.ALLOW_EXTRA)


async def async_setup(hass, config):
    """Set up this integration using yaml."""
    hacs = get_hacs()
    if DOMAIN not in config:
        return True
    if hacs.configuration and hacs.configuration.config_type == "flow":
        return True
    hass.data[DOMAIN] = config
    hacs.hass = hass
    hacs.session = async_create_clientsession(hass)
    hacs.configuration = Configuration.from_dict(config[DOMAIN])
    hacs.configuration.config = config
Exemple #2
0
from custom_components.hacs.constrains import check_constrains
from custom_components.hacs.helpers.remaining_github_calls import get_fetch_updates_for
from custom_components.hacs.hacsbase.configuration import Configuration
from custom_components.hacs.hacsbase.data import HacsData
from custom_components.hacs.setup import (
    clear_storage,
    add_sensor,
    load_hacs_repository,
    setup_frontend,
)

from custom_components.hacs.globals import get_hacs

from custom_components.hacs.helpers.network import internet_connectivity_check

CONFIG_SCHEMA = vol.Schema({DOMAIN: hacs_config_combined()}, extra=vol.ALLOW_EXTRA)


async def async_setup(hass, config):
    """Set up this integration using yaml."""
    hacs = get_hacs()
    if DOMAIN not in config:
        return True
    if hacs.configuration and hacs.configuration.config_type == "flow":
        return True

    configuration = config[DOMAIN]

    if configuration.get(FRONTEND_REPO) and configuration.get(FRONTEND_REPO_URL):
        hacs.logger.critical("Could not setup HACS, set only one of ('frontend_repo', 'frontend_repo_url)")
Exemple #3
0
def test_combined():
    assert isinstance(hacs_config_combined(), dict)