I need a piston that has a variable timer. Within smart things I have 3 simulated buttons with a different number of minutes for each one.
Essentially there is a primary switch that needs to stay on for a varied amount of time, based on button input. Time starts at zero and turns on for X number of minutes when simulated button 1 is pushed, turns off when time expires. If button one is pushed again it resets the time to the predetermined amount. If button 2 is pressed it will increase the time by its amount or ignore it completely if there is already that amount or more on the time.
For example:
Button 1: 10 Minute
Button 2: 20 Minutes
Button 3: 30 Minutes
Button 3 is pushed, device turns on sets to 30 minutes.
3 Minutes Later Button 2 is pushed, but since the timer still has more than 20 minutes on it, push is ignored.
25 Minutes Later Button 1 is pushed, since time is below 10 minutes, timer is reset to 10 minutes.
If timer reaches zero device turns off.