Made the HCIEmulator Log Level settable inside the .yaml file
This commit is contained in:
@@ -14,6 +14,21 @@ HoermannDoor = hoermann_door_ns.class_('HoermannMainComponent', cg.Component)
|
||||
|
||||
CONF_UART_ENTRY = "uart_connection"
|
||||
CONF_TX_PIN = "tx_pin"
|
||||
CONF_LOG_LEVEL = "log_level"
|
||||
|
||||
#define LL_OFF 0
|
||||
#define LL_ERROR 1
|
||||
#define LL_WARN 2
|
||||
#define LL_INFO 3
|
||||
#define LL_DEBUG 4
|
||||
|
||||
CONF_LOG_LEVELS = {
|
||||
"NONE": 0,
|
||||
"ERROR": 1,
|
||||
"WARN": 2,
|
||||
"INFO": 3,
|
||||
"DEBUG": 4,
|
||||
}
|
||||
|
||||
def validate_config(config):
|
||||
return config
|
||||
@@ -23,6 +38,7 @@ CONFIG_SCHEMA = cv.All(
|
||||
cv.GenerateID(): cv.declare_id(HoermannDoor),
|
||||
cv.Required(CONF_UART_ENTRY): cv.use_id(uart.UARTComponent),
|
||||
cv.Required(CONF_TX_PIN): pins.internal_gpio_output_pin_schema,
|
||||
cv.Optional(CONF_LOG_LEVEL, default="INFO"): cv.enum(CONF_LOG_LEVELS, upper=True),
|
||||
}),
|
||||
validate_config
|
||||
)
|
||||
@@ -39,4 +55,7 @@ async def to_code(config):
|
||||
cg.add(var.set_seriel_connection(code))
|
||||
|
||||
code2 = await cg.gpio_pin_expression(config[CONF_TX_PIN])
|
||||
cg.add(var.set_tx_on_pin(code2)) # Needs be configured before sensor
|
||||
cg.add(var.set_tx_on_pin(code2)) # Needs be configured before sensor
|
||||
|
||||
log_level = config[CONF_LOG_LEVEL]
|
||||
cg.add(var.set_log_level(log_level))
|
Reference in New Issue
Block a user