65 "Use get_icon_ref() instead for better performance (avoids string copy). Will be removed in ESPHome 2026.5.0",
67 std::
string get_icon() const;
139#ifdef USE_ENTITY_ICON
161 ESPDEPRECATED(
"Use get_device_class_ref() instead for better performance (avoids string copy). Will be removed in "
164 std::string get_device_class();
180 ESPDEPRECATED(
"Use get_unit_of_measurement_ref() instead for better performance (avoids string copy). Will be "
181 "removed in ESPHome 2026.5.0",
183 std::string get_unit_of_measurement();
231 if (this->
state_ != state) {
StringRef get_device_class_ref() const
Get the device class as StringRef.
ESPDEPRECATED("Use get_device_class_ref() instead for better performance (avoids string copy). Will be removed in " "ESPHome 2026.5.0", "2025.11.0") std void set_device_class(const char *device_class)
Get the device class, using the manual override if set.
const char * device_class_
Device class override.
const char * unit_of_measurement_
Unit of measurement override.
ESPDEPRECATED("Use get_unit_of_measurement_ref() instead for better performance (avoids string copy). Will be " "removed in ESPHome 2026.5.0", "2025.11.0") std void set_unit_of_measurement(const char *unit_of_measurement)
Get the unit of measurement, using the manual override if set.
StringRef get_unit_of_measurement_ref() const
Get the unit of measurement as StringRef.
struct esphome::EntityBase::EntityFlags flags_
void set_device(Device *device)
void set_object_id(const char *object_id)
bool has_own_name() const
const char * object_id_c_str_
uint32_t get_object_id_hash()
const StringRef & get_name() const
uint32_t get_preference_hash()
Get a unique hash for storing preferences/settings for this entity.
void set_entity_category(EntityCategory entity_category)
StringRef get_icon_ref() const
uint32_t get_device_id() const
bool is_disabled_by_default() const
bool is_object_id_dynamic_() const
Check if the object_id is dynamic (changes with MAC suffix)
void set_name(const char *name)
ESPDEPRECATED("Use get_icon_ref() instead for better performance (avoids string copy). Will be removed in ESPHome 2026.5.0", "2025.11.0") std void set_icon(const char *icon)
void set_disabled_by_default(bool disabled_by_default)
void set_has_state(bool state)
std::string get_object_id() const
EntityCategory get_entity_category() const
StringRef get_object_id_ref_for_api_() const
void set_internal(bool internal)
An entity that has a state.
virtual const T & get_state() const
bool set_state_(const optional< T > &state)
Set a new state for this entity.
bool trigger_on_initial_state_
void add_full_state_callback(std::function< void(optional< T > previous, optional< T > current)> &&callback)
CallbackManager< void(T)> * state_callbacks_
void add_on_state_callback(std::function< void(T)> &&callback)
void set_trigger_on_initial_state(bool trigger_on_initial_state)
virtual bool has_state() const
virtual T get_state_default(T default_value) const
CallbackManager< void(optional< T > previous, optional< T > current)> * full_state_callbacks_
StringRef is a reference to a string owned by something else.
static constexpr StringRef from_lit(const CharT(&s)[N])
value_type const & value() const
Providing packet encoding functions for exchanging data with a remote host.
@ ENTITY_CATEGORY_DIAGNOSTIC
uint8_t disabled_by_default
Internal helper struct that is used to parse incoming URLs.