Pause and resume piston with a button


#1

1) Give a description of the problem
Cant find toggle piston state or something similar

2) What is the expected behavior?
I want to push a button to pause a piston and resume , my buton does not have the held fonction !

3) What is happening/not happening?
Cant get my button to resume my piston , easy task but my button does not support the held fonction

4) Post a Green Snapshot of the pistonimage

Thanks
Sylvain


#2

First off, I would separate the two IF’s into their own block of code. (not inside the else)

Secondly, one button can not directly do two different tasks. Each time it is pressed, the same command will always be sent.

A possible workaround is to create a Simulated Switch. Each time Keypad 7 gets pressed, it toggles the SimSwitch. Then create another piston monitoring the SimSwitch. When the SimSwitch changes to on, then pause the third piston. When it changes to off, then resume it.

To be fair, 95% of the time when people want to Pause a piston, it’s because that piston is not coded correctly. It might be worth considering troubleshooting the offending piston instead of finding a way to silence it.


#3

I will only use it a 4 or time a years or so , that why i only want to pause the piston ,i never know when it will happens .
Thanks for the trick i didnt think about a simulated switch , good workaround .


#4

Seems a shame to waste a physical button on something that’s only used 3-4 times a year… I use a simulated switch called ‘automation’ and every piston I write checks if automation is on before executing. For the rare times I wish to disable things, I just open the app and toggle the switch.

If you prefer the use of your keypad, then rather than using a simulated switch that only gets toggled by webCoRE, cluttering your ‘things’ list, I’d suggest toggling a boolean type variable instead.


#5

Yes i know but a 10 $ xiaomi button to make my wife happy is nothing !! lol
I’m not shure that i understand the boolean type , i can only do basics webcore , english is hard for me .
I will take a look at it .
Thanks