Several triggers with conditions on each triger

I want to run automation whenever one of a list of cameras starts detecting motion and the object detected by that camera is a person.

So far I can set triggers for all the cameras I want and it works (because triggers work with an OR condition), but how do I check on each trigger for another entity (detected object) and just go on if that condition is met?

I guess I cannot use the conditions below because ALL cameras would need to be detecting persons (because conditions work with an AND condition).

On the conditions (after triggers) I will just check if a sensor I created (HOUSE IS ARMED) is on or not.

I hope I was clear enough.

You can do an OR in the conditions. Like this from the documentation.

condition:
  alias: "Paulus home OR temperature below 20"
  condition: or
  conditions:
    - condition: state
      entity_id: "device_tracker.paulus"
      state: "home"
    - condition: numeric_state
      entity_id: "sensor.temperature"
      below: 20
1 Like

Just to be clear, before starting to do it for all the 9 cameras

  • Triggers: any camera starts detection
  • Conditions:
    ** House is Armed AND
    ** Any camera has object = person (with OR)

Is that it?

Perfect.
It’s working like a charm.

Here’s my YAML for future reference:

alias: Trigger do Alarme (movimento nas câmaras e casa armada)
description: ''
trigger:
  - type: motion
    platform: device
    device_id: 0d0f574201bb2090a896073a46766e88
    entity_id: binary_sensor.motion_rua_da_paz_dta
    domain: binary_sensor
  - type: motion
    platform: device
    device_id: e4a22ec087fb3490fbe69e737d6a791f
    entity_id: binary_sensor.motion_av_republica_esq
    domain: binary_sensor
  - type: motion
    platform: device
    device_id: d5f70af2ac8b8b26b90b4cd1afd278e8
    entity_id: binary_sensor.motion_piscina
    domain: binary_sensor
  - type: motion
    platform: device
    device_id: 0688945469601b0a59bce7b225cf9f08
    entity_id: binary_sensor.motion_garagem
    domain: binary_sensor
  - type: motion
    platform: device
    device_id: 00be73a85bdebf7695ddc6e59c169989
    entity_id: binary_sensor.motion_piso_1_tras
    domain: binary_sensor
  - type: motion
    platform: device
    device_id: 32ee4bfe2b11f7e5650ddb0c1d36d45d
    entity_id: binary_sensor.motion_piso_1_frente
    domain: binary_sensor
condition:
  - condition: state
    entity_id: input_boolean.away_from_home
    state: 'on'
  - condition: and
    conditions:
      - condition: or
        conditions:
          - condition: state
            entity_id: sensor.rua_da_paz_dta_detected_object
            state: person
          - condition: state
            entity_id: sensor.av_republica_esq_detected_object
            state: person
          - condition: state
            entity_id: sensor.piscina_detected_object
            state: person
          - condition: state
            entity_id: sensor.garagem_detected_object
            state: person
          - condition: state
            entity_id: sensor.piso_1_tras_detected_object
            state: person
          - condition: state
            entity_id: sensor.piso_1_frente_detected_object
            state: person
action:
  - service: notify.mobile_app_marco_s_iphone
    data:
      message: Pessoa detectada em casa
      title: ALARME
  - service: notify.mobile_app_iphone_xr_paula
    data:
      message: Pessoa detectada em casa
      title: ALARME
  - service: automation.trigger
    data: {}
    target:
      entity_id: automation.ligar_luzes_quando_detectadas_pessoas
mode: single