diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index 51feaa57c5..6922cd9cc0 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -501,7 +501,9 @@ template::max()> /// falls back to element-wise copy for non-trivially copyable types (e.g. TemplatableValue). /// N is set by code generation; ESPHOME_DEBUG_ASSERT catches mismatches in debug/integration tests. template inline void init_array_from(std::array &dest, std::initializer_list src) { - ESPHOME_DEBUG_ASSERT(src.size() == N); +#ifdef ESPHOME_DEBUG + assert(src.size() == N); +#endif if constexpr (std::is_trivially_copyable_v) { __builtin_memcpy(dest.data(), src.begin(), N * sizeof(T)); } else {