[text_sensor] Guard raw_callback_ behind USE_TEXT_SENSOR_FILTER, save 4 bytes per instance (#15097)

This commit is contained in:
J. Nick Koston
2026-03-23 08:23:22 -10:00
committed by GitHub
parent 36d2e58b11
commit 9385f16128
2 changed files with 11 additions and 1 deletions
@@ -31,7 +31,9 @@ void TextSensor::publish_state(const char *state, size_t len) {
if (len != this->state.size() || memcmp(state, this->state.data(), len) != 0) {
this->state.assign(state, len);
}
#ifdef USE_TEXT_SENSOR_FILTER
this->raw_callback_.call(this->state);
#endif
ESP_LOGV(TAG, "'%s': Received new state %s", this->name_.c_str(), this->state.c_str());
this->notify_frontend_();
#ifdef USE_TEXT_SENSOR_FILTER