mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 14:19:03 +00:00
[multiple] Fix validation ranges (batch 2) (#15533)
This commit is contained in:
@@ -37,7 +37,7 @@ CONFIG_SCHEMA = cv.All(
|
||||
cv.Optional(CONF_GAS_MBUS_ID, default=1): cv.int_,
|
||||
cv.Optional(CONF_WATER_MBUS_ID, default=2): cv.int_,
|
||||
cv.Optional(CONF_THERMAL_MBUS_ID, default=3): cv.int_,
|
||||
cv.Optional(CONF_MAX_TELEGRAM_LENGTH, default=1500): cv.int_,
|
||||
cv.Optional(CONF_MAX_TELEGRAM_LENGTH, default=1500): cv.int_range(min=1),
|
||||
cv.Optional(CONF_REQUEST_PIN): pins.gpio_output_pin_schema,
|
||||
cv.Optional(
|
||||
CONF_REQUEST_INTERVAL, default="0ms"
|
||||
|
||||
@@ -131,7 +131,7 @@ async def hlk_fm22x_enroll_to_code(config, action_id, template_arg, args):
|
||||
cv.maybe_simple_value(
|
||||
{
|
||||
cv.GenerateID(): cv.use_id(HlkFm22xComponent),
|
||||
cv.Required(CONF_FACE_ID): cv.templatable(cv.uint16_t),
|
||||
cv.Required(CONF_FACE_ID): cv.templatable(cv.int_range(min=0, max=32767)),
|
||||
},
|
||||
key=CONF_FACE_ID,
|
||||
),
|
||||
|
||||
@@ -28,7 +28,7 @@ CONFIG_SCHEMA = cv.Schema(
|
||||
is_polling_component=False,
|
||||
)
|
||||
)
|
||||
.extend({cv.Required(CONF_MEMORY_DATA): cv.hex_int_range()}),
|
||||
.extend({cv.Required(CONF_MEMORY_DATA): cv.hex_int_range(min=0x00, max=0xFF)}),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -37,8 +37,12 @@ CONFIG_SCHEMA = cv.Schema(
|
||||
)
|
||||
.extend(
|
||||
{
|
||||
cv.Optional(CONF_MEMORY_DATA_OFF, default=0x06): cv.hex_int_range(),
|
||||
cv.Optional(CONF_MEMORY_DATA_ON, default=0x01): cv.hex_int_range(),
|
||||
cv.Optional(CONF_MEMORY_DATA_OFF, default=0x06): cv.hex_int_range(
|
||||
min=0x00, max=0xFF
|
||||
),
|
||||
cv.Optional(CONF_MEMORY_DATA_ON, default=0x01): cv.hex_int_range(
|
||||
min=0x00, max=0xFF
|
||||
),
|
||||
}
|
||||
),
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ PCA6416A_PIN_SCHEMA = cv.All(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(PCA6416AGPIOPin),
|
||||
cv.Required(CONF_PCA6416A): cv.use_id(PCA6416AComponent),
|
||||
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=16),
|
||||
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=15),
|
||||
cv.Optional(CONF_MODE, default={}): cv.All(
|
||||
{
|
||||
cv.Optional(CONF_INPUT, default=False): cv.boolean,
|
||||
|
||||
@@ -55,7 +55,7 @@ def validate_mode(value):
|
||||
|
||||
PCF8574_PIN_SCHEMA = pins.gpio_base_schema(
|
||||
PCF8574GPIOPin,
|
||||
cv.int_range(min=0, max=17),
|
||||
cv.int_range(min=0, max=15),
|
||||
modes=[CONF_INPUT, CONF_OUTPUT],
|
||||
mode_validator=validate_mode,
|
||||
invertible=True,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from esphome import core
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import binary_sensor, esp32_ble_tracker
|
||||
import esphome.config_validation as cv
|
||||
@@ -21,9 +22,10 @@ CONFIG_SCHEMA = cv.All(
|
||||
.extend(
|
||||
{
|
||||
cv.Required(CONF_MAC_ADDRESS): cv.mac_address,
|
||||
cv.Optional(
|
||||
CONF_TIMEOUT, default="5s"
|
||||
): cv.positive_time_period_milliseconds,
|
||||
cv.Optional(CONF_TIMEOUT, default="5s"): cv.All(
|
||||
cv.positive_time_period_milliseconds,
|
||||
cv.Range(max=core.TimePeriod(milliseconds=65535)),
|
||||
),
|
||||
}
|
||||
)
|
||||
.extend(esp32_ble_tracker.ESP_BLE_DEVICE_SCHEMA)
|
||||
|
||||
Reference in New Issue
Block a user