diff --git a/esphome/core/entity_base.h b/esphome/core/entity_base.h index 91137b4853..e17a649051 100644 --- a/esphome/core/entity_base.h +++ b/esphome/core/entity_base.h @@ -89,6 +89,8 @@ class EntityBase { uint32_t get_preference_hash() { #ifdef USE_DEVICES // Combine object_id_hash with device_id to ensure uniqueness across devices + // Note: device_id is 0 for the main device, so XORing with 0 preserves the original hash + // This ensures backward compatibility for existing single-device configurations return this->get_object_id_hash() ^ this->get_device_id(); #else // Without devices, just use object_id_hash as before