mirror of
https://github.com/esphome/esphome.git
synced 2026-08-31 01:56:01 +00:00
[multiple] Fix misc cosmetic bugs (error messages, types, defaults) (#15499)
This commit is contained in:
@@ -390,7 +390,7 @@ def validate_multi_click_timing(value):
|
||||
new_state = v_.get(CONF_STATE, not state)
|
||||
if new_state == state:
|
||||
raise cv.Invalid(
|
||||
f"Timings must have alternating state. Indices {i} and {i + 1} have the same state {state}"
|
||||
f"Timings must have alternating state. Indices {i - 1} and {i} have the same state {state}"
|
||||
)
|
||||
if max_length is not None and max_length < min_length:
|
||||
raise cv.Invalid(
|
||||
|
||||
@@ -36,7 +36,7 @@ CONFIG_SCHEMA = (
|
||||
cv.Schema(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(lc709203f),
|
||||
cv.Optional(CONF_SIZE, default="500"): cv.int_range(100, 3000),
|
||||
cv.Optional(CONF_SIZE, default=500): cv.int_range(100, 3000),
|
||||
cv.Optional(CONF_VOLTAGE, default="3.7"): cv.enum(
|
||||
BATTERY_VOLTAGE_OPTIONS, upper=True
|
||||
),
|
||||
|
||||
@@ -405,7 +405,7 @@ def _model_config_to_manifest_data(model_config):
|
||||
file = _compute_local_file_path(model_config) / "manifest.json"
|
||||
|
||||
else:
|
||||
raise ValueError("Unsupported config type: {model_config[CONF_TYPE]}")
|
||||
raise ValueError(f"Unsupported config type: {model_config[CONF_TYPE]}")
|
||||
|
||||
return _load_model_data(file)
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ def validate_min_max_value(config):
|
||||
max_val = config[CONF_MAX_VALUE]
|
||||
if min_val >= max_val:
|
||||
raise cv.Invalid(
|
||||
f"Max value {max_val} must be smaller than min value {min_val}"
|
||||
f"Max value {max_val} must be greater than min value {min_val}"
|
||||
)
|
||||
return config
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ SPRINKLER_VALVE_SCHEMA = cv.Schema(
|
||||
),
|
||||
cv.Optional(
|
||||
CONF_UNIT_OF_MEASUREMENT, default=UNIT_SECOND
|
||||
): cv.one_of(UNIT_MINUTE, UNIT_SECOND, lower="True"),
|
||||
): cv.one_of(UNIT_MINUTE, UNIT_SECOND, lower=True),
|
||||
}
|
||||
)
|
||||
.extend(cv.COMPONENT_SCHEMA),
|
||||
|
||||
@@ -127,7 +127,7 @@ def validate_st7789v(config):
|
||||
|
||||
if model_data[REQUIRE_PS] and CONF_POWER_SUPPLY not in config:
|
||||
raise cv.Invalid(
|
||||
f'{CONF_POWER_SUPPLY} must be specified when {CONF_MODEL} is {config[CONF_MODEL]}"'
|
||||
f"{CONF_POWER_SUPPLY} must be specified when {CONF_MODEL} is {config[CONF_MODEL]}"
|
||||
)
|
||||
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user