Turning off all house lights with automation - except indicator light
0
script:
all_lights_off:
description: Turn all lights off except an exclude list
mode: single
fields:
exclude_entity_ids:
description: entity_ids to exclude
sequence:
- service: light.turn_off
target:
entity_id: >
{{
states.light
| selectattr('state', 'eq', 'on')
| rejectattr('entity_id', 'in', exclude_entity_ids)
| map(attribute='entity_id')
| join(', ')
}}
- service: script.all_lights_off
data:
exclude_entity_ids:
- light.night_light
- light.udendors_lys_2