Alarm automation

good afternoon… I created an automation for home invasion notification.
I created a switch called “Alarme” that, when activated, will see the conditions if any motion sensor or light switch is on, to send a notification:

alias: alarme__
description: ''
trigger:
  - platform: state
    entity_id: switch.alarme_418
    to: 'on'
condition:
  - condition: or
    conditions:
      - condition: state
        entity_id: switch.1
        state: 'on'
      - condition: state
        entity_id: switch.2
        state: 'on'
      - condition: state
        entity_id: switch.3
        state: 'on'
      - condition: state
        entity_id: switch.4
        state: 'on'
      - condition: state
        entity_id: switch.5
        state: 'on'
      - condition: state
        entity_id: switch.6
        state: 'on'
      - condition: state
        entity_id: switch.7
        state: 'on'
      - condition: state
        entity_id: binary_sensor.8
        state: 'on'
action:
  - service: notify.notify
    data:
      message: xxxxxxx
      title: Alarme
mode: single

I’m not able to use the trigger as I used to in the reactor… I wanted that after the switch on, it was waiting to see if any light turned on during the entire time the Alarm switch is on

You need it the other way around:

alias: alarme__
description: ''
trigger:
  - entity_id: switch.1, switch.2, switch.3,
      switch.4, switch.5, switch.6,
      switch.7, binary_sensor.8
    platform: state
    from: 'off'
    to: 'on'
condition: state
    entity_id: switch.alarme_418
    state: 'on'
action:
  - service: notify.notify
    data:
      message: xxxxxxx
      title: Alarme
mode: single

This will trigger if any of your sensors turn on while your alarm is on.

You might wants to have a look at the alarm integration, the automation will work similar way above but you have more control of the alarm entity then the switch on or off.

Manual Alarm Control Panel - Home Assistant (home-assistant.io)

Thanks… I had already thought of it this way, but I’m afraid that it will overload the home assistant because there are too many entities in the trigger… there are more than 100. but I’ll test it

I have about 40 sensors and a similar automation that must trigger hundreds of times in a day - my HA on a Pi 4 runs about 3% CPU most of the time.