Jump to content
Automate Life
Larry Underwood

Webcore Tutorial

Recommended Posts

I have been asked to create a webcore tutorial. One of the most often asked questions has been what is a variable and how do I create one. You can think of a variable as a container. There are several kinds of containers as there are variables. For example there are piston variables that only work inside the piston itself and there are global variables which can be used by any of your pistons. Global variables are what I will explain first as they are the most useful. A global variable has a @ symbol in front of it so you can tell it apart from other types of variables. They can hold the names of your devices, a time, date, ect. I use them most often to hold the names of devices. While you are editing a piston look to the right of your screen and you should see a link that will allow you to create a global variable. It looks like this


Click on it and it will open a box that looks like the picture below.


Select Device in the drop down box after clicking the down arrow, then where the @ symbol is give it a name. The name should match what type of devices you are putting in it. For example i create one and put all the sensors that are on all my outside doors in my SHM piston..


As you can see in the picture above i clicked on the down arrow in the value field and selected physical devices, then clicked on the down arrow in the nothing selected field and selected the 2 sensors that are on my doors leading to the outside.


Finally click on the blue Add button and you have just created your first global variable that can be used in any piston you import or create.

Next in this series I will explain piston variables, how to create them and how to use them in pistons.

If anyone has any questions please ask them here.

  • Thanks 1

Share this post

Link to post
Share on other sites

This post will explain how to create piston variables and show you their basic use.

A piston variable can only be used in the piston it is created in. None of your other pistons can use or change it unlike a global variable explained in the previous post. To be able to create a piston variable first either import a piston or create a new one. Once you do that you will see some options that you can turn on and off by clicking on them in the upper left hand side of your screen. They look like what you see below.


The ones in blue are turned on. If the first one on the left is not blue click on it and it will turn on allowing you to see the piston variables and create them. Once you have that on you can click on a link in the blank piston that says add a new variable. Its light gray so it's hard to see. Its in between the word define and end define;


Once you click on that you should see a box pop up that looks like the picture below.


Where you see the word Dynamic is called the variable type. As you can see there are many different type of variables you can create and use in the piston. Let's talk about one of the more useful ones. Look in the list and you should see one called Boolean (true/false) it's one i used in my washing machine piston. click on that option then look over to the right of that field and you will see a blink space that will be the name of the variable that we are creating. Give it a name, for example in my washing machine piston i called mine WashingStarted because it is used to let the piston know when the washing machine was being used.


Once you have done that there is the Initial Value fields. I very seldom ever fill these in because when this piston runs each time the variable you are creating will always be reset to this value. There are times that this is desirable but not often so leave these blank here. Once you click on the Add field you have just created your first piston variable. As show below.


Now that you have created it what can you do with it you may be asking. If you look at my washing machine piston you can see that i use it to tell when the washing machine is being used.


So if the Smart plug that the washer is plugged into rises above 50W and the piston variable is False then it will set the variable to true, meaning that the washer is in use.

In the other part of the piston i use the conduction of that variable to allow the piston to continue to wait for the power level to drop below 5w meaning the washer is done. If I didn't use the variable that part of the piston would try to run even when the washing machine wasn't in use as the power level would always be below 5w when not in use.


Then after it alerts us when it's finished i change the variable back to false so it doesn't keep trying to alert us every 5 minutes.

If anyone has any questions about this please ask here.

If anyone has suggestions about some part of webcore they would like me to explain next I'm open to suggestions. Otherwise I will talk about how to create IF, Then statements and what a trigger and conduction is and how to get them to work correctly in a piston.


Edited by Larry Underwood
  • Thanks 1

Share this post

Link to post
Share on other sites

Ok, let's talk about the meat and potatoes of webcore automation's. That is the If/Then statements.


There are 2 parts to a If/Then statement. Lets start with the if statement. if you click on the + add a new statement link in between the execute and end execute; as you can see in the picture above, you will get a box like the one in the picture below.


Click on the blue Add and if button and you will see another box like the one below


Click on the blue Add a conduction button and you will see another box like the one below


Let's say we want to turn on a light when we enter a room. First we will select the Nothing selected drop down box to the right of the Physical Devices field.


As you can see in the picture above I have selected the Laundry Room Motion Sensor, then select that i wanted to detect motion to the right of that then under What kind of comparison field I selected a trigger for it to look for. Each statement should have a trigger statement, otherwise it will not always run when you want it to.


As you can see in the picture above there are Conduction's and Trigger's. I selected a trigger because i want it to execute when it sees motion. If i wanted to add another requirement, let's say i only want it to turn the light on at night I would add another statement requirement but this time i would select the IS conduction. You only want 1 trigger for each statement. Look at the picture below.


As you can see I have 2 conduction's and one trigger. You can tell which ones are triggers as they will have a orange lighting bolt icon to the left of the statement and the conduction's will not. So here It's saying if one of my family members comes home check and see if the time is between sunset and sunrise , if it is then check and see if the outside light switch is off, if it is then continue to the THEN part of the statement and preform that function, in this case turn on the outside lights. If either of the conduction's are false it will not preform the THEN part of the statement.

There are a lot of different ways this can be used. It's pretty much only limited my the devices you have to control and your imagination. Play around with creating a new piston and see what can be done the best teacher is experience. If you have any questions come back here and ask. I will be glad to help.

Unless anyone has a different suggestion, next time I will talk about restrictions, what they are and how you can use them in a piston.

Edited by Larry Underwood
  • Like 1

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...