From 5ccbac5ff6ed7a8de330b718bb794467c7d46763 Mon Sep 17 00:00:00 2001 From: PeteRager <76050312+PeteRager@users.noreply.github.com> Date: Tue, 20 Jul 2021 14:23:22 -0400 Subject: [PATCH] Fix alert infinite loop on repeat interval of 0 (#52628) * #4851 - Infinite loop on repeat interval of 0 Notification will enter an infinite loop when the repeat interval is specified as zero and it is the last repeat configured. When this occurs avoid the infinite loop and log a warning message. Note: I encountered this issue when routing SMS to Twilio and quickly sent thousands of text messages. * Update __init__.py * Remove runtime check since configuration input is now blocked * Tweak comment Co-authored-by: Franck Nijhof --- homeassistant/components/alert/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/alert/__init__.py b/homeassistant/components/alert/__init__.py index 69edb3ee001..73be34e6d33 100644 --- a/homeassistant/components/alert/__init__.py +++ b/homeassistant/components/alert/__init__.py @@ -48,7 +48,12 @@ ALERT_SCHEMA = vol.Schema( vol.Required(CONF_NAME): cv.string, vol.Required(CONF_ENTITY_ID): cv.entity_id, vol.Required(CONF_STATE, default=STATE_ON): cv.string, - vol.Required(CONF_REPEAT): vol.All(cv.ensure_list, [vol.Coerce(float)]), + vol.Required(CONF_REPEAT): vol.All( + cv.ensure_list, + [vol.Coerce(float)], + # Minimum delay is 1 second = 0.016 minutes + [vol.Range(min=0.016)], + ), vol.Required(CONF_CAN_ACK, default=DEFAULT_CAN_ACK): cv.boolean, vol.Required(CONF_SKIP_FIRST, default=DEFAULT_SKIP_FIRST): cv.boolean, vol.Optional(CONF_ALERT_MESSAGE): cv.template,