Skip to content
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

Wait_template - support for 'trigger.entity_id' and data_template values #9807

Merged
merged 17 commits into from
Oct 12, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
* Fixed style violations
  • Loading branch information
cdce8p committed Oct 11, 2017
commit 9cd4b6891366875bb1abac2421ae1e06603a8a72
3 changes: 2 additions & 1 deletion homeassistant/helpers/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ def template_condition_listener(entity_id, from_s, to_s):
already_triggered = False

return async_track_state_change(
hass, template.extract_entities(variables), template_condition_listener)
hass, template.extract_entities(variables),
template_condition_listener)


track_template = threaded_listener_factory(async_track_template)
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/helpers/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
re.I | re.M
)
_RE_GET_POSSIBLE_ENTITIES = re.compile(
r"(?:(?:states\.|(?:is_state|is_state_attr|states)\(.)([\w]+\.[\w]+)|([\w]+))",
re.I | re.M
r"(?:(?:states\.|(?:is_state|is_state_attr|states) \
\(.)([\w]+\.[\w]+)|([\w]+))", re.I | re.M
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use:

re.compile(
    r"..."
    r"...")

)


Expand Down Expand Up @@ -73,7 +73,7 @@ def extract_entities_with_variables(template, variables):
elif result[0]:
extraction_final.append(result[0])

if result[1] in variables and isinstance(variables[result[1]], str) :
if result[1] in variables and isinstance(variables[result[1]], str):
extraction_final.append(variables[result[1]])

if extraction_final:
Expand Down