Skip to content

Improve detection of entity names in templates#13432

Merged
pvizeli merged 2 commits intohome-assistant:devfrom
amelchio:template-ignore-partial-id
Mar 25, 2018
Merged

Improve detection of entity names in templates#13432
pvizeli merged 2 commits intohome-assistant:devfrom
amelchio:template-ignore-partial-id

Conversation

@amelchio
Copy link
Copy Markdown
Contributor

Description:

This PR adds filtering of extracted entity names, fixing an issue where variables with invalid IDs made the algorithm not fall back to MATCH_ALL.

Related issue (if applicable): fixes #13398

Example entry for configuration.yaml (if applicable):

      - wait_template: >-
          {{ is_state('media_player.' ~ where, 'playing') }}

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@amelchio amelchio added this to the 0.66 milestone Mar 24, 2018
@amelchio amelchio requested a review from a team as a code owner March 24, 2018 11:52
Copy link
Copy Markdown
Member

@pvizeli pvizeli left a comment

Choose a reason for hiding this comment

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

Please update the regex that he not detect this. All that was we can do on regex, should we do on regex otherwise we slow done this function and make it more cpu/memory hungry

@amelchio
Copy link
Copy Markdown
Contributor Author

I think the regex works as intended, it locates where in the provided example.

Instead, I have moved the filter to only affect the variable values that are appended.

@pvizeli pvizeli merged commit 55daea5 into home-assistant:dev Mar 25, 2018
balloob pushed a commit that referenced this pull request Mar 26, 2018
* Improve detection of entity names in templates

* Only test variables
@balloob balloob mentioned this pull request Mar 30, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Jul 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sonos does not restore /resume playback

5 participants