Rule Helper Tutorial

Rule Helper

In past tutorials we have introduced the concept of Rules on the SmartThings Platform. In this tutorial we will be going more in depth about rule creation and providing a demo app that will allow you to browse examples of existing SmartApps re-created as rules. The Rule Helper also has samples of simple and advanced rule structures.

The sample app was built using the create-react-app project, so you will need node.js

If you don’t have yarn

npm install -g yarn

First, clone the repo to your computer.

git clone https://github.com/jodyalbritton/rule-helper.git

Second, install the project

yarn install

Finally, start the project

yarn start 

If the project started, should see a window like this

The sample code has placeholders for the required devices, modes, scenes, etc. that you will need to locate based on your own location. Let’s look at an example

In this example you can see that the IF Block requires at least one Device ID and the Then Block also requires at least one Device ID.

Once you have those, you can follow the directions here for posting your rule to the proper endpoint

7 Likes

Thank you for your great work !

I’ve just installed on my linux server, and reverse proxied with NGINX.
It’s very easy to navigate, and I could edit jsons right on the web browser.

It still just navigates rules examples and templates though like examples below, I hope it would be great to integrate with Smartthings API in future.

SmartThingsCommunity/Rules-API-Hub (github.com)

Integrating the SmartThings API would not be difficult, but our goal with this example to provide an easy way to discover and explore rules. I put a license on the project (Apache 2.0) so any enterprising community member may fork and extend this tool.

The developer newsletter states that 60% of groovy smartapps can be done with the rules api instead, but what about the other 40%?

The percentage is a conservative estimate based on the current capabilities of the Rule API. As more features are added to the Rule API, that percentage will increase. It is also worth noting that in the past we did not have an official API so there are many SmartApps that exist only to provide an API interface for the developer. SmartApps were the solution to every problem in the past.

For more complex applications we have Endpoint SmartApps and the SmartApp SDK. Rules will solve the vast majority of the automation style SmartApps. Our API will be the gateway for building service connector Apps. Cloud Connected devices can use Schema or Endpoint connectors.

1 Like