[core] Remove deprecated get_object_id() and get_compilation_time()

This commit is contained in:
J. Nick Koston
2026-06-21 10:25:57 -05:00
parent dbdf125ec8
commit d6aa5fa29e
4 changed files with 1 additions and 29 deletions

View File

@@ -194,15 +194,6 @@ class Application {
/// Buffer must be BUILD_TIME_STR_SIZE bytes (compile-time enforced) /// Buffer must be BUILD_TIME_STR_SIZE bytes (compile-time enforced)
void get_build_time_string(std::span<char, BUILD_TIME_STR_SIZE> buffer); void get_build_time_string(std::span<char, BUILD_TIME_STR_SIZE> buffer);
/// Get the build time as a string (deprecated, use get_build_time_string() instead)
// Remove before 2026.7.0
ESPDEPRECATED("Use get_build_time_string() instead. Removed in 2026.7.0", "2026.1.0")
std::string get_compilation_time() {
char buf[BUILD_TIME_STR_SIZE];
this->get_build_time_string(buf);
return std::string(buf);
}
/// Get the cached time in milliseconds from when the current component started its loop execution /// Get the cached time in milliseconds from when the current component started its loop execution
inline uint32_t IRAM_ATTR HOT get_loop_component_start_time() const { return this->loop_component_start_time_; } inline uint32_t IRAM_ATTR HOT get_loop_component_start_time() const { return this->loop_component_start_time_; }

View File

@@ -147,13 +147,6 @@ std::string EntityBase::get_icon() const {
} }
#endif // !USE_ESP8266 #endif // !USE_ESP8266
// Entity Object ID - computed on-demand from name
std::string EntityBase::get_object_id() const {
char buf[OBJECT_ID_MAX_LEN];
size_t len = this->write_object_id_to(buf, sizeof(buf));
return std::string(buf, len);
}
// Calculate Object ID Hash directly from name using snake_case + sanitize // Calculate Object ID Hash directly from name using snake_case + sanitize
void EntityBase::calc_object_id_() { void EntityBase::calc_object_id_() {
this->object_id_hash_ = fnv1_hash_object_id(this->name_.c_str(), this->name_.size()); this->object_id_hash_ = fnv1_hash_object_id(this->name_.c_str(), this->name_.size());

View File

@@ -73,18 +73,6 @@ class EntityBase {
// Get whether this Entity has its own name or it should use the device friendly_name. // Get whether this Entity has its own name or it should use the device friendly_name.
bool has_own_name() const { return this->flags_.has_own_name; } bool has_own_name() const { return this->flags_.has_own_name; }
// Get the sanitized name of this Entity as an ID.
// Deprecated: object_id mangles names and all object_id methods are planned for removal.
// See https://github.com/esphome/backlog/issues/76
// Now is the time to stop using object_id entirely. If you still need it temporarily,
// use get_object_id_to() which will remain available longer but will also eventually be removed.
ESPDEPRECATED("object_id mangles names and all object_id methods are planned for removal "
"(see https://github.com/esphome/backlog/issues/76). "
"Now is the time to stop using object_id. If still needed, use get_object_id_to() "
"which will remain available longer. get_object_id() will be removed in 2026.7.0",
"2025.12.0")
std::string get_object_id() const;
// Get the unique Object ID of this Entity // Get the unique Object ID of this Entity
uint32_t get_object_id_hash() const { return this->object_id_hash_; } uint32_t get_object_id_hash() const { return this->object_id_hash_; }

View File

@@ -337,7 +337,7 @@ def get_base_entity_object_id(
This function calculates what object_id_c_str_ should be set to in C++. This function calculates what object_id_c_str_ should be set to in C++.
The C++ EntityBase::get_object_id() (entity_base.cpp lines 38-49) works as: The C++ EntityBase::write_object_id_to() (entity_base.cpp) works as:
- If !has_own_name && is_name_add_mac_suffix_enabled(): - If !has_own_name && is_name_add_mac_suffix_enabled():
return str_sanitize(str_snake_case(App.get_friendly_name())) // Dynamic return str_sanitize(str_snake_case(App.get_friendly_name())) // Dynamic
- Else: - Else: