diff --git a/esphome/components/binary_sensor/filter.h b/esphome/components/binary_sensor/filter.h index 0c66047769..8d52e5b896 100644 --- a/esphome/components/binary_sensor/filter.h +++ b/esphome/components/binary_sensor/filter.h @@ -114,10 +114,9 @@ template class AutorepeatFilter : public AutorepeatFilterBase { explicit AutorepeatFilter(std::initializer_list timings) { size_t i = 0; for (const auto &t : timings) { - if (i >= N) - break; this->timings_storage_[i++] = t; } + ESPHOME_DEBUG_ASSERT(i == N); this->timings_ = this->timings_storage_.data(); this->timings_count_ = N; }