Help turning three pistons into one


Hi everyone!

So, I have 3 motorized blinds and many remotes all connected through Z-Wave. The blinds take 22 seconds to fully open or close, and sometimes I want them fully opened, sometimes at “half” and sometimes just a little bit to let some air in but not much light.

So I have 3 pistons like this but with different seconds (5, 12 and 22) :

IF button 1 is pressed
IF blinds_opening false
set blinds_opening true
Motor 1 open
wait 12 seconds
Motor 1 stop
Motor 2 open
wait 12 seconds
motor 2 stop
Motor 3 open
wait 12 seconds
motor 3 stop
set blinds_opening false
Stop motors 1, 2 and 3
Set blinds_opening false

(yes, I want them to open sequentially, not all at once)

I would like to know how is the best way to convert all this into one piston that uses a variable to set the time and then performs the actions. I did something similar with this forum’s help recently, but the action was not performed straight away, it set a time variable, so I’m not sure how to do it here :slight_smile:



I’m not sure I understand what you want. Do you want the variable to be different (5, 12, 22 seconds) based on unique triggers?








Where SECONDS_VARIABLE is 5,12,22.

If pressing BUTTON 1 is your only trigger, then I don’t see how you are going to determine how long you want your waits to be.


as Pantheon mentioned, i think you will need 3 separate ways (buttons/etc) to trigger this single piston.

then you can do somehting like this:

if button 1 pressed
– set waitTime to 5
end if

if button 2 pressed
– set waitTime to 12
end if

if button 3 pressed
– set waitTime to 22
end if

rest of piston runs normally below the above if statements, and uses the variable “waitTime” for each of the waits.

I think it would require 4 buttons or ways to trigger for complete functionality:
open 5
open 12
open 22

If you arent limited to hardware buttons/remotes (like you use a customizable web interface for some home controls), you could use web calls to run the piston and send arguments to the piston to tell it what was triggered, and even use custom on the fly presets, like “open XX” where xx can be any number for open seconds between 0 and 22.


Thanks @mbarone and @Pantheon! Yes, I have many buttons, and I’m also using IFTTT commands with Google Assistant. There are other buttons configured to stop or to open/close the blinds individually.
I just couldn’t think of a way to design this whole piston.
I forgot to mention that I wanted one button to close all, and all this running inside the same piston.

I think I made it. At least it seems to be working.

ns_all defines if the blinds are moving. If they are, then pressing any of these buttons or sending the commands again makes them stop instead of start.
ns_time sets the seconds for opening the blinds. Closing always sends 25 seconds which makes them close fully considering possible delays.
ns_open defines if the piston will open or close the blinds.

Another question… What is the best way to make another piston run a specific task on this piston? I could create simulated switch and make the piston react to changes in that switch, or the same with a global variable, but are those options OK or is there anything better?



I am quickly looking through your piston so I have not given it lots of thought yet. And this may be what you intended, but when is ns_all assigned prior to the IF?



Actually I changed the task cancellation policy after sending the capture. The IF in line 55 is now cancelled on piston state change and the IF in 58 is on condition state.

ns_all was originally defined as false, then when the piston runs either way (up or down) ns_all becomes true, and when the blinds stop running, ns_all becomes false again.
This way, if any of the buttons or actions are triggered for a second time while the blinds are running (while ns_all is true), the blinds will STOP running.
This helps me avoid having a separate STOP button. I have three NanoMotes with 4 buttons each, and I wouldn’t have space to fit the up/down/stop for each motor and then up/down/stop for all and also other actions that are not related to the blinds.




Yup I read that before. I don’t know what’s your suggestion here. The piston is working the way I intended, and I’m checking the variables while it works and they are changing the way I intended too.

Just in case, with “up or down” I was referring to the motor direction.



LOL, I thought you were suggesting your piston runs up or down…My bad… :blush:


I’m having a weird problem…

[EDIT: SOLVED on its own, now it’s working fine]

Since the last edit the piston is working when I PUSH the buttons 2 or 3 of the remote.

I have other actions for pushing the buttons, this piston is set to react when buttons are HELD and not PUSHED.

In the SmartThings app, when I go to the recent actions of this remote it only shows PUSHED and not HELD, and the piston is being triggered.

I know there are no links between these buttons and the mentioned IFTTT actions or the other switch that is used as a trigger on this piston.

This was working smoothly, only after this last edit the piston started working with button pushes (?).

Pushing other buttons in the remote doesn’t cause this piston to run.

What could be happening here?