Mark esp32_touch supported only on standard esp32 variant (#4562)

* Mark esp32_touch supported only on standard esp32 variant

* Add back default
This commit is contained in:
Jesse Hills 2023-03-15 20:42:33 +13:00 committed by GitHub
parent d3f2b93c42
commit 215107e8ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,6 +11,7 @@ from esphome.const import (
CONF_VOLTAGE_ATTENUATION,
)
from esphome.core import TimePeriod
from esphome.components import esp32
AUTO_LOAD = ["binary_sensor"]
DEPENDENCIES = ["esp32"]
@ -50,30 +51,37 @@ VOLTAGE_ATTENUATION = {
"0V": cg.global_ns.TOUCH_HVOLT_ATTEN_0V,
}
CONFIG_SCHEMA = cv.Schema(
{
cv.GenerateID(): cv.declare_id(ESP32TouchComponent),
cv.Optional(CONF_SETUP_MODE, default=False): cv.boolean,
cv.Optional(
CONF_IIR_FILTER, default="0ms"
): cv.positive_time_period_milliseconds,
cv.Optional(CONF_SLEEP_DURATION, default="27306us"): cv.All(
cv.positive_time_period, cv.Range(max=TimePeriod(microseconds=436906))
),
cv.Optional(CONF_MEASUREMENT_DURATION, default="8192us"): cv.All(
cv.positive_time_period, cv.Range(max=TimePeriod(microseconds=8192))
),
cv.Optional(CONF_LOW_VOLTAGE_REFERENCE, default="0.5V"): validate_voltage(
LOW_VOLTAGE_REFERENCE
),
cv.Optional(CONF_HIGH_VOLTAGE_REFERENCE, default="2.7V"): validate_voltage(
HIGH_VOLTAGE_REFERENCE
),
cv.Optional(CONF_VOLTAGE_ATTENUATION, default="0V"): validate_voltage(
VOLTAGE_ATTENUATION
),
}
).extend(cv.COMPONENT_SCHEMA)
CONFIG_SCHEMA = cv.All(
cv.Schema(
{
cv.GenerateID(): cv.declare_id(ESP32TouchComponent),
cv.Optional(CONF_SETUP_MODE, default=False): cv.boolean,
cv.Optional(
CONF_IIR_FILTER, default="0ms"
): cv.positive_time_period_milliseconds,
cv.Optional(CONF_SLEEP_DURATION, default="27306us"): cv.All(
cv.positive_time_period, cv.Range(max=TimePeriod(microseconds=436906))
),
cv.Optional(CONF_MEASUREMENT_DURATION, default="8192us"): cv.All(
cv.positive_time_period, cv.Range(max=TimePeriod(microseconds=8192))
),
cv.Optional(CONF_LOW_VOLTAGE_REFERENCE, default="0.5V"): validate_voltage(
LOW_VOLTAGE_REFERENCE
),
cv.Optional(CONF_HIGH_VOLTAGE_REFERENCE, default="2.7V"): validate_voltage(
HIGH_VOLTAGE_REFERENCE
),
cv.Optional(CONF_VOLTAGE_ATTENUATION, default="0V"): validate_voltage(
VOLTAGE_ATTENUATION
),
}
).extend(cv.COMPONENT_SCHEMA),
esp32.only_on_variant(
supported=[
esp32.const.VARIANT_ESP32,
]
),
)
async def to_code(config):