1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-19 00:05:43 +00:00

Reduce ESP_LOGCONFIG calls (#9026)

This commit is contained in:
J. Nick Koston
2025-06-08 19:02:30 -05:00
committed by GitHub
parent 80dddb4cae
commit c0b05ada1a
218 changed files with 1569 additions and 931 deletions

View File

@@ -45,9 +45,13 @@ void MQTTAlarmControlPanelComponent::setup() {
void MQTTAlarmControlPanelComponent::dump_config() {
ESP_LOGCONFIG(TAG, "MQTT alarm_control_panel '%s':", this->alarm_control_panel_->get_name().c_str());
LOG_MQTT_COMPONENT(true, true)
ESP_LOGCONFIG(TAG, " Supported Features: %" PRIu32, this->alarm_control_panel_->get_supported_features());
ESP_LOGCONFIG(TAG, " Requires Code to Disarm: %s", YESNO(this->alarm_control_panel_->get_requires_code()));
ESP_LOGCONFIG(TAG, " Requires Code To Arm: %s", YESNO(this->alarm_control_panel_->get_requires_code_to_arm()));
ESP_LOGCONFIG(TAG,
" Supported Features: %" PRIu32 "\n"
" Requires Code to Disarm: %s\n"
" Requires Code To Arm: %s",
this->alarm_control_panel_->get_supported_features(),
YESNO(this->alarm_control_panel_->get_requires_code()),
YESNO(this->alarm_control_panel_->get_requires_code_to_arm()));
}
void MQTTAlarmControlPanelComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) {

View File

@@ -149,18 +149,23 @@ void MQTTClientComponent::send_device_info_() {
}
void MQTTClientComponent::dump_config() {
ESP_LOGCONFIG(TAG, "MQTT:");
ESP_LOGCONFIG(TAG, " Server Address: %s:%u (%s)", this->credentials_.address.c_str(), this->credentials_.port,
this->ip_.str().c_str());
ESP_LOGCONFIG(TAG, " Username: " LOG_SECRET("'%s'"), this->credentials_.username.c_str());
ESP_LOGCONFIG(TAG, " Client ID: " LOG_SECRET("'%s'"), this->credentials_.client_id.c_str());
ESP_LOGCONFIG(TAG, " Clean Session: %s", YESNO(this->credentials_.clean_session));
ESP_LOGCONFIG(TAG,
"MQTT:\n"
" Server Address: %s:%u (%s)\n"
" Username: " LOG_SECRET("'%s'") "\n"
" Client ID: " LOG_SECRET("'%s'") "\n"
" Clean Session: %s",
this->credentials_.address.c_str(), this->credentials_.port, this->ip_.str().c_str(),
this->credentials_.username.c_str(), this->credentials_.client_id.c_str(),
YESNO(this->credentials_.clean_session));
if (this->is_discovery_ip_enabled()) {
ESP_LOGCONFIG(TAG, " Discovery IP enabled");
}
if (!this->discovery_info_.prefix.empty()) {
ESP_LOGCONFIG(TAG, " Discovery prefix: '%s'", this->discovery_info_.prefix.c_str());
ESP_LOGCONFIG(TAG, " Discovery retain: %s", YESNO(this->discovery_info_.retain));
ESP_LOGCONFIG(TAG,
" Discovery prefix: '%s'\n"
" Discovery retain: %s",
this->discovery_info_.prefix.c_str(), YESNO(this->discovery_info_.retain));
}
ESP_LOGCONFIG(TAG, " Topic Prefix: '%s'", this->topic_prefix_.c_str());
if (!this->log_message_.topic.empty()) {
@@ -721,9 +726,11 @@ void MQTTMessageTrigger::setup() {
this->qos_);
}
void MQTTMessageTrigger::dump_config() {
ESP_LOGCONFIG(TAG, "MQTT Message Trigger:");
ESP_LOGCONFIG(TAG, " Topic: '%s'", this->topic_.c_str());
ESP_LOGCONFIG(TAG, " QoS: %u", this->qos_);
ESP_LOGCONFIG(TAG,
"MQTT Message Trigger:\n"
" Topic: '%s'\n"
" QoS: %u",
this->topic_.c_str(), this->qos_);
}
float MQTTMessageTrigger::get_setup_priority() const { return setup_priority::AFTER_CONNECTION; }

View File

@@ -54,12 +54,16 @@ void MQTTCoverComponent::dump_config() {
bool has_command_topic = traits.get_supports_position() || !traits.get_supports_tilt();
LOG_MQTT_COMPONENT(true, has_command_topic)
if (traits.get_supports_position()) {
ESP_LOGCONFIG(TAG, " Position State Topic: '%s'", this->get_position_state_topic().c_str());
ESP_LOGCONFIG(TAG, " Position Command Topic: '%s'", this->get_position_command_topic().c_str());
ESP_LOGCONFIG(TAG,
" Position State Topic: '%s'\n"
" Position Command Topic: '%s'",
this->get_position_state_topic().c_str(), this->get_position_command_topic().c_str());
}
if (traits.get_supports_tilt()) {
ESP_LOGCONFIG(TAG, " Tilt State Topic: '%s'", this->get_tilt_state_topic().c_str());
ESP_LOGCONFIG(TAG, " Tilt Command Topic: '%s'", this->get_tilt_command_topic().c_str());
ESP_LOGCONFIG(TAG,
" Tilt State Topic: '%s'\n"
" Tilt Command Topic: '%s'",
this->get_tilt_state_topic().c_str(), this->get_tilt_command_topic().c_str());
}
}
void MQTTCoverComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) {

View File

@@ -121,16 +121,22 @@ void MQTTFanComponent::dump_config() {
ESP_LOGCONFIG(TAG, "MQTT Fan '%s': ", this->state_->get_name().c_str());
LOG_MQTT_COMPONENT(true, true);
if (this->state_->get_traits().supports_direction()) {
ESP_LOGCONFIG(TAG, " Direction State Topic: '%s'", this->get_direction_state_topic().c_str());
ESP_LOGCONFIG(TAG, " Direction Command Topic: '%s'", this->get_direction_command_topic().c_str());
ESP_LOGCONFIG(TAG,
" Direction State Topic: '%s'\n"
" Direction Command Topic: '%s'",
this->get_direction_state_topic().c_str(), this->get_direction_command_topic().c_str());
}
if (this->state_->get_traits().supports_oscillation()) {
ESP_LOGCONFIG(TAG, " Oscillation State Topic: '%s'", this->get_oscillation_state_topic().c_str());
ESP_LOGCONFIG(TAG, " Oscillation Command Topic: '%s'", this->get_oscillation_command_topic().c_str());
ESP_LOGCONFIG(TAG,
" Oscillation State Topic: '%s'\n"
" Oscillation Command Topic: '%s'",
this->get_oscillation_state_topic().c_str(), this->get_oscillation_command_topic().c_str());
}
if (this->state_->get_traits().supports_speed()) {
ESP_LOGCONFIG(TAG, " Speed Level State Topic: '%s'", this->get_speed_level_state_topic().c_str());
ESP_LOGCONFIG(TAG, " Speed Level Command Topic: '%s'", this->get_speed_level_command_topic().c_str());
ESP_LOGCONFIG(TAG,
" Speed Level State Topic: '%s'\n"
" Speed Level Command Topic: '%s'",
this->get_speed_level_state_topic().c_str(), this->get_speed_level_command_topic().c_str());
}
}

View File

@@ -42,8 +42,10 @@ void MQTTValveComponent::dump_config() {
bool has_command_topic = traits.get_supports_position();
LOG_MQTT_COMPONENT(true, has_command_topic)
if (traits.get_supports_position()) {
ESP_LOGCONFIG(TAG, " Position State Topic: '%s'", this->get_position_state_topic().c_str());
ESP_LOGCONFIG(TAG, " Position Command Topic: '%s'", this->get_position_command_topic().c_str());
ESP_LOGCONFIG(TAG,
" Position State Topic: '%s'\n"
" Position Command Topic: '%s'",
this->get_position_state_topic().c_str(), this->get_position_command_topic().c_str());
}
}
void MQTTValveComponent::send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) {