CoRE and Piston Rules Engine, first design steps

I think I just got sucked back in.

2 Likes

you need my universal garage door smart app, coming to a ST forum near you, very shortly…

5 Likes

@Jonpho, I don’t have a motion sensor available with me :slight_smile: but I used my kitchen light in lieu of the motion sensor and my living room light in lieu of the goodnight switch.

This is the piston in images:

Logs:

[ I turn on the kitchen light - this is your motion sensor becoming active ]
12:10:52 PM: info Processing event switch for device Kitchen Ambient Light with id 4e4fc2ac-eb7e-42d1-80c5-f7e307a46e8d, value on, generated on Wed May 18 16:10:50 UTC 2016, about 1651ms ago 
12:10:52 PM: info Executing [Front Door Light].setLevel([100])
[ 2 minutes passed ]
12:12:55 PM: info Executing [Front Door Light].off()


[ I then turn on the living Room light - this is your switch ]
12:14:53 PM: info Processing event switch for device Living Room Ambient Light with id e2faf148-4ea6-438f-af8b-ff09d860386c, value on, generated on Wed May 18 16:14:52 UTC 2016, about 1342ms ago
12:14:53 PM: info Executing [Front Door Light].setLevel([20])
[ 6 minutes passed ]
12:20:54 PM: info Executing [Front Door Light].off()


[ I turn on the switch, and then a minute later I move in front of the motion sensor ]
12:26:17 PM: info Processing event switch for device Living Room Ambient Light with id e2faf148-4ea6-438f-af8b-ff09d860386c, value on, generated on Wed May 18 16:26:17 UTC 2016, about 96ms ago
12:26:17 PM: info Executing [Front Door Light].setLevel([20])
12:27:52 PM: info Processing event switch for device Kitchen Ambient Light with id 4e4fc2ac-eb7e-42d1-80c5-f7e307a46e8d, value on, generated on Wed May 18 16:27:52 UTC 2016, about 169ms ago
12:27:52 PM: info Executing [Front Door Light].setLevel([100])
[ 2 minutes passed - the motion sensor timeout (2 minutes) has overridden the switch (6 minutes) ]
12:29:53 PM: info Executing [Front Door Light].off()

You could always use @Mike_Maxwell handler to simulate various devices that may not be on hand…

3 Likes

Where at? Me lazy…

Set a few of these, and you have extra sensors if you need…

1 Like

Why do you want to use my NAS??? (that’s been its hostname since sometime around 2002)

1 Like

@michaelahess You talking to me? You must be talking to me, 'cause I’m the only one in the room!

1 Like

This has become a serious power users’ UI, which will be very valuable to a small group of people but pretty confusing to many others. Hopefully this will follow the usual SmartThings model, where people from that small group will be willing to do peer assistance for others. In fact, you might want to go ahead and set up the peer assistance thread soon even though it’s still in Alpha, just to keep this thread more clear for what @ady624 is doing with feature development and testing.

I would also note that the recent mode discussion brings up a common complaint about the official SmartThings mobile app UI–often everything is in there, but in a sort of reverse Polish structure so that you have to know what you’re going to do before you do it. You can’t see the options available unless you’ve chosen a path that leads to that specific option.

This approach also means you pretty much have to have designed the entire rule before you start entering it. That makes sense to programmers, but it’s not how typical consumers use rules engines. Instead, they start with a simple idea and add in more options/restrictions as the rules engine UI reminds them that those exist.

The more options that get pushed down to the piston action level, the fewer “regular users” will know that they exist, and many will stop and complain that they don’t exist before they ever finish creating the piston. This is one place where peer assistance can be very helpful. :sunglasses:

5 Likes

@JDRoberts, you are (again?!) right, once the features settle, I will build a welcome page for the app installation that will ask the user what he “thinks” he is. Depending on that, I’ll preset some things. Perhaps we can have more “modes” (lol for the choice of word): “Beginner, Advanced, Expert”. Depending on the level chosen, I can show more or less options, as to make things simpler for the beginners while not taking away features from those who “think” they are experts. I have a t-shirt that reads “Those who think they know everything annoy those of us who do” - Cocky t-shirt, I love it :slight_smile:

We’ll have a survey to decide which feature is for which level…

3 Likes

I thought @ady624 had programmed in a self help clown that popped out of random devices and hit your family members with an inflatable bat…

Don’t know why… But I just really think that would be funny…

I need sleep.

2 Likes

Yeah, well, you’ve got like 12 kids, right? I can see the entertainment value at your house. :stuck_out_tongue_winking_eye:

2 Likes

Can we add a three-axis sensor to the bat and log which side of the round bat hit who? Maybe a pressure sensor too and a sound pressure sensor to record the punishment level achieved…

2 Likes

As long as you can add a “don’t hit the wife” restriction, too.

Just sayin’… :wink:

1 Like

There you go, takin away all the fun!

2 Likes

Keep getting a ‘null’ for my SmartThings smart outlet device. On version 0.02d.
Piston Mode: Simple
Setting up the following:
If
Spare Multisensor contact changes to open
Then
With null (should be Outlet)…
Turn on
Wait [1]
Turn off

Works fine with other lights, just not the outlet.

That’s not an option. The restriction is hard coded in the app. No user option on that one. Happy wife, happy life…

1 Like

Can you look in your IDE under Installed Apps and see the settings? Can you find your outlet on that list? Snapshot of that line please? Thank you

Not sure if this is what you meant, but the device does show up here:

ok, how do i set it up so the motion sensor timeout doesn’t override the switch?

