Compare timstamp of two motion detections

Hy
i woul like to recive an announcement (tts or flashing light) when someone walks towards our house.

But only when the walk towards the house, not when leaving.

I thoght i could do that with two motion sensors (s1 and s2).

Announcment should only trigger, if timestampt from the second sensor s2 100m after entrance ist bigger (later) then the one from the first sensor s1 (at entrance).

how do i write this automation? our could you even send me a blueprint?

i would real appreciate your help.

thank you

Create an automation with a State Trigger that triggers when S1 changes state to on. In the automation’s action, use a wait_for_trigger containing another State Trigger that triggers when S2 changes state to on. Now you have two triggers that detect the sequence of S1 triggering first and S2 triggering second. Complete the automation with a service call to TTS or flash a light or whatever technique you want to use for notification.

1 Like

I use such logic to determine which stairways light animation should be played when entering stairways from ground floor or from first floor. To determine this I use trigger for stairway presence sensors and condition for either ground or floow presence.
So in your case trigger for announcement could be s2 an condition woul dbe that s1 is already triggered. Drawback is that it is dependent on PIR sensors detection times. In my case it does not matter, sicne difference between triggering sensors in in range of 1~2 seconds. in your case, if distance between sensors is large it might exceed usual sensor active time (~1 minute) and then it wont work.

Thanks a lot for the quick answer.
sounds interesting - hope to find time to try it out tonight after work!