1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-30 00:52:20 +01:00

Reduce entity memory usage by eliminating field shadowing and bit-packing (#9076)

This commit is contained in:
J. Nick Koston
2025-06-14 22:21:55 -05:00
committed by GitHub
parent a1e4143600
commit 4305c44440
25 changed files with 258 additions and 86 deletions

View File

@@ -60,13 +60,12 @@ std::string TextSensor::get_state() const { return this->state; }
std::string TextSensor::get_raw_state() const { return this->raw_state; }
void TextSensor::internal_send_state_to_frontend(const std::string &state) {
this->state = state;
this->has_state_ = true;
this->set_has_state(true);
ESP_LOGD(TAG, "'%s': Sending state '%s'", this->name_.c_str(), state.c_str());
this->callback_.call(state);
}
std::string TextSensor::unique_id() { return ""; }
bool TextSensor::has_state() { return this->has_state_; }
} // namespace text_sensor
} // namespace esphome

View File

@@ -67,8 +67,6 @@ class TextSensor : public EntityBase, public EntityBase_DeviceClass {
*/
virtual std::string unique_id();
bool has_state();
void internal_send_state_to_frontend(const std::string &state);
protected:
@@ -76,8 +74,6 @@ class TextSensor : public EntityBase, public EntityBase_DeviceClass {
CallbackManager<void(std::string)> callback_; ///< Storage for filtered state callbacks.
Filter *filter_list_{nullptr}; ///< Store all active filters.
bool has_state_{false};
};
} // namespace text_sensor