Automation does not seem to work using condition AND

Hi,

I have two device - an Arlo Pro 2 and Mi Sensor (not aqara) both detected and is working individually (state changes when motion detected on this devices, separately). Now I want to automate a notification, some sort of a doorbell kind (because Arlo is giving too many false positive; and I do not have subscription and Mi Sensor cannot recognise human only subject).

I have placed my camera and sensor well apart both facing the door and want to trigger a push notification to my phone when both sensor detects someone at the door area.

However, it does not seem to work and I tried searching in the community forum but could not find anything specific.

I tried without the “AND” condition and it works but it is on the basis of either or device. I need notification only when both device triggers. I have place both motion sensor and camera next to each other so I can confirm motion is detected on both device at the same time and the timing works (validated through the sensos timing individually) but the automation did not trigger so I am assuming it is the condition.

This is my automation config. Can someone help to point where it gone wrong?

id: '1629898121523'
alias: Visitor
description: ''
trigger:
  - platform: state
    from: 'off'
    to: 'on'
    for:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
    id: porch_cam
    entity_id: binary_sensor.aarlo_motion_home_cam_porch_2
  - type: motion
    platform: device
    device_id: d97d4fe03043
    entity_id: binary_sensor.motion_sensor
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
    id: motion_sensor
condition:
  - condition: and
    conditions:
      - condition: trigger
        id: porch_cam
      - condition: trigger
        id: motion_sensor
action:
  - service: notify.mobile_app_galaxy
    data:
      message: Someone at the door
      title: Front Door
mode: restart

Any particular instance of an automation can only have one trigger so your condition will never be true.

Your condition should be asking if both binary_sensors are ‘on’

1 Like

Try this version:

id: '1629898121523'
alias: Visitor
description: ''
trigger:
  - platform: state
    entity_id:
      - binary_sensor.aarlo_motion_home_cam_porch_2
      - binary_sensor.motion_sensor
    from: 'off'
    to: 'on'
condition:
  - "{{ is_state('binary_sensor.aarlo_motion_home_cam_porch_2', 'on') }}"
  - "{{ is_state('binary_sensor.motion_sensor', 'on') }}"
action:
  - service: notify.mobile_app_galaxy
    data:
      message: Someone at the door
      title: Front Door
mode: restart

It still triggers for any one of the two binary sensors but it also checks if both are on.

1 Like

like you thinking bro

This works. Based on the trace, it evaluate the first one, then the second one. However, if the first one failed, it’ll exit the automation. That works for me because it both must be ‘true’ (on) before the notification can be sent.