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

Templates don't seem to work for entity_id in some contexts #88776

Closed
BenBergman opened this issue Feb 26, 2023 · 2 comments
Closed

Templates don't seem to work for entity_id in some contexts #88776

BenBergman opened this issue Feb 26, 2023 · 2 comments
Labels

Comments

@BenBergman
Copy link

The problem

I am trying to create a blueprint and need to set the entity_id for some fields via template. When I try to create an automation using this template I get an error when saving it. I have created a minimal script that returns the same error when saving.

alias: "**entity_id template bug"
sequence:
  - condition: state
    entity_id: "{{'light.dining_room_light'}}"
    state: "on"
  - service: light.turn_on
    data:
      brightness_step_pct: 100
    target:
      entity_id: "{{'light.dining_room_light'}}"
mode: single

The error in red at the top when saving this script:

Message malformed: Entity {{ 'light.dining_room_light' }} is neither a valid entity ID nor a valid UUID for dictionary value @ data['sequence'][0]['entity_id']

Note that I'm using a template in both the condition and the service call, but if I set the condition entity_id directly instead of through a template, the service call entity_id template works without issue.

What version of Home Assistant Core has the issue?

core-2023.2.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

alias: "**entity_id template bug"
sequence:
  - condition: state
    entity_id: "{{'light.dining_room_light'}}"
    state: "on"
  - service: light.turn_on
    data:
      brightness_step_pct: 100
    target:
      entity_id: "{{'light.dining_room_light'}}"
mode: single

Anything in the logs that might be useful for us?

No response

Additional information

No response

@tdejneka
Copy link

tdejneka commented Feb 26, 2023

Not a bug. The State Condition's entity_id option doesn't support a template.

Normally the documentation either explains or provides an example of what an option can do. In this case, there's nothing in the State Condition's documentation that suggests you can template entity_id

If you need to be able to template the entity, consider using a Template Condition.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@issue-triage-workflows issue-triage-workflows bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 4, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jul 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants