7 static const char *
const TAG =
"entity_base";
79 if (this->device_class_ ==
nullptr) {
82 return this->device_class_;
88 if (this->unit_of_measurement_ ==
nullptr)
90 return this->unit_of_measurement_;
93 this->unit_of_measurement_ = unit_of_measurement;
void set_disabled_by_default(bool disabled_by_default)
std::string str_snake_case(const std::string &str)
Convert the string to snake case (lowercase with underscores).
void set_internal(bool internal)
std::string get_device_class()
Get the device class, using the manual override if set.
void set_device_class(const char *device_class)
Manually set the device class.
bool disabled_by_default_
StringRef is a reference to a string owned by something else.
void set_name(const char *name)
void set_unit_of_measurement(const char *unit_of_measurement)
Manually set the unit of measurement.
const std::string & get_friendly_name() const
Get the friendly name of this Application set by pre_setup().
void set_object_id(const char *object_id)
constexpr bool empty() const
std::string get_object_id() const
std::string get_icon() const
EntityCategory entity_category_
std::string get_unit_of_measurement()
Get the unit of measurement, using the manual override if set.
Application App
Global storage of Application pointer - only one Application can exist.
bool is_name_add_mac_suffix_enabled() const
EntityCategory get_entity_category() const
std::string str_sanitize(const std::string &str)
Sanitizes the input string by removing all characters but alphanumerics, dashes and underscores...
uint32_t fnv1_hash(const std::string &str)
Calculate a FNV-1 hash of str.
Implementation of SPI Controller mode.
void set_icon(const char *icon)
const char * object_id_c_str_
bool is_disabled_by_default() const
uint32_t get_object_id_hash()
void set_entity_category(EntityCategory entity_category)
const StringRef & get_name() const