I have 2 yolink sensors. I need to send a notification to my phone when the one by my house has been triggered but the one at the end of my driveway has not been triggered in the past 5 seconds. At the moment I am testing before installing them. I will bump the time up once I get this working. I am fairly new to YAML but I am not sure how to do this. Here is my code.
Funny you say that. I ended up learning that in about the past hour. Unfortunately I am still having issues. My code is now this
alias: Back Drive Motion with Front Drive Check
description: >
If the back drive motion sensor is triggered but the front drive motion sensor
hasn't been triggered in the past 5 seconds, send a notification.
trigger:
- platform: state
entity_id: binary_sensor.back_drive_motion_sensor_motion
to: "on"
condition:
- condition: template
value_template: >
{{ (now() -
states.binary_sensor.front_drive_motion_sensor_motion.last_changed).total_seconds()
> 5 }}
action:
- data:
name: Back Drive Motion Automation
message: >-
Condition met. Front Drive Last Changed: {{
states.binary_sensor.front_drive_motion_sensor_motion.last_changed }}
action: logbook.log
- data:
message: Back drive motion detected while front drive not triggered.
title: Motion Detected
action: notify.mobile_app_alexs_iphone
mode: single
What Rick says. I have automations similar to that.
So, basically, your logic must be: When the back driveway’s sensor gets triggered, check that the front driveway’s sensor is off and hasn’t changed in the last 5 seconds.