[OBSOLETE] [BETA MILESTONE 1] CoRE (Community's own Rules Engine)

Yeah, it would be interesting to see what qualifies as physical in the stock DTH. I think both templates are available, not sure if updated, though. I know some are not the same as what’s on the hub.

If this is the wrong place to post this (i.e. there is a separate thread for such questions) please let me know.

I have door hinge contact sensors on all my entry doors along with Schlage Z-Wave lever locks. The idea was that I wanted to know if the door had been opened without a code being entered into the lock. My initial swing at it worked great save one minor detail. Anytime the doors were opened from the inside (no code) I received a notification. It works, but not ideal.

So I thought I would try and re-work it but I am not coming up with anything useful. My wife and I have arrival sensors, so I can use that to suppress the alerts when we are home, but I don’t yet have motion sensors or any kind of siren, so that suppresses alerts when we are sleeping, not completely ideal but I can work with it since I tend to be a light sleeper. Additionally, the arrival sensors seem rather sluggish in changing state.

I tried saying that if any door sensor changes to open and no code was entered, send an alert. Unfortunately, when they are grouped together, I can’t tell which door was opened. Then I thought I would create a variable from each sensor but I have not yet figured that out either.

So here is the gist of what I would like to do and hope I can get some input:

If any door opens and no code was entered then send an alert. But then I need a way to identify which door opened so the message sent can reflect that. But I also would like to identify methods that the notifications could be suppressed when one or both of us are home, yet perhaps get notifications when we are sleeping.

Any ideas?

Sorry for the long post, I thought more details might be helpful for anyone willing to chime in.

Complete newbie here and have only had SmartThings for a couple of weeks. I have replaced a lot of my switches, and trying to create rules that are more in-depth then Samsungs Smart Apps will allow.

First, is there a guide or resource page to learn more about creating rules? I was trying to set up a rule that I thought was correct but couldn’t get it to work.

Second, maybe I can get some insight on if I am setting up this Piston correctly. I have a motion sensor in bathroom hallway, a contact sensor on the door, GE Link bulb in my toilet area. I was trying to set it up a piston that if hall motion sensor had activity, and then door contact sensor changes state to turn on the light. Then I wanted the light to turn off if the contact sensor changes states again.

Basically if someone walks through the bathroom to the toilet turn on the light. Then when they are done and open the door it turns off the light.

I tried setting it up like this:

Piston Mode: And-If

Motion sensor Changes States
and Contact Sensor Changes states

Turn on bathroom light
and wait 1 minute.

And if…
Contact Sensor Changes states

Turn off Bathroom Light

Again I am completely new to this so if I am way off I apologize.

I use an app called Vacation Lighting Director to switch lights on and off when Home is in ‘Away’ or ‘Holiday’ Mode

You select which lights to use, how many you want on at a time and how long to cycle between on and off. I also set time for it to run between sunset -60 mins and 11pm.

Could this be done with CoRE??

Anyone interested in helping out to buy an Echo for Adrian? See here:

Trying to set up a piston to automatically lock a door if it’s been unlocked for 5 minutes but it doesn’t seem to even go from false to true on the condition (2 of my doors are currently unlocked). What am I doing wrong?

I don’t believe the “stays” functionality is working just yet.

Ahh that explains it. Is there a work around?

1 Like

Planning on getting those up today.

1 Like

Nice. I will be your first tester. BTW, will my rule work if let’s say one lock is unlocked for 5 minutes and another lock is unlocked for 2 minutes? I want each lock to lock automatically after 5 minutes after being unlocked, not all at the same time if two are unlocked.

Not really, it would lock both as soon as one of them reaches the 5 minute mark. You will need to combine that with was conditions and do individual actions on each. Or split it into two pistons, one for each door. I’ll show you when it’s done.

1 Like

I am using the 12727 (on/off, not dimmer) with the new physical feature and it’s working just fine. (Using the default Z-Wave Switch device type to allow local apps)

1 Like

That is great news. They probably fixed the problem. I assumed they didn’t…

13 posts were merged into an existing topic: Erroneous isPhysical() event (Zwave DTH)

@bamarayne I think you were trying to get power meter working for some pistsons a while back, did you ever get one to work properly consistantly?

I have a few pistons that require a “is less than” or “is greater than” before they go true, those seem to work fine. I can’t use one to validate an else or but if action though. It seems every time the value changes, even if it’s still true from the restriction perspective, it causes a re-evaluation. The closest I got to success more than a random one or two going through, was with “was inside range.”


But If:
Motion is inactive
Mike power was inside range 0w-120w for at least 1 minute
Motion Off switch is off

Then: (Cancel on piston change) Tried task override of local, action, global, and none.
Wait 2 min
Turn off

I had this one trigger correctly a few times but it’s very random. Logging shows the power switch involved NEVER going above 120w, so it makes no sense as it should be a historical evaluation.

This is using an Aeon smart strip, similar experience with the Lowes smart outlet with the native ST DHT.

1 Like

Do you need to enable “Only execute on piston state change”? :wink:

Added to the Then… right? Will test when I can go home for lunch. So with that option, help me with the logic…

  1. Light turns on due to motion from initial If statement (state change)
  2. But If… Motion stops and power is in range of 0-120w and my “disable” switch is off (state change)
  3. Then statement checks if state has changed, which state? From the first If or the But If?

Seems having the cancel on piston change would cancel the But If, if the primary If goes back true (motion-we know this works), but the But If state change is a change BEFORE it gets to the Then statement, so if the secondary goes true, the Then won’t activate unless ANOTHER state change occurs? Or is the Then intrinsically tied to the evaluation of only the But If (secondary) to begin with, when set to Execute on piston status change only?

Edit: Should TOS still be local?

1 Like

Please share when you get it to work I have 4 similar use case and would be nice if I don’t have to do the work :slight_smile: Loool

PS I am fighting the zwave 101 err, so I cannot do crap these days.

1 Like

The piston state. That’s where all different kind of pistons come into play. The state is calculated differently depending on the piston type. For the latching piston:

State changes to TRUE when state is FALSE and IF evaluates TRUE.
State changes to FALSE when state is TRUE and BUT IF evaluates TRUE

In essence, if both IF and BUT IF are true, the piston state flips (changes to TRUE if it was FALSE and vice-versa), if only one of the two condition sets is true, then the piston becomes the state associated with that one, if none of the two is true, the piston state does NOT change.

With this information in hand, you can plan for state changes.

If you are using measurements that change in time, every measurement change will result in an evaluation. Assuming that the state is currently TRUE, and the IF is true and the BUT IF is false, the state remains TRUE, the THEN actions execute, except those that have “Only execute on piston state change”. Those only run ONCE, when the piston state becomes true.

The TOS (Task Override Scope) does something else. If you have multiple actions controlling the same device (one in the IF’s THEN, one in the BUT IF’s THEN for example), you can choose to “override” all other pre-existing scheduled (pending) tasks for the involved devices, or you can just add to the schedule (by using TOS = None). If the IF THEN says Light turn on in 10 minutes and 2 minutes later, the BUT IF says light turn off, then this will happen:

TOS: None >>> light turns off, 8 minutes later, light turns on
TOS: Action >>> light turns off, 8 minutes later, light turns on (the two tasks were added by two distinct/different actions)
TOS: Local >>> light turns off - the turn on is canceled
TOS: Global >>> same as Local, but across all pistons (if any other piston was planning on doing something with that light, it won’t anymore) - the Global is not yet implemented, acts just like Local

To give you an example on when TOS Action is helpful:
You have an action that is executed on motion becoming inactive: Wait 10 minutes, Turn light off.
Motion becomes inactive, light is scheduled for turn off in 10 minutes. Motion becomes active again, and inactive again after 5 minutes. At this point, there is a scheduled turn off in the remaining 5 minutes. If TOS is Action (or above), that turn off in 5 minutes is canceled and replaced with a brand new one that will run in 10 minutes. Effectively resetting the timer. Use Action if you don’t want to interfere with commands from other actions. The action would then only override it’s own (Action scope) tasks. When using Local, an action asking a device to do a task overrides all tasks for the same device done by any action within the Local scope - the piston itself.

The Cancel on state change is different from TOS because it does NOT require another action to run to cancel it. The piston itself will cancel it if the piston state changes BEFORE the task is due. So this is - in a way - self contained, does not require another action. The TOS will not do anything unless the same or another action runs AGAIN and has the proper scope.

Hope this helps



That definitely clarifies things. The TOS examples help me get my head around that, and the “only execute on piston state change” was something I’ve completely overlooked. Will report back my results, thank you again!

1 Like