Smart Switch Piston not working


#41

Ok, I can’t explain why a variable labeled datetime doesn’t play nicely with a system variable with the same label ($now is datetime)… but after some playing around I was able to prove this out and see the lockout working repeatably and reliably.


Timer keeps restarting within speaker volume control
#42

Ok, it looks like you moved the addMinute to the then section and you changed the variable type to long. I make the change and give it a try.

Do have a way to run a check and/or cancel all previously running piston instances?


#43

To simplify testing, I changed addMinutes to addSeconds, and changed “if any light switch changes to on” to “if $currentEventAttribute is test”. That way you can just click the test button at the bottom of the piston to execute it, confirm it locks out for 10, 20, 30 seconds or whatever you set it to, then allows the piston to execute again after time lapses.

I can’t say I understand why our original approach didn’t work, but can confirm this approach does. Even if the date format saved in TimeOut is a little harder for us to read.


#44

Sounds good. Oh you mentioned a lock out… can I actually lock a piston from running for a period of time once it activates? That would be pretty cool.

I’d also like to look at adding a condition to see if there is already a running piston or scheduled to run piston that way I don’t start multiple timers.


How to Limit Automations to Once-Per-Period-Of-Time? (when the start-time for the period is dynamic; i.e. based on an event)
#45

You can pause a piston, then resume it (from another piston - not from itself). But by lockout I just meant our TimeOut variable that, through a condition, prevents it from passing the IF condition for a defined period of time. That’s the easiest way to do it… that I’ve found, anyway.