@petro wrote:
If you want to turn on/off all lights now that group.all_lights is gone starting in v0.104, use the following service:
turn on
- service: light.turn_on data_template: entity_id: "{{ states.light | map(attribute='entity_id') | list | join(', ') }}"
turn off
- service: light.turn_off data_template: entity_id: "{{ states.light | map(attribute='entity_id') | list | join(', ') }}"
EDIT: This can also be replicated with just about any domain (Accept homeassistant.turn_on / homeassistant.turn_off).
ex switch domain
- service: switch.turn_off data_template: entity_id: "{{ states.switch | map(attribute='entity_id') | list | join(', ') }}"
EDIT EDIT: I believe this will also work without the crazy templates according to the docs here
- service: light.turn_on entity_id: all
EDIT EDIT EDIT:
This is getting more attention than i expected. Here is a canned condition to check if everything of a single domain is equal to a state, eg if all lights are on:
- condition: template value_template: > {% set domain = 'light' %} {% set state = 'on' %} {{ states[domain] | count == states[domain] | selectattr('state','eq', state) | list | count }}
To simply check other domains, like all device_tracker’s are home…
- condition: template value_template: > {% set domain = 'device_tracker' %} {% set state = 'home' %} {{ states[domain] | count == states[domain] | selectattr('state','eq', state) | list | count }}
Posts: 14
Participants: 6