Content-Length: 282555 | pFad | http://github.com/home-assistant/core/issues/139631

EE template switch helper "e is not iterable" on "actions to turn on" or "..off" · Issue #139631 · home-assistant/core · GitHub
Skip to content

template switch helper "e is not iterable" on "actions to turn on" or "..off" #139631

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

Open
ptryk opened this issue Mar 2, 2025 · 5 comments
Open

Comments

@ptryk
Copy link

ptryk commented Mar 2, 2025

The problem

in using the template switch helper I and others are getting the response "e is not iterable" when adding a device (no entities allowed?) in "actions to turn on" / or .. off
eg:

Image

What version of Home Assistant Core has the issue?

Version core-2025.2.5 Installation type Home Assistant OS Development false Supervisor true Docker true User root Virtual environment false Python version 3.13.1 Operating system family Linux Operating system version 6.6.62-haos-raspi CPU architecture aarch64 Timezone Europe/Stockholm Configuration directory /config

What was the last working version of Home Assistant Core?

not sure, never used this feature before

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Template switch

Link to integration documentation on our website

https://www.home-assistant.io/integrations/switch.template/

Diagnostics information

not sure how to go about this.. it is all devices in the template helper - switch when adding a action

Example YAML snippet

please see post 4 here:
https://community.home-assistant.io/t/error-in-describing-condition-e-is-not-iterable/832113/4

I also show how I found a work around.

Anything in the logs that might be useful for us?

maybe this (?):

  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 645, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: 'dict object' has no attribute 'warning'

Additional information

as above:
please see post 4 here:
https://community.home-assistant.io/t/error-in-describing-condition-e-is-not-iterable/832113/4

I also show how I found a work around.

--
how to reproduce
open helper
choose template
choose switch
add a device on "actions to turn on" or ..off
error

also, I find it strange one can not choose an entity for an action but that is maybe normal (?) but my workaround consists of avoid the device and use entity (see post linked above)

@home-assistant
Copy link

home-assistant bot commented Mar 2, 2025

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

Code owner commands

Code owners of template 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 template 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)


template documentation
template source
(message by IssueLinks)

@ptryk ptryk changed the title template switch "e is not iterable" template switch helper "e is not iterable" on "actions to turn on" or "..off" Mar 2, 2025
@Sleinous
Copy link

Sleinous commented Mar 15, 2025

im experiencing this regression on automations that i've set up 2+ years ago, OR conditions, when I trace my automation it's now failing each time i leave home due to same error "e is not iterable"
Snippit of my conditions section of yaml :

condition: or
conditions:

  • condition: device
    type: is_on
    device_id: 3a9ad8844b5f45b6bf4c30fe4f49b5a1
    entity_id: 091e7b1e6669591b3bdd7162436617a4
    domain: switch
  • condition: device
    device_id: e8abc4b112c2f26a5dc491d9465a9c32
    domain: cover
    entity_id: 201deb1e551f46380f777ef51507d4ca
    type: is_open
  • condition: device
    device_id: 93b9f5cfb58955283d1dcb38c717ea04
    domain: cover
    entity_id: 6065ecfcb65aaacce79798eede623bb5
    type: is_open

Screenshot of trace:

Image

@karwosts
Copy link
Contributor

Note that error is only related to the display in the trace viewer, it has nothing to do with the actual function of your automation. It's just failing to render the name of the condition.

@ptryk
Copy link
Author

ptryk commented Mar 16, 2025

Note that error is only related to the display in the trace viewer, it has nothing to do with the actual function of your automation. It's just failing to render the name of the condition.

a caveat maybe (?) is that in order for it to work via the helper I have to go into Yaml and fix it then yes it works, if I do not it will not work as the options of what to actually do with the on/off state are not made available (as far as I know this has nothing to do with an AND or OR it is simply adding a device (no entities allowed which also seems strange))

Image

@karwosts
Copy link
Contributor

karwosts commented Mar 16, 2025

@ptryk - your error and Sleinous's error are two different/unrelated bugs. I was responding to his comment.

Your issue is being looked at in Fix device actions in step-flow-form home-assistant/frontend#24539, but it seems there are multiple problems in both frontend and backend, so it won't be completely solved by that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/home-assistant/core/issues/139631

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy