petro
(Petro)
June 12, 2018, 1:53pm
21
Sorry, Typo, the second line needs to use all_people object to filter the list.
- platform: template
sensors:
everyone_home:
friendly_name: "Sensor that tells me if Everyone is home"
value_template: >
{% set all_people = states | selectattr('entity_id', 'in', state_attr('group.family', 'entity_id')) | list %}
{% set home_people = all_people | selectattr('state', 'equalto', 'home') | list %}
{{ all_people | length == home_people | length }}
Here’s my Test with lights:
{% set b_states = states | selectattr('entity_id', 'in', state_attr('group.basement', 'entity_id')) | list %}
{% set b_on = b_states | selectattr('state', 'equalto', 'on') | list %}
{{ b_states | length }} Basement lights
{{ b_on | length }} Basement lights are on
{{ b_states | length == b_on | length }}
Everything Off:
1 Item On:
Everything On:
1 Like
wait a minute, this is to say All are home, not anyone…? in that case, the false is correct
I’d need it to check if, and if, who is home…
cross posted:
got it:
now list the items that are on…
1 Like
petro
(Petro)
June 12, 2018, 2:42pm
23
should just be using the filters that @dale3h used in the example you posted.
for name:
{{ home_people | map(attribute='name') | list | join(', ') }}
{{ lights_on | map(attribute='name') | list | join(', ') }}
for entity_id:
{{ home_people | map(attribute='entity_id') | list | join(', ') }}
{{ lights_on | map(attribute='entity_id') | list | join(', ') }}
2 Likes
ok will check.
Would you know how to get that list to show from top to bottom in the frontend? right now it fills up the sensor line, obscuring the name of the sensor, since it populate that line going left…
o yes, wow.
only the first in the list. hmm, how to give that a dash?
btw, besides being a great online checker tool, this might be even more useful for an Offline warning tool:
{{ dict((states|selectattr('entity_id', 'in', state_attr('group.critical_hubs', 'entity_id'))|list)|groupby('state'))['offline']|map(attribute='name')|list|join(', ') }}
petro
(Petro)
June 12, 2018, 3:59pm
26
Simple, just add it before the code!
- {{ lights_on | map(attribute='name') | list | join('\n - ') }}
1 Like
right. duh. feeling soo tired.
petro
(Petro)
June 12, 2018, 4:08pm
28
Lol, We’ve all been there before…