[text_sensor] Remove deprecated public raw_state member (#16683)

This commit is contained in:
Jonathan Swoboda authored and GitHub committed 2026-05-26 23:34:52 +00:00
1 parent e174c44b28
commit a6ef67aa65
2 files changed
+8 -21

No files matched your search

+6 -13
View File
@@ -39,16 +39,13 @@ void TextSensor::publish_state(const char *state, size_t len) {
#ifdef USE_TEXT_SENSOR_FILTER
} else {
// Has filters: need separate raw storage
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// Only assign if changed to avoid heap allocation
if (len != this->raw_state.size() || memcmp(state, this->raw_state.data(), len) != 0) {
this->raw_state.assign(state, len);
if (len != this->raw_state_.size() || memcmp(state, this->raw_state_.data(), len) != 0) {
this->raw_state_.assign(state, len);
}
this->raw_callback_.call(this->raw_state);
ESP_LOGV(TAG, "'%s': Received new state %s", this->name_.c_str(), this->raw_state.c_str());
this->filter_list_->input(this->raw_state);
#pragma GCC diagnostic pop
this->raw_callback_.call(this->raw_state_);
ESP_LOGV(TAG, "'%s': Received new state %s", this->name_.c_str(), this->raw_state_.c_str());
this->filter_list_->input(this->raw_state_);
}
#endif
}
@@ -89,11 +86,7 @@ const std::string &TextSensor::get_state() const { return this->state; }
const std::string &TextSensor::get_raw_state() const {
#ifdef USE_TEXT_SENSOR_FILTER
if (this->filter_list_ != nullptr) {
// Suppress deprecation warning - get_raw_state() is the replacement API
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
return this->raw_state;
#pragma GCC diagnostic pop
return this->raw_state_;
}
#endif
return this->state; // No filters, raw == filtered