I have an AD2USB that reports events every 4 seconds. If a door is open, that’s a VeraAlerts notification every 4 seconds.
I’ve seen the thread on PLEG debouncing. That’s nice, but I still want repeated notifications – just fewer of them. That is, I want to throttle them, not debounce them.
I have the following conditions:
counter for the AD2USB events
cCrawlDoorCount = cCrawlDoorCount + tCrawlDoorOpen
flag for every fifth event (using mod operator)
cCrawlDoorCountEvery5 = cCrawlDoorCount % 5 eq 1
cCrawlDoorCountEvery5 is correctly set to True on events 1, 6, 11, 16, etc. I can simply send an alert when this is True.
But, if I close and re-open the door, the counter starts where it left off from last time the door was open.
How to I reset the counter, cCrawlDoorCount, to 0 when the door is closed?
Alternatively, if someone has a better way, please suggest.