CoRE - Get peer assistance here with setting up Pistons

Perfect. Yea that makes sense.

Thanks for the detailed help!

Hello all

What I’m trying to do is whenever my home alarm changes away from armedAway, execute Routine I’m Back, and then if Mode is Evening, leave the mode as Evening. If the Mode is Away and time is before 60 minutes before sunset, set Mode to Home, otherwise execute a Piston.

I can get the I’m Back routine to fire no problem, but I’m having trouble with the second piece. I’ve been trying with a THEN IF piston but can’t get it to work.

Any suggestions please?


Hi dworkman,

I just wonder what does trigger your home alarm to change from Away?
In addition, I want to clarify your second piece. Is it "If Mode is Evening then leave it as Evening, otherwise if Mode is Away and time is before 60 minutes before sunset, set Mode to Home, otherwise (the 2nd otherwise) execute a Piston.
Do I get it right?

Hi Ton

Thanks for replying. The alarm triggers away from Away when someone turns it off.

Yes you have the second piece exactly right. What type of Piston should I use for this?


Michael, I can’t wrap my head around using a virtual switch. How does a virtual switch work with the Hall Light? I have not ever used virtual switches so I may be missing something but I would imagine that I have to some how tell ST that the Good Morning Hall VS is actually the Hall Light, wouldn’t I?

So Variables and VS’ can work the same way for simple things. Basically they are binary variables, on or off, so you have one action or set of actions turn the VS on or off, or use a variable and set it to 0 or 1. Then you use it JUST like another condition, a switch for example. If the VS is switched on, signifying a state of something, occupied room without a motion sensor for example that was turned on by high power usage of a single device, then it’s ON state is Occupied, if power drops and you have it set to turn that VS off, you then have Unoccupied. Just put it in like any other condition.

Here’s an example, albeit somewhat complex:

The Bedroom Motion Off switch is a VS. I use a minimote or other various means to flick that switch on, then my Piston uses it as an evaluation, in this case, if it’s ON, the motion sensor won’t alter the state of the lights. If it’s OFF, the Piston runs as intended with motion triggers.

Here’s a variable:

This one has a bug in it but shows how you can use them, either as on/off, or here, where I increment the variable count to do something once it hits a certain value. If the variable is less than 5, the light will stay on and wait a few minutes, then it polls itself again with the follow up command, and when that happens it increments the variable. Once the variable is 5 or greater, it will (should) turn off the light in this case. There’s a bug where the But If doesn’t reevaluate for some reason. Still waiting to hear if there will be a fix, I might have to modify this, but you can use this basic scenario if you have a door you want opened a number of times before an action occurs. It’s similar to how some folks let their dog out, light turns on, then they open the door one or two more times, but increment the variable until a number they know would indicate the dog is back inside, then it would turn off the light.

I follow what you are saying but doesn’t the virtual switch have to be tied to something? Like the Hall Light? Otherwise what is the point of adding the VS? Or is this just creating a condition that doesn’t disrupt the Hall Light condtion?

Here’s what I went with, does this look right? Will test this evening.

Nope, it’s literally just virtual. It only exists in “The System” and has no ties directly to the real world. You use it as a switch, but nothing physical ever happens.

So it is just to add a condition to help control the Hall Light?

Yeah, look at my first example again. I have a minimote that when I press button 3, it “flips” that VS on. The Piston won’t turn the actual bedroom light on when that VS is on. It’s just a restriction in this case.

1 Like

OK, I think I am getting it. I think I see that I need this VS because of the BUT IF conditions. I have it set to No Motion AND Hall Light is ON so I can’t add another AND Hall Light is OFF, right?

You can’t add AND hall light is OFF because that contradicts the previous ON. Not sure I follow what you are saying, re-post the Piston please.

Yes, that is what I am saying also. From what I understand, I need to setup another condition but I can’t have the condition using the Hall Light because it would be contradictory. So by setting up a VS I can use it to set additional conditions, right?

Yes that’s correct, so you’d add the VS as a condition of the But If, so AND VS is off.

Then you have a mechanism to turn the switch on, which will prevent the But If from doing it’s thing, until the VS is switched back off.

OK thanks! I will give this a try and see how it goes and let you know.


I cannot see the rest of the Then If section, but it looks right to me.
By the way, how do you normally change your Security mode, manually or using automation?
I would suggest instead of changing Home Alarm system from Armed away and use that as a trigger, you could run Routine I’m back manually or using automation (when you get home with smartphone presence detection?) and use that as a trigger.
You can setup Routine I’m back to change the security mode from Armed away to Disarmed
In this case, you piston would be a bit less complex, you would not need the first If part.


This is my first time using CoRE (v0.3.15f.20161004) and I can not create a new Piston.

I keep on getting the error message “You are not authorized to perform the requested operation”

Here are the steps to reproduce:

  1. Add a CoRE piston…
  2. Leave Piston mode as “basic”
  3. Create a new “if…” statement - results in the “not authorized” error
  4. Go back and then try to create the “if…” statement again - lets me create a new condition
  5. Add a condition - results in the “not authorized” error

Doing anything in the “Main Condition Group” screen results in the “You are not authorized to perform the requested operation.” error message.

I am running SmartThings version on Windows 10 Mobile.

Just click on the image to see the whole screenshot.

I have my ADT Alarm tied into SmartThings. I prefer to use the keypad-disabling of that alarm as the trigger for this piston. I previously tried disabling the alarm based on presence sensors, but didn’t work as smoothly. Plus its more secure this way.

@ady624 will you please give us a warning if and when we should update our screenshots of our Pistons if we will have to rebuild post-beta?