Esempio n. 1
0
async def async_validate_config_item(hass, config, full_config=None):
    """Validate config item."""
    config = PLATFORM_SCHEMA(config)

    triggers = []
    for trigger in config[CONF_TRIGGER]:
        trigger_platform = importlib.import_module(
            f"..{trigger[CONF_PLATFORM]}", __name__)
        if hasattr(trigger_platform, "async_validate_trigger_config"):
            trigger = await trigger_platform.async_validate_trigger_config(
                hass, trigger)
        triggers.append(trigger)
    config[CONF_TRIGGER] = triggers

    if CONF_CONDITION in config:
        config[CONF_CONDITION] = await asyncio.gather(*[
            condition.async_validate_condition_config(hass, cond)
            for cond in config[CONF_CONDITION]
        ])

    config[CONF_ACTION] = await asyncio.gather(*[
        script.async_validate_action_config(hass, action)
        for action in config[CONF_ACTION]
    ])

    return config
Esempio n. 2
0
async def async_validate_config_item(hass, config, full_config=None):
    """Validate config item."""
    config = SCRIPT_ENTRY_SCHEMA(config)
    config[CONF_SEQUENCE] = await asyncio.gather(*[
        async_validate_action_config(hass, action)
        for action in config[CONF_SEQUENCE]
    ])

    return config
Esempio n. 3
0
async def async_validate_config_item(hass, config, full_config=None):
    """Validate config item."""
    if is_blueprint_instance_config(config):
        blueprints = async_get_blueprints(hass)
        return await blueprints.async_inputs_from_config(config)

    config = SCRIPT_ENTITY_SCHEMA(config)
    config[CONF_SEQUENCE] = await asyncio.gather(
        *(async_validate_action_config(hass, action)
          for action in config[CONF_SEQUENCE]))

    return config
Esempio n. 4
0
async def async_validate_config_item(hass, config, full_config=None):
    """Validate config item."""
    config = PLATFORM_SCHEMA(config)

    config[CONF_TRIGGER] = await async_validate_trigger_config(
        hass, config[CONF_TRIGGER])

    if CONF_CONDITION in config:
        config[CONF_CONDITION] = await asyncio.gather(*[
            async_validate_condition_config(hass, cond)
            for cond in config[CONF_CONDITION]
        ])

    config[CONF_ACTION] = await asyncio.gather(*[
        async_validate_action_config(hass, action)
        for action in config[CONF_ACTION]
    ])

    return config