renamed show_in_logconfig to show_in_dump_config

This commit is contained in:
Gábor Poczkodi 2024-11-06 20:02:08 +01:00
parent bc5d891053
commit 5580f93a54
4 changed files with 7 additions and 7 deletions

View file

@ -8,7 +8,7 @@ from esphome.const import (
) )
CODEOWNERS = ["@gabest11"] CODEOWNERS = ["@gabest11"]
CONF_SHOW_IN_LOGCONFIG = "show_in_logconfig" CONF_SHOW_IN_DUMP_CONFIG = "show_in_dump_config"
CONF_SHOW_SECRETS = "show_secrets" CONF_SHOW_SECRETS = "show_secrets"
store_yaml_ns = cg.esphome_ns.namespace("store_yaml") store_yaml_ns = cg.esphome_ns.namespace("store_yaml")
@ -17,7 +17,7 @@ StoreYamlComponent = store_yaml_ns.class_("StoreYamlComponent", cg.Component)
CONFIG_SCHEMA = cv.Schema( CONFIG_SCHEMA = cv.Schema(
{ {
cv.GenerateID(): cv.declare_id(StoreYamlComponent), cv.GenerateID(): cv.declare_id(StoreYamlComponent),
cv.Optional(CONF_SHOW_IN_LOGCONFIG, default=True): cv.boolean, cv.Optional(CONF_SHOW_IN_DUMP_CONFIG, default=True): cv.boolean,
cv.Optional(CONF_SHOW_SECRETS, default=False): cv.boolean, cv.Optional(CONF_SHOW_SECRETS, default=False): cv.boolean,
} }
) )
@ -26,7 +26,7 @@ CONFIG_SCHEMA = cv.Schema(
async def to_code(config): async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID]) var = cg.new_Pvariable(config[CONF_ID])
store_yaml = await cg.register_component(var, config) store_yaml = await cg.register_component(var, config)
cg.add(store_yaml.set_show_in_logconfig(config[CONF_SHOW_IN_LOGCONFIG])) cg.add(store_yaml.set_show_in_dump_config(config[CONF_SHOW_IN_DUMP_CONFIG]))
yaml = yaml_util.load_yaml(CORE.config_path) yaml = yaml_util.load_yaml(CORE.config_path)
dump = yaml_util.dump(yaml, show_secrets=config[CONF_SHOW_SECRETS]) dump = yaml_util.dump(yaml, show_secrets=config[CONF_SHOW_SECRETS])
cg.add(store_yaml.set_yaml(dump)) cg.add(store_yaml.set_yaml(dump))

View file

@ -7,7 +7,7 @@ namespace store_yaml {
static const char *const TAG = "store_yaml"; static const char *const TAG = "store_yaml";
void StoreYamlComponent::dump_config() { void StoreYamlComponent::dump_config() {
if (this->show_) { if (this->show_in_dump_config_) {
ESP_LOGCONFIG(TAG, "YAML:"); ESP_LOGCONFIG(TAG, "YAML:");
this->log(true); this->log(true);
} }

View file

@ -6,12 +6,12 @@
namespace esphome { namespace esphome {
namespace store_yaml { namespace store_yaml {
class StoreYamlComponent : public Component { class StoreYamlComponent : public Component {
bool show_{false}; bool show_in_dump_config_{false};
std::string yaml_; std::string yaml_;
public: public:
void dump_config() override; void dump_config() override;
void set_show_in_logconfig(bool show) { this->show_ = show; } void set_show_in_dump_config(bool show) { this->show_in_dump_config_ = show; }
void set_yaml(const std::string &yaml) { this->yaml_ = yaml; } void set_yaml(const std::string &yaml) { this->yaml_ = yaml; }
std::string get_yaml() const; std::string get_yaml() const;
void log(bool dump_config = false) const; void log(bool dump_config = false) const;

View file

@ -5,5 +5,5 @@ api:
- store_yaml.log - store_yaml.log
store_yaml: store_yaml:
show_in_logconfig: True show_in_dump_config: True
show_secrets: True show_secrets: True