New ST convert here, and i'm loving the new platform!
I'm working on migrating all my automations over. I'm curious how i can set up a presence trigger for arrival, but have it run only if the device has been away for more than 5 minutes.
I started working down the route of using a Global Variable, and setting it to "now()" when i leave, but i'm stuck figuring out how to do the comparison of that variable to "now()" again when i arrive back. I've thought about making another rule to update another variable every minute and comparing against that, but that's not ideal since it 1) adds something that has to fire every minute on the hub, and 2) won't be directly in sync with when i leave.
What's the best way to compare against the last state change like this? I'll need this ability for another rule soon too, wherein i need to detect if a door is closed within 20 seconds of it being opened.
Any pointers will be much appreciated.