Does anybody know if it’s possible to add a block of code to a piston that executes when the piston is paused or resumed?
I’m going to plump for no. A start/resume will result in the piston SmartApp scanning the piston code to see what location and device events it needs to subscribe to and to see if it needs to schedule an execution. A pause will be it unsubscribing and unscheduling. So the piston code doesn’t get executed on either occasion.
Graham is right no direct way…
But you can create a workaround with variables etc.
If you use another piston to pause and resume this piston, then that other piston can execute a block of code at the appropriate time.
Why not just do a loop with a condition?
That said, you probably don’t want it running all the time. Maybe look for a condition at intervals…
Although that would be a regular piston then…
I got nothin’
If you’d like to share your project (what it is that you want to accomplish) maybe there is a way without even pausing/resuming your piston
This is what I ended up doing.
Out of curiosity… were you looking for something that would more work like a subroutine? I’ve made a few pistons that act like that. They subscribe to nothing, and you don’t have to pause/resume. Just call them like a subroutine. Works great.
I am a fan of this method as well…
How do you call another piston? Is it the “Execute Piston” command?