diff --git a/esphome/components/event/event.h b/esphome/components/event/event.h index 65f346213b..23f9218c6a 100644 --- a/esphome/components/event/event.h +++ b/esphome/components/event/event.h @@ -56,6 +56,7 @@ class Event : public EntityBase, public EntityBase_DeviceClass { uint8_t get_last_event_type_index() const { if (this->last_event_type_ == nullptr) return std::numeric_limits::max(); + // Most events have <3 types, uint8_t is sufficient for all reasonable scenarios const uint8_t size = static_cast(this->types_.size()); for (uint8_t i = 0; i < size; i++) { if (this->types_[i] == this->last_event_type_)