diff --git a/esphome/core/entity_base.h b/esphome/core/entity_base.h index a9aa5e0076..ae10b86140 100644 --- a/esphome/core/entity_base.h +++ b/esphome/core/entity_base.h @@ -156,6 +156,7 @@ class EntityBase { /// @tparam T The type of data to store (must be trivially copyable) /// @param version Optional version hash XORed with preference key (change when struct layout changes) template ESPPreferenceObject make_entity_preference(uint32_t version = 0) { + static_assert(std::is_trivially_copyable::value, "T must be trivially copyable"); return this->make_entity_preference_(sizeof(T), version); }