-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log invalid templates in script delays #13423
Log invalid templates in script delays #13423
Conversation
homeassistant/helpers/script.py
Outdated
except (TemplateError, vol.Invalid) as ex: | ||
_LOGGER.error("Error rendering '%s' delay template: %s", | ||
self.name, ex) | ||
delay = timedelta(seconds=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that we should continue. We should abort instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay.
homeassistant/helpers/script.py
Outdated
@@ -3,6 +3,7 @@ | |||
import logging | |||
from itertools import islice | |||
from typing import Optional, Sequence | |||
from datetime import timedelta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'datetime.timedelta' imported but unused
* Log invalid templates in script delays * Abort on error * Remove unused import
Description:
This PR makes the script
delay:
survive invalid templates. We used to log two tracebacks and break the script so it never completed.Example entry for
configuration.yaml
(if applicable):Checklist:
tox
.If the code does not interact with devices: