CoRE - Get peer assistance here with setting up Pistons

The piston build screen should look similar to this…

UPDATE: I was using the contact sensor as a “sensor” not “Contact Sensor.” UGH!! Got it now and the rule now works. Nubie error. Thanks for your help in showing me the light… :wink:

2 Likes

I need help setting up a CoRE Piston. I have a smartthings motion sensor in the kitchen to turn on the kitchen Lights. Here is my problem. To keep the lights from triggering from movement in other parts of the house I have to put the sensor by the entrance to the kitchen. I want the lights to turn on with motion and off after 3 minutes if no motion. But if I’m in the kitchen cooking I don’t want the lights to turn off. So I wanted to set it up like if the lights are on and motion is detected do nothing, and if the lights are off and motion is detected turn on, and then off after 3 minutes of no motion. I thought I had this working but I don’t. I don’t know where to plug in the conditions and actions. I don’t know how to separate them so one condition doesn’t restrict another. Also do I need to setup as a simple basic or something else? I’m sorry for all the questions I’m still kinda knew at this.

Yes, $random is a decimal between 0 and 1 inclusive.

Go to the dashboard, select any piston and then scroll down to find all the available system variables, they start with $ and are read-only.

There is a changes (changes in general) and a changes to which is specific to a new required state…

I’m pretty new to CoRE myself. For some answers you can look at my walk thru for setting up your first piston.

For some of the motion sensor stuff you need to also think about the hardware you have. Most (if not all) motion sensors will have a built in “blind time” where they don’t change their status (either motion or no motion) regardless of what the actual sensor shows. So you need to determine what your built in time is on that (and some devices allow you to change it).

But you can within CoRE also use delay times so coupled with the built in delay you should be able to achieve what you want.

Also do check out the wiki because it does explain the basics. You may want to (I typically like doing this because it really helps me) to write down your piston in logic terms (IF, THEN, WHEN, etc.) on paper just so you know the flow of the logic you’re trying to accomplish. That should help with realizing when one condition may interfere with another.

This is my kitchen lights piston. If I turn the lights on myself, they stay on until I turn them off. The time is any is just a placeholder, I was initially doing it at dusk, but am now doing it at any time of the day.

1 Like

So is your autoKitchenLights variable what you use to signal that this piston has been run and active? And thus then avoids the piston being re-run. But how do you change that variable to false to sort of restart the process (for the next day or later on that day or whatever)?

I ask because this may be what I could use in my kid’s room light on thing, maybe setting a variable to true when the lights go on and then set back to false at sunrise or something.

It gets reset in the but if. Works self-sufficiently, no reset required

So one of those two IF’s will occur at some point (the IF and the BUT IF) when run or otherwise the piston doesn’t run at all and thus your variable never gets to “true”. But once the piston gets called with the first IF, it will eventually go to the BUT IF state and thus varible goes back to false.

This is really cool, hard for me to grasp, but REALLY cool.

Running into a wall here: Help with smartthings motion sensor trigger

I cannot seem to be able to get a duration qualifier on a second level logic?

…[quote=“Ac7ss, post:3, topic:56600”]

If KitchenLight is off { 
If MotionSensor is active { 
with KitchenLight {   
turn on  
}  
If MotionSensor is inactive for 2 minutes{   
with KitchenLight {
turn off
}  
} 
}
}

[/quote]

This is what I have now and it’s not working. I tried latching too and it at least will turn off the lights after the wait time but I still have the problem with if the lights are already on and I walk by the sensor it then turns them off after wait time. I think I am missing the variable thst you have, but I don’t know how to setup a variable like that.

That’s why the top level is checking the switch. I am starting to think that we need to use a virtual switch set by the wall switch:

If WallSwitch changes to ON {
with VirtualWallSwitch { turn on }
with KitchenLight {turn on}
} else if WallSwitch changes to OFF {
with Virtual WallSwitch { turn off }
with KitchenLight {turn off}
}

And then run yours:

If KitchenMotion is INACTIVE for 2 minutes and VirtualWallSwitch is OFF then {
with KitchenLight {turn off}
} else if KitchenMotion is active and KitchenLight is OFF {
with KitchenLight {turn on}
}

This is something simple but I can’t quite seem to manage it. I have a vibration sensor on my dryer which registers OPEN for vibration and CLOSED for no vibration. I am trying to make a piston to tell me when the clothes dryer is finished using this logic:

If sensor changes to open and then stays closed for 5 minutes -> it’s finished.

There are a couple of quick open/closed cycles when laundry is being loaded, door is open/shut. Then there is continuous “open” (vibration) until the dryer is finished. I figured that once the vibration register stays ‘closed’ for five minutes the dryer is finished.

Any help appreciated.

I have tried that route lots of times, with no luck. Please let me know If you manage to make it work, thanks.

I cant seem to find a option for how many times a trigger for a open / close sensor should fire a day.
I have 1 open/close sensor Id like to fire once between 0800 and 1200 in morning.
And one that fires twice.
Is this possible? Or isnt that option added?
I would appreciate it If you guys can give me a howto If possible.

The only way to make s contact sense report open/closed is to actually physically open and close it.
You can not program it to fire.

Someone else was having trouble with the having a timed condition like that. I think the best way to solve it is to use a wait with a cancel on piston change

If Dryer contact changes to open
Then (using whatever devices) wait 5 minutes (TCP: Cancel on Piston State Change)

Does that make sense?

That should accomplish what you’re wanting… I think the problem may be that the “closed for more than” is a condition not a trigger, so the Piston doesn’t know to go back and re-evaluate it once it evaluates on the contact change… Though, I may be wrong about that.

1 Like

You could use a variable…

Set two variables…

Piston #1 fires at midnight and sets the global variable {@Trigger1} to 0
Piston #2 checks {@Trigger1} as a conditon and if it’s less than 1 (or two) it fires and uses location to set variable {@Trigger1} to {@Trigger1} + 1

You could use Piston #1 to reset as many variables as you like and have the individual pistons do the rest.

I think that’s what you’re wanting, and it works, in my head at least. It may be overcomplicating things, though.

Can you try and explain a bit what you need? Use door, window, plain English words :slight_smile: You can’t have a sensor “fire” unless you physically open the door/window it’s attached to…

1 Like