SmartThings Community

CoRE and Piston Rules Engine, first design steps


(Hans) #4321

Thank you, the virtual dimmer is now controlling the physical ones! I finally realized why I couldn’t use the “when true” syntax after banging my head against my computer screen all day today. I thought I was stupid because I couldn’t see the option. Turns out I had to turn on expert mode in the general CoRE settings. I could see writing some pretty slick routines now. Thanks again.

(John) #4322

Ah… that explains it. Thanks!

(Curtis Olson) #4323


Could you explain where I find the “mytokenhere” and the “appidhere”? I’m unclear if the token comes from the OAuth of the Core app or that is related to my ST account. And appid is obviously the id of the Core app. I don’t see an id on the web pages, but the URL for that app has an appid (the id string is random and not from my account)


(Curtis Olson) #4324

I found it in another thread. The token and app is are when you access the CoRE Dashboard from within the SmartThings app.



Loving getting into CORE, but not quite got my head around it yet. I’m having a go at a seemingly simple rule I’m using as a first case.

If a multi sensor senses vibration, and then the open/close sensor doesn’t open within 1 minute, generate a notification, but only when the alarm state is set to armed.

I initially used a Then-if and that sort of seemed to work, but it would trigger multiple times. I then switched to a Simple piston as well as experimenting with only execute of state change, but I now seem to be confusing myself…

(Bob) #4326

Piston queries tend to get posted in the thread below where people an awful lot brighter than me give some fantastic advice. Perhaps try here.

( I hate Mondays) #4327

This is by no means a simple use case - it involves a kicker event, a time window and the detection of a non-event, or lack of it. Latching piston.

   Vibration changes to active
   Using location... (TCP: cancel on piston state change)
       > Wait 1 minute
      > Send notification
   Contact sensor changes to open

(Petri Vanhala) #4328


I’m new to this SmartThings and CoRE stuff. Could anyone tell me is it possible to execute piston from Tasker with SharpTools? I can’t see any pistons there, only routines.

What I’m trying to do is following simple thing:

  1. When I manually start Netflix app from my device.
  2. In this case turn on certain lights, if my presence is at Home.

Better yet would be, when I press cast button to chromecast in Netflix app, turn on lights if presence at Home.



I am doing this now using the IFTTT trigger mode for a piston. This essentially creates a URL that you can then access directly through Tasker to trigger the piston.

(Petri Vanhala) #4330

How you create a URL to a piston in IFTTT? I have the IFTTT app, but don’t really have any idea about it and how it connects to a piston…

( I hate Mondays) #4331

What he means is… in the piston, he adds an IFTTT capability trigger. To “trigger” that piston, all you need is the dashboard URL, strip the dashboard/ part from it and add execute/<piston name>

Then just open the URL in a browser to test. Your URL will look like:

Try avoiding spaces in the piston name, or replace the spaces with %20 in the URL.


Thanks for the clarification. You explained it well in this previous post.


(Petri Vanhala) #4333

Thanks guys. Still, I’m bit struggling with the IFTTT, what should I choose there? My applet -> Create new applet, then it asks to choose Service. I can find Smartthings there, but not really sure if I should go that way…? Where can I add just simple Url trigger?


You don’t need to use IFTTT, that’s simply the name of the trigger that you should select in your CoRE piston. You can then use the technique @ady624 described above to get the URL.

(Petri Vanhala) #4335

Yeah, I actually got it working already with Tasker calling the Url. Thanks. Regarding IFTTT, I read that it has some trigger delay anyway so that would not be nice.


Much thanks for this app gentlemen, CoRE is the best rule engine i saw on any smarthome controller out there. Invaluable when testing device handlers.

(Tim Flinders) #4337

Hopefully someone can give me some suggestions. I want to get CoRE to turn off a set of lights if two motion sensors both haven’t been triggered within 15 minutes. I’ve simplified the logic to only look at the motion sensors but I potentially want to make the conditions more complex but this needs to work first.

In this configuration it appears to work until the Stays fire, if you look in the “BUT IF” section they both count down (different count downs) however once the first stay gets to 0 it fires and evaluates true but as soon as the second one evaluates the first stay is no longer evaluated true and goes false. The screen shot is after both stays have completed.

Hopefully this makes sense, I’m not sure whether this is by design or a bug. Given the Kitchen sensor is still inactive I want the “When True” condition to fire.


Avoid using two triggers (full circle) in same condition, try using “was inactive” instead, test if it works for your application.

(Ron Talley) #4339

I would do a Basic Piston with the following rule

If “All” (pick the motion sensors) “Stays” inactive for 15 minutes
Then using (pick the lights) Turn Off

I know it seems too simple but the “stays” is a trigger that will constantly evaluate the “If”…So if all motion sensors stays inactive…(once true) then…

Using two triggers will yield a false state majority of the time so be careful there. The wiki explains this well.

(Tim Flinders) #4340

Thanks I think you are right about keeping it simple. There is one problem the “Stays” trigger does not seem to allow ALL evaluations, it automatically changes to ANY when selected. This won’t work for me because if either are triggered I don’t want the lights to switch off.

The wiki links explains what it is going on so thanks for that, I’ll have a play with a few more combinations.