[logger] Don't allow `logger.log actions without configuring the logger` (#9821)

This commit is contained in:
Jesse Hills 2025-07-26 16:23:36 +12:00
parent 8b0ad3072f
commit 8dce7b0905
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A
2 changed files with 3 additions and 0 deletions

View File

@ -400,6 +400,7 @@ CONF_LOGGER_LOG = "logger.log"
LOGGER_LOG_ACTION_SCHEMA = cv.All( LOGGER_LOG_ACTION_SCHEMA = cv.All(
cv.maybe_simple_value( cv.maybe_simple_value(
{ {
cv.GenerateID(CONF_LOGGER_ID): cv.use_id(Logger),
cv.Required(CONF_FORMAT): cv.string, cv.Required(CONF_FORMAT): cv.string,
cv.Optional(CONF_ARGS, default=list): cv.ensure_list(cv.lambda_), cv.Optional(CONF_ARGS, default=list): cv.ensure_list(cv.lambda_),
cv.Optional(CONF_LEVEL, default="DEBUG"): cv.one_of( cv.Optional(CONF_LEVEL, default="DEBUG"): cv.one_of(

View File

@ -4,6 +4,8 @@ esphome:
esp32: esp32:
board: esp32dev board: esp32dev
logger:
text: text:
- platform: template - platform: template
name: "test 1 text" name: "test 1 text"