mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 09:18:00 +01:00
Linting
This commit is contained in:
parent
d4707e97c8
commit
68a1b6bc02
1 changed files with 15 additions and 12 deletions
|
@ -27,10 +27,7 @@ ES8388_PRESETS = {
|
||||||
|
|
||||||
|
|
||||||
def validate_instruction_list():
|
def validate_instruction_list():
|
||||||
return cv.ensure_list(
|
return cv.ensure_list(cv.Length(min=2, max=2), cv.ensure_list(int))
|
||||||
cv.Length(min=2, max=2),
|
|
||||||
cv.ensure_list(int)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
CONFIG_SCHEMA = (
|
CONFIG_SCHEMA = (
|
||||||
|
@ -38,10 +35,12 @@ CONFIG_SCHEMA = (
|
||||||
cv.GenerateID(): cv.declare_id(ES8388Component),
|
cv.GenerateID(): cv.declare_id(ES8388Component),
|
||||||
cv.Optional(CONF_PRESET): cv.enum(ES8388_PRESETS, lower=True),
|
cv.Optional(CONF_PRESET): cv.enum(ES8388_PRESETS, lower=True),
|
||||||
cv.Optional(CONF_INIT_INSTRUCTIONS): validate_instruction_list(),
|
cv.Optional(CONF_INIT_INSTRUCTIONS): validate_instruction_list(),
|
||||||
cv.Optional(CONF_MACROS): cv.ensure_list({
|
cv.Optional(CONF_MACROS): cv.ensure_list(
|
||||||
cv.Required(CONF_ID): cv.string,
|
{
|
||||||
cv.Required(CONF_INSTRUCTIONS): validate_instruction_list(),
|
cv.Required(CONF_ID): cv.string,
|
||||||
}),
|
cv.Required(CONF_INSTRUCTIONS): validate_instruction_list(),
|
||||||
|
}
|
||||||
|
),
|
||||||
})
|
})
|
||||||
.extend(i2c.i2c_device_schema(0x10))
|
.extend(i2c.i2c_device_schema(0x10))
|
||||||
.extend(cv.COMPONENT_SCHEMA)
|
.extend(cv.COMPONENT_SCHEMA)
|
||||||
|
@ -58,10 +57,14 @@ async def to_code(config):
|
||||||
cg.add(var.set_init_instructions(config[CONF_INIT_INSTRUCTIONS]))
|
cg.add(var.set_init_instructions(config[CONF_INIT_INSTRUCTIONS]))
|
||||||
if CONF_MACROS in config:
|
if CONF_MACROS in config:
|
||||||
for macro in config[CONF_MACROS]:
|
for macro in config[CONF_MACROS]:
|
||||||
ES8388_MACROS.register(macro[CONF_ID], Macro, {
|
ES8388_MACROS.register(
|
||||||
cv.Required(CONF_ID): cv.declare_id(Macro),
|
macro[CONF_ID],
|
||||||
cv.Required(CONF_INSTRUCTIONS): validate_instruction_list(),
|
Macro,
|
||||||
})
|
{
|
||||||
|
cv.Required(CONF_ID): cv.declare_id(Macro),
|
||||||
|
cv.Required(CONF_INSTRUCTIONS): validate_instruction_list(),
|
||||||
|
}
|
||||||
|
)
|
||||||
cg.add(var.register_macro(macro[CONF_ID], macro[CONF_INSTRUCTIONS]))
|
cg.add(var.register_macro(macro[CONF_ID], macro[CONF_INSTRUCTIONS]))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue