Downgrade select and switch control path logging from DEBUG to VERBOSE

The ESP_LOGD calls in SelectCall::perform() and Switch::turn_on/turn_off/toggle
are redundant with aioesphomeapi's state_log_formatter which already logs both
commands and state changes on the HA side. Benchmarks show these ESP_LOGD calls
dominate the control path cost (~13M ops/s for SelectCall vs ~180M ops/s for
publish_state).

This aligns select and switch with climate and fan which already use ESP_LOGV
for their call perform() paths.
This commit is contained in:
J. Nick Koston
2026-04-02 14:48:43 -10:00
parent 8a0d3158a0
commit 46f8e46548
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -116,7 +116,7 @@ void SelectCall::perform() {
auto idx = target_index.value();
// All operations use indices, call control() by index to avoid string conversion
ESP_LOGD(TAG, "'%s' - Set selected option to: %s", name, parent->option_at(idx));
ESP_LOGV(TAG, "'%s' - Set selected option to: %s", name, parent->option_at(idx));
parent->control(idx);
}
+3 -3
View File
@@ -18,15 +18,15 @@ void Switch::control(bool target_state) {
}
}
void Switch::turn_on() {
ESP_LOGD(TAG, "'%s' Turning ON.", this->get_name().c_str());
ESP_LOGV(TAG, "'%s' Turning ON.", this->get_name().c_str());
this->write_state(!this->inverted_);
}
void Switch::turn_off() {
ESP_LOGD(TAG, "'%s' Turning OFF.", this->get_name().c_str());
ESP_LOGV(TAG, "'%s' Turning OFF.", this->get_name().c_str());
this->write_state(this->inverted_);
}
void Switch::toggle() {
ESP_LOGD(TAG, "'%s' Toggling %s.", this->get_name().c_str(), this->state ? "OFF" : "ON");
ESP_LOGV(TAG, "'%s' Toggling %s.", this->get_name().c_str(), this->state ? "OFF" : "ON");
this->write_state(this->inverted_ == this->state);
}
optional<bool> Switch::get_initial_state() {