From 42698eedee65a83f2ffec75272946fcfbd09c590 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 24 Jan 2026 08:23:03 -1000 Subject: [PATCH] tweak --- esphome/components/template/text/template_text.cpp | 3 +++ esphome/core/entity_base.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/esphome/components/template/text/template_text.cpp b/esphome/components/template/text/template_text.cpp index ac2ed7e60d..70b8dce312 100644 --- a/esphome/components/template/text/template_text.cpp +++ b/esphome/components/template/text/template_text.cpp @@ -24,7 +24,10 @@ void TemplateText::setup() { // old_key = get_preference_hash() + extra // new_key = get_preference_hash_v2() + extra // See: https://github.com/esphome/backlog/issues/85 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" uint32_t key = this->get_preference_hash(); +#pragma GCC diagnostic pop key += this->traits.get_min_length() << 2; key += this->traits.get_max_length() << 4; key += fnv1_hash(this->traits.get_pattern_c_str()) << 6; diff --git a/esphome/core/entity_base.h b/esphome/core/entity_base.h index ae10b86140..503a6563f8 100644 --- a/esphome/core/entity_base.h +++ b/esphome/core/entity_base.h @@ -139,7 +139,9 @@ class EntityBase { * from previous versions, so existing single-device configurations will continue to work. * * @return uint32_t The unique hash for preferences, including device_id if available. + * @deprecated Use make_entity_preference() instead for automatic migration support. */ + ESPDEPRECATED("Use make_entity_preference() instead. Will be removed in 2027.1.0.", "2026.7.0") uint32_t get_preference_hash() { #ifdef USE_DEVICES // Combine object_id_hash with device_id to ensure uniqueness across devices