This is a noob’s post created by a noob.
EDIT: 9/9/16 updated some links and added some newer info (Amazon’s Alexa, etc.)
EDIT: 9/10/16 updated some key info not mentioned in the install links
I’ve started this not because I know a bunch about CoRE (Community’s own Rules Engine), in fact it’s quite the opposite. Instead I’m just pulling together some helpful tips which got me get started and got me up and running with this outstanding rule engine for Smartthings.
There is a lot info out there mainly designed to help people do amazing things with CoRE, but it was hard to find the “for Dummies” type info. And very hard for me (a true noob) to get started. Hopefully this post will help others who may not have ever added a custom smartapp to the IDE or maybe never even have had to log into the IDE before.
If you are looking for really basic info on CoRE and how to get started, hopefully this will be the place for you. If you are very knowledgeable about the IDE, smartapp coding, etc. this is NOT the thread for you. This is noob-land. And we wear that title with honor.
What is CoRE?
Per the wiki, CoRE is …“a rule engine that takes events and states as input and executes actions based on the relationships between these events and states.” CoRE refers to what I would call “a rule” a Piston. Again per the wiki a Piston is “…a decisional unit in CoRE that does the heavy lifting of subscribing to events, performing conditional evaluation, and executing required actions.” Ahhh, yea, right, forgot we’re dealing with very smart developers here, but basically Pistons are those trigger/action things, If/Then stuff, you know (notice I didn’t say “rules”) that automate your stuff.
This CoRE project is absolutely amazing and the best thing I’ve seen in the very short time I’ve been using Smartthings. Actually it’s been a couple of years but I’m still a noob. It is completely open source and completely free, but the work is so outstanding I highly recommend that if you do end up using it and enjoy it that you donate to the developers (direct link available at the beta milestone thread listed below)
CoRE also plays well with others
Also note that CoRE can be used in conjunction with @MichaelS great Alexa smartapp AskAlexa. AskAlexa is not exactly as easy for noobs to implement like CoRE is, however it is doable. And tying them together is very very cool.
Wait!!! there’s a wiki?
Yes, which is located here but understand that the CoRE project (as of Sept '16) is still in beta and thus the wiki may not answer all questions. However, it is a good place to look.
They also have a (currently) very basic examples page
Where can I get help for CoRE?
For even more info than what the wiki can provide as well as tips, examples and great help visit this very active thread
Additionally you can follow the beta milestone thread here to find more info (bugs, etc.). This also has a direct link to donate to the developer.
Okay. How do I start?
- You need to login to your Smartthings IDE. If you have never done this before head to the following link below and enter your login and password for your Smartthings account. This will log you into your own IDE showing all your devices, apps, etc.
- Install the CoRE app, following the instructions in the wiki, here’s the link again (I did the GitHub install which was super easy but you do need to get an account at GitHub first, just FYI). The instructions here are great with pics so if you are a noob like me, don’t worry you can do this.
SUPER IMPORTANT NOTE: This doesn’t seem to be mentioned anywhere but after you follow the above steps to install CoRE into your ST IDE, you will need to actually load it onto your mobile app to use it. This is merely done by adding the smartapp as you would any other. The only difference is that on your mobile app (the ST app on your phone) the CoRE smartapp you created is located in the Marketplace under “My Apps” which is at the bottom of the list of apps
- Start building your rules…er…pistons. I’ve created a super simple one here as an example.
There are many ways to create pistons but I’m going to walk thru just doing it via the Smartthings mobile app.
First, open the app (that makes sense).
Then regardless what bottom tab you are currently on (Dashboard, My Home, Routines, Marketplace) select the Menu icon on the very top right of the app. This will slide right a screen that should look like this
Select SmartApps and you should see CoRE if you installed it correctly. If you have any other smartapps you will see them as well. Note: In the pic here you see the other smartapps I’ve installed so your screen will undoubtedly look different.
Select CoRE and you will now see options to view the “CoRE Dashboard” or “Add a Core piston” and the apps Settings. Until you have a piston setup the dashboard shows nothing of interest.
For now, just select “Add a Core piston”. Once you select that and you’ll see this.
We’ll create a super simple one so we’ll leave the “Piston Mode” to Basic. For more info on all the things you can do with CoRE remember to look at the wiki and the peer assistance threads. But for now, let’s just get started with something easy.
We’re just going to create a very simple IF/THEN piston to turn the lights on in the downstairs hallway in my house, 10 minutes before sunset on the weekends only. We’ll start by creating the IF statement.
- select “If…” which will open this new screen
This is going to be a very simple one so we’re just going to select “Add a condition” for information about “Add a group” or any of the other options please visit the links I mentioned above for help.
- select “Add a condition”, which will open the following screen…
- select “Capability” and then on the next screen we’ll select “Date & Time” radio button which now should look like this…
- tap “Done” at the top right of the screen we now have a new option called “Comparison” and when we select that we get a few options, we’ll select “happens at” since we want the condition to be at sunset. Tap “Done” again.
- we now have a new variable (and notice that each of the variables we MUST select in order to get our piston in a working state have a red bar next to them until we set the variable in which case the bar becomes blue). Anyway, select the “Value” variable and then the “sunset” radio button and once again the “Done” at the top right corner, you should see this…
- we’re going to get a little sophisticated here and set the “Offset (+/- minutes)” variable for our If trigger. Tapping the number (currently 0) under the “Offset (+/- minutes)” we’ll set it to a negative 10 (so -10) to represent 10 minutes prior to sunset.
- tap “Done” in the top right corner and then “Done” again to get us back to this screen (NOTE: in the pic I’ve scrolled down just a bit to show more info, so this is not the top of the screen)
Note at the bottom it will show the “Trigger Overview” as well as the current status (as I type this at 2pm it shows “Current evaluation: false” because it has not hit 10 minutes before sunset here in Northern California). It also shows below that the “Next schedule event” which does show the dates and times of 10 minutes before sunset in my area.
- now let’s create our Then, select “Then…” which brings up a screen to select our actions
- select “Add an action” and for my lights we’ll select “Control lights, outlets, relays, or switches”
- for my lights which are controlled by a switch I’ll select “Select lights, outlets, or switches” and then select the appropriate radio button (in my case Downstairs Hallway Lights) and then tap “Done” in the top right corner
- tap on “Done” once again and now I can add a task, selecting “Add a task” we’ll select the “Turn on” radio button and tap our favorite “Done”
We’re going to get sophisticated again and now we can select the options of "Only on these days"
12) select Saturday and Sunday radio buttons and (you guessed it) “Done” and “Done”
- we get to select “Done” one more time (yippee) which now shows us our first piston. Tap “Done” again and a pull down screen will say it’s adding and automating your piston.
After that you will get back to the main CoRE screen and see your brand new piston brilliantly called “CoRE Piston #1”
- to change the name of your piston to something a bit easier to identify what it really does (or to make edits to your piston) just select it. Name and Description options are towards the bottom of the screen once you’ve selected it. And as mentioned you can also edit it as you see fit. At the very bottom you can also remove the piston completely. Note: again in this pic I’ve scrolled down a bit so you can see where the variables are
Well, hopefully that helps you get started, as mentioned look thru the “CoRE - Get peer assistance here with setting up Pistons” thread for help, ideas, examples and more. And just another plug to donate, if you look at the code in the IDE you will see something like over 10,000 lines!!! Clearly a lot of work by the developer who is giving this away for free.