petro
(Petro)
February 11, 2017, 8:09pm
1
Is it possible to get all the entity_id’s inside a group? I tried:
{% set entity_ids = states.group.living_room.attributes.entity_id %}
and
{% set entity_ids = states('group.living_room.attributes.entity_id') %}
Anyone else have ideas how to accomplish this?
1 Like
ih8gates
(Scott Reston)
February 11, 2017, 8:26pm
2
Would a loop serve your needs?
{% for item in states.group.living_room.entity_id %}
{{ item }}
{% endfor %}
Remember that you can test these in the template dev tool.
petro
(Petro)
February 11, 2017, 8:32pm
3
Where is this dev tool? I’ve been bashing my head on the keyboards with these scripts because I cannot see the state of objects
1 Like
ih8gates
(Scott Reston)
February 11, 2017, 8:39pm
4
Bottom of the left sidebar of the UI. A template debugger, a list of states, a services/API tool… Take a look at this (specifically, “The dev tools are your friend”)
Tips for new HASS/forum users. Help me out - what did I miss?
Posting your configuration
When you post your configuration, we need to see that you’ve got the spacing/indentation right. Use the “preformatted text”
[image]
YAML tips
YAML can be a harsh mistress. Spaces matter, tabs can break things. Here’s a post with some tips for editing YAML with Notepad++
What Home Assistant install method should I use?
If you’re pretty technical, use whatever works for you. Docker, NAS, All-in-one, Has…
petro
(Petro)
February 11, 2017, 9:26pm
5
Thanks! Always wondered what that last page was. At first glance it doesn’t look like an editor.
mboyar
(MURAT BOYAR)
April 8, 2017, 5:51pm
6
in templating editor, writing “unknown” for
{% for item in states('group.all_lights.attributes.entity_id') %}
{{ item }}
{% endfor %}
does anyone have any idea?
mu3
(Jason)
November 14, 2017, 12:19am
7
Use states.group.all_lights.attributes.entity_id
mu3
(Jason)
November 14, 2017, 12:24am
8
Is it possible to list all the entities of the group in service call?
Something like this (HA throws error):
script:
test:
sequence:
service: camera.snapshot
data_template:
entity_id: "{% for item in states.group.cams.attributes.entity_id %}{{ item }},{% endfor %}"
filename: "/Data/cams/{{ entity_id.name }}.jpg"
petro
(Petro)
December 2, 2017, 3:49am
9
I’m not sure what you are trying to do there. Jinja is pretty limited with for loops with home assistant. Value templates typically require 1 output value. That basically makes using {{ value }} in a for loop useless.
For your case, you’ll need to create a separate script for each one of those cams. this is wrong now