CoRE for Dummies (How to get started and make your first Piston)

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.

:sunglasses:

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.

http://thingsthataresmart.wiki/index.php?title=CoRE

They also have a (currently) very basic examples page

http://thingsthataresmart.wiki/index.php?title=CoREsamples

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?

  1. 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.

https://graph.api.smartthings.com/

  1. 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.

http://thingsthataresmart.wiki/index.php?title=CoRE

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

  1. 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). :slight_smile:

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.

  1. 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.

  1. select “Add a condition”, which will open the following screen…

  1. select “Capability” and then on the next screen we’ll select “Date & Time” radio button which now should look like this…

  1. 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.


  1. 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…


  1. 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.


  1. 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.

  1. now let’s create our Then, select “Then…” which brings up a screen to select our actions

  1. select “Add an action” and for my lights we’ll select “Control lights, outlets, relays, or switches”


  1. 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

  1. 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”



  1. 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

  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.

62 Likes

Thanks for creating this guide. First look a CoRE can be VERY daunting and hopefully this will take the sting out of it!

I’ve been wanting to know what “CoRE” really is and what is does for the last few weeks and this is a great tutorial. The screen shots are very helpful!!!
Thanks

Thanks for the introduction. I am having a difficult time just figuring out what is out there. (The smartthings site is not the best.)

What is the overhead for CoRE? Is it better to write your own apps or use CoRE? Is there a breakeven point? (This is assuming you can code.)

What exactly do you mean by “overhead”? If it’s tied to the second question, I’d really have to say that rolling your own app can be easy or can be significantly difficult. It will depend on variables like how much coding experience you have. Groovy is fairly easy to learn if you have had really any type of coding experience. I personally have (VERY BASIC) knowledge of C++ and Obj C and can follow things I’ve seen others do. It will of course also depend on how sophisticated your program needs to be.

I’d certainly first look into CoRE as it is pretty full of rule options, and probably as close to “everything but the kitchen sink” as anything out there presently.

And of course with most open source projects with the ST community, you can adjust and tinker with the code to suit your personal needs. Hopefully finding something new and cool in your own fork that can be rolled back into the core (no pun intended) code.

I now have a couple of pistons running, I like CoRE. As a simple logic engine it works well. And is fairly easy to build with.
Overhead is the amount of resources it occupies that are there regardless of your pistons. Overhead is why I don’t run Windows.

The lack of documentation on CoRE is the only downfall as far as I can tell. It’s kind of difficult to find examples.

Have you done a search and noticed the literally thousands of posts about CoRE, along with the hundreds of examples?

Just curious… @Ac7ss ???

You’re best bet for examples are in the “CoRE - Get peer assistance here with setting up Pistons” link I have in the top of the post. There are tons in there and I’ve found some interesting ideas and things that got me thinking about new ideas for my own situation.

The documentation is a little bare, but I think it’s more because the smartapp is still in beta and the guy(s) writing it are of course doing it on their own time and giving it away for free. But it was hard for me to find info about it which of course is why I opted to create this post, hopefully giving people some basic info.

I do find what I can do with this smartapp to be great (compared to other rule engines I’ve tried). But like any other beta software it’s not going to be perfect. Scratch that, after working with computers since my very first Apple IIe…NO software is going to be perfect.

:wink:

1 Like

Thousands of posts is a daunting number. Needle in a haystack daunting. The poor choice in forum software doesn’t help either. Has anyone put together a Wiki for user examples and documentation of the app? This could help take some of the load off of the developers.

I do learn best by doing. But I also have a hard time figuring out just what is possible. Is there a notification option in the “Then” section? Can I change the color of a HUE lamp using the engine?

I now see what my main use for it will be, simple logic switches. “One off” apps as it were. It is simpler to do a “If everyone is gone and it’s daytime, turn off all lights.” with CoRE than an app. It is better, for me, to write an attic fan controller than use CoRE. (Deeper logic tree).

I could not figure out how to nest logic in CoRE for the first couple of days. “If (X && (Y || Z))” for example.

Thank you for the thread @smgran it is educational.

@Ac7ss

Try this thread… CoRE is much much more than you are seeing.

I challenge you to find a scenario it can not do in the current version.

2 Likes

Thanks @bamarayne . As I said, the barrier to me is knowing what is possible.

I’ve yet to find a scenario that was not possible with CoRE. And then with the askAexa integration, all of it voice controlled!

1 Like

Just ask and someone will probably say it is or it isn’t possible :slight_smile: – and maybe point you to other resources that may make it possible.

1 Like

This thread started by @bamarayne, back in June, has the potential to provide tons of example CoRE pistons. Unfortunately, it’s not being used very frequently :disappointed:

1 Like

True, everyone keeps posting their piston questions in the build threads, which makes them impossible to follow.

Where do I send a minor bug report?
When building a piston, When building the condition, it requires entering the comparison twice.
i.e.

  • presence sensor
  • user1
  • user2
  • Evaluation mode
  • All
  • Comparison
  • is
  • Value
  • not present

I have to clear the Comparison value and re-enter it for the condition to be accepted. Is this normal?

Well, again the thread you should be on is…

My thread is just a very basic primer and I’m afraid is just not intended to answer all questions you might have with CoRE. Whereas the other thread is viewed by the developer and he often provides help and answers. And I totally understand that thread is a bit long (number of posts) but it is the better place to go IMO.

1 Like

@smgran

Steve,
Great job on your tutorial… All help is appreciated by everyone.

1 Like

Ok, Now I can see why apps can be better. Server outages.

Wouldn’t you be able to do the same thing with the smart lighting app in smartthings?