2024年11月24日星期日 上午6:26:19

Turning off all house lights with automation - except indicator light

10 个月 前
#25172 引用
Turning off all house lights  with automation - except indicator light
0
10 个月 前
#25173 引用
step 1.New script


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(', ')
            }}



New Automation



- service: script.all_lights_off
  data:
    exclude_entity_ids:
      - light.night_light
      - light.udendors_lys_2




source:https://community.home-assistant.io/t/is-there-a-way-to-adress-all-except-to-turn-lights-off/497651/2?u=msly
0