How to call one piston from another


#1

I am new to webCore and home automation. I am in the process of slowly retrofitting my home. For control I want to reduce the number of apps and centralize admin as much as possible. I would like to use webCore where ever possible to do that. I’ve searched the forum regarding my question and found a couple related threads but none that clearly answered my question. At least not in a way that I understand.

I want to create a set of pistons to configure multiple devices on certain floors or areas of my house. My thinking is to then use these area configuration pistons in various other pistons to activate those configurations as needed. I’m hoping this will avoid the need for repeated entry of the device settings across multiple pistons

Is this possible? I assume so but want to confirm.
If so, are there tutorials or example code showing how to call a piston from within another piston?
If not, can someone explain how I might do this?

And, of course, if I’m barking up the wrong tree and there’s a better way to accomplish this please let me know. I was looking at Scenes and Routines in Smartthings but, again, if possible would like to keep all the customization in webCore. In addition to not wanting to bounce form app to app I am just more comfortable with lines of code than I am graphic interfaces.

Thanks!
Tom G.


#2

Create the piston and set it to never subscribe like below so the piston doesn’t react to any events generated by the devices in use within that piston.


#3

I assume that would be the settings for the area configuration pistons I referred to, yes?

So how then would I call those pistons from another piston?

As an example I create two pistons that I’ll call “Area Config X” and “Area Config Y” and a third piston that I’ll call “Which Config to Use” I’ll have a set of if statement in “Which Config to Use” and I want to have it call “Area Config X” if conditions are met and “Area Config Y” if not met.

What I don’t understand is how to call the Area Config pistons from the Which Config piston.


#4

You use the Task called Execute Piston. This is my laundry alert calling the Text Speaker piston with a variable called textMessage that will be spoken.


#5

My example shows how to do that…and how to pass arguments as well.


#6

I saw your reply and thought to myself, “How could I have missed that? It’s rather obvious!”

I didn’t realize I had to set the “with” to location and the “do” to call the piston. I was hung up at the with line looking for a way to call the piston form there. Just created and tested this and it works.

THANKS!
Tom G.


#7

You can still call the tasks available under Location with a device selected, it just doesn’t show device specific tasks.