Exemple #1
0
    cv.ipv4,
    cv.Optional(CONF_DNS2, default="0.0.0.0"):
    cv.ipv4,
})

EAP_AUTH_SCHEMA = cv.All(
    cv.Schema({
        cv.Optional(CONF_IDENTITY):
        cv.string_strict,
        cv.Optional(CONF_USERNAME):
        cv.string_strict,
        cv.Optional(CONF_PASSWORD):
        cv.string_strict,
        cv.Optional(CONF_CERTIFICATE_AUTHORITY):
        wpa2_eap.validate_certificate,
        cv.Inclusive(CONF_CERTIFICATE, "certificate_and_key"):
        wpa2_eap.validate_certificate,
        # Only validate as file first because we need the password to load it
        # Actual validation happens in validate_eap.
        cv.Inclusive(CONF_KEY, "certificate_and_key"):
        cv.file_,
    }),
    wpa2_eap.validate_eap,
    cv.has_at_least_one_key(CONF_IDENTITY, CONF_CERTIFICATE),
)

WIFI_NETWORK_BASE = cv.Schema({
    cv.GenerateID():
    cv.declare_id(WiFiAP),
    cv.Optional(CONF_SSID):
    cv.ssid,
Exemple #2
0
CONF_MIN_VALUE_DATAPOINT = "min_value_datapoint"
CONF_COLOR_TEMPERATURE_DATAPOINT = "color_temperature_datapoint"
CONF_COLOR_TEMPERATURE_MAX_VALUE = "color_temperature_max_value"

TuyaLight = tuya_ns.class_("TuyaLight", light.LightOutput, cg.Component)

CONFIG_SCHEMA = cv.All(
    light.BRIGHTNESS_ONLY_LIGHT_SCHEMA.extend(
        {
            cv.GenerateID(CONF_OUTPUT_ID): cv.declare_id(TuyaLight),
            cv.GenerateID(CONF_TUYA_ID): cv.use_id(Tuya),
            cv.Optional(CONF_DIMMER_DATAPOINT): cv.uint8_t,
            cv.Optional(CONF_MIN_VALUE_DATAPOINT): cv.uint8_t,
            cv.Optional(CONF_SWITCH_DATAPOINT): cv.uint8_t,
            cv.Inclusive(
                CONF_COLOR_TEMPERATURE_DATAPOINT, "color_temperature"
            ): cv.uint8_t,
            cv.Optional(CONF_MIN_VALUE): cv.int_,
            cv.Optional(CONF_MAX_VALUE): cv.int_,
            cv.Optional(CONF_COLOR_TEMPERATURE_MAX_VALUE): cv.int_,
            cv.Inclusive(
                CONF_COLD_WHITE_COLOR_TEMPERATURE, "color_temperature"
            ): cv.color_temperature,
            cv.Inclusive(
                CONF_WARM_WHITE_COLOR_TEMPERATURE, "color_temperature"
            ): cv.color_temperature,
            # Change the default gamma_correct and default transition length settings.
            # The Tuya MCU handles transitions and gamma correction on its own.
            cv.Optional(CONF_GAMMA_CORRECT, default=1.0): cv.positive_float,
            cv.Optional(
                CONF_DEFAULT_TRANSITION_LENGTH, default="0s"
Exemple #3
0
STA_MANUAL_IP_SCHEMA = AP_MANUAL_IP_SCHEMA.extend(
    {
        cv.Optional(CONF_DNS1, default="0.0.0.0"): cv.ipv4,
        cv.Optional(CONF_DNS2, default="0.0.0.0"): cv.ipv4,
    }
)

EAP_AUTH_SCHEMA = cv.All(
    cv.Schema(
        {
            cv.Optional(CONF_IDENTITY): cv.string_strict,
            cv.Optional(CONF_USERNAME): cv.string_strict,
            cv.Optional(CONF_PASSWORD): cv.string_strict,
            cv.Optional(CONF_CERTIFICATE_AUTHORITY): wpa2_eap.validate_certificate,
            cv.Inclusive(
                CONF_CERTIFICATE, "certificate_and_key"
            ): wpa2_eap.validate_certificate,
            # Only validate as file first because we need the password to load it
            # Actual validation happens in validate_eap.
            cv.Inclusive(CONF_KEY, "certificate_and_key"): cv.file_,
        }
    ),
    wpa2_eap.validate_eap,
    cv.has_at_least_one_key(CONF_IDENTITY, CONF_CERTIFICATE),
)

WIFI_NETWORK_BASE = cv.Schema(
    {
        cv.GenerateID(): cv.declare_id(WiFiAP),
        cv.Optional(CONF_SSID): cv.ssid,
        cv.Optional(CONF_PASSWORD): validate_password,
Exemple #4
0
slow_pwm_ns = cg.esphome_ns.namespace("slow_pwm")
SlowPWMOutput = slow_pwm_ns.class_("SlowPWMOutput", output.FloatOutput,
                                   cg.Component)

CONF_STATE_CHANGE_ACTION = "state_change_action"
CONF_RESTART_CYCLE_ON_STATE_CHANGE = "restart_cycle_on_state_change"

CONFIG_SCHEMA = output.FLOAT_OUTPUT_SCHEMA.extend({
    cv.Required(CONF_ID):
    cv.declare_id(SlowPWMOutput),
    cv.Optional(CONF_PIN):
    pins.gpio_output_pin_schema,
    cv.Inclusive(
        CONF_TURN_ON_ACTION,
        "on_off",
        f"{CONF_TURN_ON_ACTION} and {CONF_TURN_OFF_ACTION} must both be defined",
    ):
    automation.validate_automation(single=True),
    cv.Inclusive(
        CONF_TURN_OFF_ACTION,
        "on_off",
        f"{CONF_TURN_ON_ACTION} and {CONF_TURN_OFF_ACTION} must both be defined",
    ):
    automation.validate_automation(single=True),
    cv.Optional(CONF_STATE_CHANGE_ACTION):
    automation.validate_automation(single=True),
    cv.Required(CONF_PERIOD):
    cv.All(
        cv.positive_time_period_milliseconds,
        cv.Range(min=core.TimePeriod(milliseconds=100)),
Exemple #5
0
    cv.ipv4,
    cv.Optional(CONF_DNS2, default="0.0.0.0"):
    cv.ipv4,
})

EAP_AUTH_SCHEMA = cv.All(
    cv.Schema({
        cv.Optional(CONF_IDENTITY):
        cv.string_strict,
        cv.Optional(CONF_USERNAME):
        cv.string_strict,
        cv.Optional(CONF_PASSWORD):
        cv.string_strict,
        cv.Optional(CONF_CERTIFICATE_AUTHORITY):
        wpa2_eap.validate_certificate,
        cv.Inclusive(CONF_CERTIFICATE, 'certificate_and_key'):
        wpa2_eap.validate_certificate,
        # Only validate as file first because we need the password to load it
        # Actual validation happens in validate_eap.
        cv.Inclusive(CONF_KEY, 'certificate_and_key'):
        cv.file_,
    }),
    wpa2_eap.validate_eap,
    cv.has_at_least_one_key(CONF_IDENTITY, CONF_CERTIFICATE))

WIFI_NETWORK_BASE = cv.Schema({
    cv.GenerateID():
    cv.declare_id(WiFiAP),
    cv.Optional(CONF_SSID):
    cv.ssid,
    cv.Optional(CONF_PASSWORD):