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 <frenck@frenck.nl>
This commit is contained in:
PeteRager 2021-07-20 14:23:22 -04:00 committed by GitHub
parent a2fbc4218d
commit 5ccbac5ff6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,