In RM there was an option to have a switch disable a rule. Thats what I’m trying to recreate.

Also when i activate motion sensor the light doesn’t switch on, logs below

0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:51 PM: debug ╔═══ Done in 98ms
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:51 PM: debug ║╔══ Task processing took 28ms
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:51 PM: debug ║║░░ Removing any existing ST safety nets
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:51 PM: debug ║║░░ Scheduling ST to run in 89s, at Wed, May 18 2016 @ 6:40 PM BST
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:51 PM: debug ║║░░ Rescheduling time triggers
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:51 PM: debug ║╚══ Processing tasks
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:51 PM: debug ║╔══ Event processing took 67ms
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:51 PM: debug ║║░░ Scheduling actions for condition #-2. State did change.
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:51 PM: info ║║░░ :diamonds::diamonds::diamonds: Or-If Piston changed state to false :diamonds::diamonds::diamonds:
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:51 PM: debug ║║░░ Secondary IF block evaluation result is false
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:51 PM: debug ║║░░ Event eligibility for the secondary IF block is -1 - INELIGIBLE (something is messed up)
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:51 PM: debug ║║░░ Primary IF block evaluation result is false
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:51 PM: debug ║║░░ :spades: Function eval_cond_is for Landing Sensor’s motion [inactive] is active returned false
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:51 PM: debug ║║░░ :spades: Function eval_cond_is for Bottom of Stairs Sensor’s motion [inactive] is active returned false
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:51 PM: debug ║║░░ Event eligibility for the primary IF block is 1 - ELIGIBLE (triggers not required, event is a condition)
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:51 PM: debug ║╚══ Processing event motion for device Bottom of Stairs Sensor with id 4db8a660-6e45-47eb-b784-1ff0572c44e0, value inactive, generated on Wed May 18 17:38:51 UTC 2016, about 101ms ago
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:51 PM: debug ╚═══ Received a primary block device event
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:51 PM: debug
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:21 PM: debug ╔═══ Done in 110ms
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:21 PM: debug ║║░░ Scheduling ST to run in 120s, at Wed, May 18 2016 @ 6:40 PM BST
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:20 PM: info ║║░░ :diamonds::diamonds::diamonds: Or-If Piston changed state to true :diamonds::diamonds::diamonds:
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:21 PM: debug ║╚══ Processing tasks
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:21 PM: debug ║╔══ Event processing took 68ms
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:21 PM: debug ║║░░ Scheduling task [c:Turn off, p:[], i:2] for action [id:2, ra:null, d:[730eddd4-58fb-4969-b2ca-1751f316b445], t:[[c:● Wait, p:[[d:2, t:number, i:0]], i:1], [c:Turn off, p:[], i:2]], rm:null, a:null, pid:0, m:null, rc:false]
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:21 PM: debug ║║░░ Scheduling task [c:● Wait, p:[[d:2, t:number, i:0]], i:1] for action [id:2, ra:null, d:[730eddd4-58fb-4969-b2ca-1751f316b445], t:[[c:● Wait, p:[[d:2, t:number, i:0]], i:1], [c:Turn off, p:[], i:2]], rm:null, a:null, pid:0, m:null, rc:false]
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:20 PM: debug ║║░░ Scheduling task [c:● Wait, p:[[d:2, t:number, i:0]], i:1] for action [id:2, ra:null, d:[730eddd4-58fb-4969-b2ca-1751f316b445], t:[[c:● Wait, p:[[d:2, t:number, i:0]], i:1], [c:Turn off, p:[], i:2]], rm:null, a:null, pid:0, m:null, rc:false]
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:20 PM: debug ║║░░ Scheduling actions for condition #0. State did change.
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:20 PM: debug ║║░░ Scheduling actions for condition #0. State did NOT change.
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:20 PM: debug ║║░░ Secondary IF block evaluation result is true
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:20 PM: debug ║║░░ Event eligibility for the secondary IF block is -1 - INELIGIBLE (something is messed up)
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:20 PM: debug ║║░░ Primary IF block evaluation result is true
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:20 PM: debug ║║░░ Scheduling task [c:Turn off, p:[], i:2] for action [id:2, ra:null, d:[730eddd4-58fb-4969-b2ca-1751f316b445], t:[[c:● Wait, p:[[d:2, t:number, i:0]], i:1], [c:Turn off, p:[], i:2]], rm:null, a:null, pid:0, m:null, rc:false]
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:20 PM: debug ║║░░ Scheduling actions for condition #1. State did NOT change.
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:20 PM: debug ║║░░ Scheduling task [c:Set level, p:[[d:100, t:number, i:0]], i:1] for action [id:1, ra:null, d:[730eddd4-58fb-4969-b2ca-1751f316b445], t:[[c:Set level, p:[[d:100, t:number, i:0]], i:1]], rm:null, a:null, pid:0, m:null, rc:false]
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:20 PM: debug ║║░░ :clubs: Function eval_cond_is for Bottom of Stairs Sensor’s motion [active] is active returned true
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:20 PM: debug ║║░░ Event eligibility for the primary IF block is 1 - ELIGIBLE (triggers not required, event is a condition)
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:20 PM: debug ║╚══ Processing event motion for device Bottom of Stairs Sensor with id 4db8a660-6e45-47eb-b784-1ff0572c44e0, value active, generated on Wed May 18 17:38:20 UTC 2016, about 97ms ago
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:20 PM: debug ╚═══ Received a primary block device event
0cdecd33-461d-4820-b3b1-ef9662cba307 6:38:20 PM: debug