Hi,
I’m not sure how to (best) achieve this.
I want an automation to trigger only if the last time an occupancy sensor A switched from “clear” to “detected” was after sensor B switched from clear to detected.
In the scenario I have, a room has only one exit, and both the room and the hallway are equipped with motion sensors. I want to set it up such that the room sensor going to “clear” will only turn off the lights if the hallway sensor’s last trigger was more recent than the room’s. Since otherwise, it can be guaranteed that somebody is still inside the room.
I found the ability to create an input datetime helper, but I’m not sure how to keep it synchronized with the sensor. I tried setting it to {{ now().timestamp() }} and variations thereof, but the UI rejects it all. I even tried editing the YAML directly but it still shows up with a red outline and fails to save.
Maybe there is a better way of accomplishing this?