Trigger Piston if an action is not repeated within a timeframe


#1

1) Give a description of the problem
I’ve created a piston that records the date/time an action occurs. I need the piston to alert me if that same action does not occur again within 12 hours. Around 5 separate actions need to be tracked, each occurring independently.

2) What is the expected behaviour?
Record the date/time of various actions. Currently I’m using date/time variables. When the action occurs, one variable is assigned $now, and the 2nd is set using the expression {addHours($now, 12)}. If the action is not repeated before the current time surpasses the 2nd variable, send me an alert

Simplified Example: I push a button at 9am. If that same button is not pushed again before 9pm, trigger an alert. If the button is pushed before 9pm (for example at 7pm), the piston resets to watch if it is pushed before 7:00am.

3) What is happening/not happening?
I can’t figure out the best way to trigger the alert. I’ve attempted using a boolean variable set to True when the action occurs. Then I included “wait 12 hours” and set variable to “False”. If variable remains “False” for 5 seconds, trigger an alert. However, this doesn’t seem very efficient, especially if multiple actions are being tracked.

**4) Post a Green Snapshot of the piston![image|45x37]
Being of a sensitive nature, I’d rather not post a screenshot.

5) Attach logs after turning logging level to Full
N/A


Dryer piston based on acceleration
#2

Something like this maybe? Change addMinutes() to addHours()


#3

That seems logical. I will try integrating that strategy.

The main question is can this can be replicated with about 6 other independent switches simultaneously and efficiently? If so, will each require their own dedicated Piston?

Thanks for your help!


split this topic #4

5 posts were split to a new topic: Dryer piston based on acceleration


#5

I moved Glen’s piston to a new topic to help stay on topic here.