I have a piston that is designed to take input from a motion sensor near my driveway (connected via a z-wave contact closure) and, when it’s activated, send a push notification and activate a chime in the house. I also would like to receive only one push/chime event per 5 minutes, since this motion sensor can be repeatedly triggered by people walking around, etc.
The code I’ve written for this does not successfully inhibit multiple notifications. I will get as many notifications as there are contact closure events. It appears that there’s an evaluation error when I attempt to compare the value of the previous alert DateTime value with the $now - 5 minutes value. Please see the below code and log entry, paying particular attention to the time values in the comparison at +565ms in the log.
I’ve also tried changing my LastNotification variable data type to an integer and a long, with similar results.