Persistent automation rules in own smart app?

Hi, I am working on an application to control my home alarm system. I have been previously using an application called smartrules to manage the alarm. This is brilliant, I would just like to implement this automation in my own application. (Android)

At the moment, I am just using a webhook to grab the status and set the status, but how do I program in groovy to take the inputs and devices to create a simple rule for checking sensor status then triggering this etc.

There is no information regarding this in the developer’s section, I am very confident in programming, I just cannot find how to get the rules to be saved onto the smart things cloud, like the smart rules app does.

Any pointers or help would be much appreciated.

Thank you

This is definitely not trivial… That’s why folks have spent months developing Rule Machine, SmartRules, WebCoRE, and more.

Read the docs, especially regarding the “state” collection which is persistent for a SmartApp.

http://docs.smartthings.com/en/latest/smartapp-developers-guide/state.html

Even better? Use WebCoRE and/or pay the SmartRules developer for access to their SmartApp code which you can glean from. In fact, @obycode might even love to partner with you to develop the Android version of his iOS SmartRules front-end.

2 Likes

Just use webCoRE. Works in any browser to configure the rules/pistons. All of the source code is available on GitHub.

2 Likes

If you’re good at programming, I recommend skipping smartapps like WebCORE (as brilliant as they are) and simply programming your rules directly using Groovy and the SmartThings IDE. I created my security system this way.