Piston pause/resume

piston
execution

#1

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?


#2

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.


#3

Graham is right no direct way…
But you can create a workaround with variables etc.


#4

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.


#5

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’


#6

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


#7

This is what I ended up doing.


#8

Excellent!


#9

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.


#10

I am a fan of this method as well…


#11

How do you call another piston? Is it the “Execute Piston” command?


#13

Yes