home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.61k stars 29.92k forks source link

list.turn_off action area_id does not accept list variable #123318

Open jmwhite5 opened 1 month ago

jmwhite5 commented 1 month ago

The problem

The following script:

alias: Test Script
variables:
  areas:
    - master_bathroom
    - master_bedroom
sequence:
  - action: light.turn_off
    metadata: {}
    data: {}
    target:
      area_id: "{{areas}}"
description: ""

produces the following error when running:

Executed: August 7, 2024 at 6:25:36 PM
Error: template value should be a string @ data['area_id'][0]
Result:
params:
  domain: light
  service: turn_off
  service_data: {}
  target:
    area_id:
      - - master_bathroom
        - master_bedroom
running_script: false

Similar code using entity_id works fine.

Of course this code works fine.

action: light.turn_off
target:
  area_id:
    - master_bathroom
    - master_bedroom
    - hallway
data: {}

What version of Home Assistant Core has the issue?

core-2024.8.0

What was the last working version of Home Assistant Core?

core-2024.8.0

What type of installation are you running?

Home Assistant OS

Integration causing the issue

actions or services

Link to integration documentation on our website

https://www.home-assistant.io/docs/scripts/service-calls/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 month ago

Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (automation) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `automation` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign automation` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


automation documentation automation source (message by IssueLinks)

pedolsky commented 1 week ago

Had the same problem. It doesn’t work with target but with data