From ee3aa6ab91473d46f4a96737681ff52c8644247c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Poczkodi?= Date: Tue, 12 Nov 2024 22:47:09 +0100 Subject: [PATCH] This kind of AUTO_LOAD should pass the test, a few other components do conditional auto-loading this way. --- esphome/components/store_yaml/__init__.py | 10 ++++++++-- esphome/components/store_yaml/store_yaml.cpp | 10 +++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/esphome/components/store_yaml/__init__.py b/esphome/components/store_yaml/__init__.py index 731c23e43a..e2bbbfe411 100644 --- a/esphome/components/store_yaml/__init__.py +++ b/esphome/components/store_yaml/__init__.py @@ -24,8 +24,14 @@ platforms = [ ] CODEOWNERS = ["@gabest11"] -if CORE.target_platform in platforms: - AUTO_LOAD = ["web_server_base"] + + +def AUTO_LOAD(): + if CORE.target_platform in platforms: + return ["web_server_base"] + return [] + + CONF_SHOW_IN_DUMP_CONFIG = "show_in_dump_config" CONF_SHOW_SECRETS = "show_secrets" CONF_HTTP = "http" diff --git a/esphome/components/store_yaml/store_yaml.cpp b/esphome/components/store_yaml/store_yaml.cpp index 3ffc4538d3..d1f9502bf2 100644 --- a/esphome/components/store_yaml/store_yaml.cpp +++ b/esphome/components/store_yaml/store_yaml.cpp @@ -8,13 +8,13 @@ namespace store_yaml { static const char *const TAG = "store_yaml"; void StoreYamlComponent::dump_config() { - if (this->show_in_dump_config_) { - ESP_LOGCONFIG(TAG, "YAML:"); - ESP_LOGCONFIG(TAG, " Compressed size: %zu", ESPHOME_YAML_SIZE); + ESP_LOGCONFIG(TAG, "YAML:"); + ESP_LOGCONFIG(TAG, " Compressed size: %zu", ESPHOME_YAML_SIZE); #ifndef USE_RP2040 - const char *url = (this->web_server_ != nullptr) ? this->web_server_url_.c_str() : "not configured!"; - ESP_LOGCONFIG(TAG, " Web server url: %s", url); + const char *url = (this->web_server_ != nullptr) ? this->web_server_url_.c_str() : "not configured!"; + ESP_LOGCONFIG(TAG, " Web server url: %s", url); #endif + if (this->show_in_dump_config_) { RowDecompressor dec(ESPHOME_YAML, ESPHOME_YAML_SIZE); std::string row; while (dec.get_row(row)) {